lookup of private key based on keyid of public key
[strongswan.git] / src / charon / config / policies / policy_store.h
1 /**
2 * @file policy_store.h
3 *
4 * @brief Interface policy_store_t.
5 *
6 */
7
8 /*
9 * Copyright (C) 2006 Martin Willi
10 * Hochschule fuer Technik Rapperswil
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
16 *
17 * This program is distributed in the hope that it will be useful, but
18 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
20 * for more details.
21 */
22
23 #ifndef POLICY_STORE_H_
24 #define POLICY_STORE_H_
25
26 #include <types.h>
27 #include <config/policies/policy.h>
28
29
30 typedef struct policy_store_t policy_store_t;
31
32 /**
33 * @brief The interface for a store of policy_t's.
34 *
35 * @b Constructors:
36 * - stroke_create()
37 *
38 * @ingroup config
39 */
40 struct policy_store_t {
41
42 /**
43 * @brief Returns a policy identified by two IDs.
44 *
45 * The returned policy gets created/cloned and therefore must be
46 * destroyed by the caller.
47 * other_id must be fully qualified. my_id may be %any, as the
48 * other peer may not include an IDr Request.
49 *
50 * @param this calling object
51 * @param my_id own ID of the policy
52 * @param other_id others ID of the policy
53 * @return
54 * - matching policy_t, if found
55 * - NULL otherwise
56 */
57 policy_t *(*get_policy_by_ids) (policy_store_t *this, identification_t *my_id, identification_t *other_id);
58
59 /**
60 * @brief Returns a policy identified by a connection name.
61 *
62 * The returned policy gets created/cloned and therefore must be
63 * destroyed by the caller.
64 *
65 * @param this calling object
66 * @param name name of the policy
67 * @return
68 * - matching policy_t, if found
69 * - NULL otherwise
70 */
71 policy_t *(*get_policy_by_name) (policy_store_t *this, char *name);
72
73 /**
74 * @brief Add a policy to the list.
75 *
76 * The policy is owned by the store after the call. Do
77 * not modify nor free.
78 *
79 * @param this calling object
80 * @param policy policy to add
81 */
82 void (*add_policy) (policy_store_t *this, policy_t *policy);
83
84 /**
85 * @brief Delete a policy from the store.
86 *
87 * Remove a policy from the store identified by its name.
88 *
89 * @param this calling object
90 * @param policy policy to add
91 * @return
92 * - SUCCESS, or
93 * - NOT_FOUND
94 */
95 status_t (*delete_policy) (policy_store_t *this, char *name);
96
97 /**
98 * @brief Destroys a policy_store_t object.
99 *
100 * @param this calling object
101 */
102 void (*destroy) (policy_store_t *this);
103 };
104
105 #endif /*POLICY_STORE_H_*/