]>
Commit | Line | Data |
---|---|---|
16b9a73c MW |
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> | |
13e4a62f | 27 | #include <config/policies/policy.h> |
16b9a73c MW |
28 | |
29 | ||
30 | typedef struct policy_store_t policy_store_t; | |
31 | ||
32 | /** | |
87a217f9 | 33 | * @brief The interface for a store of policy_t's. |
16b9a73c MW |
34 | * |
35 | * @b Constructors: | |
87a217f9 | 36 | * - stroke_create() |
16b9a73c MW |
37 | * |
38 | * @ingroup config | |
39 | */ | |
40 | struct policy_store_t { | |
41 | ||
42 | /** | |
43 | * @brief Returns a policy identified by two IDs. | |
44 | * | |
87a217f9 MW |
45 | * The returned policy gets created/cloned and therefore must be |
46 | * destroyed by the caller. | |
47 | * | |
16b9a73c MW |
48 | * @param this calling object |
49 | * @param my_id own ID of the policy | |
50 | * @param other_id others ID of the policy | |
51 | * @return | |
52 | * - matching policy_t, if found | |
53 | * - NULL otherwise | |
54 | */ | |
55 | policy_t *(*get_policy) (policy_store_t *this, identification_t *my_id, identification_t *other_id); | |
13e4a62f MW |
56 | |
57 | /** | |
58 | * @brief Add a policy to the list. | |
59 | * | |
60 | * The policy is owned by the store after the call. Do | |
61 | * not modify nor free. | |
62 | * | |
63 | * @param this calling object | |
64 | * @param policy policy to add | |
65 | */ | |
66 | void (*add_policy) (policy_store_t *this, policy_t *policy); | |
16b9a73c MW |
67 | |
68 | /** | |
69 | * @brief Destroys a policy_store_t object. | |
70 | * | |
71 | * @param this calling object | |
72 | */ | |
73 | void (*destroy) (policy_store_t *this); | |
74 | }; | |
75 | ||
76 | #endif /*POLICY_STORE_H_*/ |