diff options
Diffstat (limited to 'src/include/gnunet_env_lib.h')
-rw-r--r-- | src/include/gnunet_env_lib.h | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/include/gnunet_env_lib.h b/src/include/gnunet_env_lib.h index 89c41d2c1..857ad45c2 100644 --- a/src/include/gnunet_env_lib.h +++ b/src/include/gnunet_env_lib.h | |||
@@ -18,7 +18,7 @@ | |||
18 | * Boston, MA 02111-1307, USA. | 18 | * Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file include/gnunet_env_lib.h | 22 | * @file include/gnunet_env_lib.h |
23 | * @brief Library providing operations for the @e environment of | 23 | * @brief Library providing operations for the @e environment of |
24 | * PSYC and Social messages, and for (de)serializing variable values. | 24 | * PSYC and Social messages, and for (de)serializing variable values. |
@@ -38,38 +38,38 @@ extern "C" | |||
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | 40 | ||
41 | /** | 41 | /** |
42 | * Possible operations on PSYC state (persistent) and transient variables (per message). | 42 | * Possible operations on PSYC state (persistent) and transient variables (per message). |
43 | */ | 43 | */ |
44 | enum GNUNET_ENV_Operator | 44 | enum GNUNET_ENV_Operator |
45 | { | 45 | { |
46 | /** | 46 | /** |
47 | * Set value of a transient variable. | 47 | * Set value of a transient variable. |
48 | */ | 48 | */ |
49 | GNUNET_ENV_OP_SET = ':', | 49 | GNUNET_ENV_OP_SET = ':', |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Assign value for a persistent state variable. | 52 | * Assign value for a persistent state variable. |
53 | * | 53 | * |
54 | * If an assigned value is NULL, the variable is deleted. | 54 | * If an assigned value is NULL, the variable is deleted. |
55 | */ | 55 | */ |
56 | GNUNET_ENV_OP_ASSIGN = '=', | 56 | GNUNET_ENV_OP_ASSIGN = '=', |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Augment state variable. | 59 | * Augment state variable. |
60 | * | 60 | * |
61 | * Used for appending strings, adding numbers, and adding new items to a list or dictionary. | 61 | * Used for appending strings, adding numbers, and adding new items to a list or dictionary. |
62 | */ | 62 | */ |
63 | GNUNET_ENV_OP_AUGMENT = '+', | 63 | GNUNET_ENV_OP_AUGMENT = '+', |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Diminish state variable. | 66 | * Diminish state variable. |
67 | * | 67 | * |
68 | * Used for subtracting numbers, and removing items from a list or dictionary. | 68 | * Used for subtracting numbers, and removing items from a list or dictionary. |
69 | */ | 69 | */ |
70 | GNUNET_ENV_OP_DIMINISH = '-', | 70 | GNUNET_ENV_OP_DIMINISH = '-', |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Update state variable. | 73 | * Update state variable. |
74 | * | 74 | * |
75 | * Used for modifying a single item of a list or dictionary. | 75 | * Used for modifying a single item of a list or dictionary. |
@@ -78,7 +78,7 @@ enum GNUNET_ENV_Operator | |||
78 | }; | 78 | }; |
79 | 79 | ||
80 | 80 | ||
81 | /** | 81 | /** |
82 | * PSYC variable types. | 82 | * PSYC variable types. |
83 | */ | 83 | */ |
84 | enum GNUNET_ENV_Type | 84 | enum GNUNET_ENV_Type |
@@ -90,26 +90,26 @@ enum GNUNET_ENV_Type | |||
90 | }; | 90 | }; |
91 | 91 | ||
92 | 92 | ||
93 | /** | 93 | /** |
94 | * PSYC state modifier. | 94 | * PSYC state modifier. |
95 | */ | 95 | */ |
96 | struct GNUNET_ENV_Modifier { | 96 | struct GNUNET_ENV_Modifier { |
97 | /** | 97 | /** |
98 | * State operation. | 98 | * State operation. |
99 | */ | 99 | */ |
100 | enum GNUNET_ENV_Operator oper; | 100 | enum GNUNET_ENV_Operator oper; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Variable name. | 103 | * Variable name. |
104 | */ | 104 | */ |
105 | const char *name; | 105 | const char *name; |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Size of @a value. | 108 | * Size of @a value. |
109 | */ | 109 | */ |
110 | size_t value_size; | 110 | size_t value_size; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * Value of variable. | 113 | * Value of variable. |
114 | */ | 114 | */ |
115 | const void *value; | 115 | const void *value; |
@@ -126,7 +126,7 @@ struct GNUNET_ENV_Modifier { | |||
126 | }; | 126 | }; |
127 | 127 | ||
128 | 128 | ||
129 | /** | 129 | /** |
130 | * Environment for a message. | 130 | * Environment for a message. |
131 | * | 131 | * |
132 | * Contains modifiers. | 132 | * Contains modifiers. |
@@ -134,16 +134,16 @@ struct GNUNET_ENV_Modifier { | |||
134 | struct GNUNET_ENV_Environment; | 134 | struct GNUNET_ENV_Environment; |
135 | 135 | ||
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Create an environment. | 138 | * Create an environment. |
139 | * | 139 | * |
140 | * @return A newly allocated environment. | 140 | * @return A newly allocated environment. |
141 | */ | 141 | */ |
142 | struct GNUNET_ENV_Environment * | 142 | struct GNUNET_ENV_Environment * |
143 | GNUNET_ENV_environment_create (); | 143 | GNUNET_ENV_environment_create (); |
144 | 144 | ||
145 | 145 | ||
146 | /** | 146 | /** |
147 | * Add a modifier to the environment. | 147 | * Add a modifier to the environment. |
148 | * | 148 | * |
149 | * @param env The environment. | 149 | * @param env The environment. |
@@ -158,7 +158,7 @@ GNUNET_ENV_environment_add_mod (struct GNUNET_ENV_Environment *env, | |||
158 | const void *value, size_t value_size); | 158 | const void *value, size_t value_size); |
159 | 159 | ||
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Iterator for modifiers in the environment. | 162 | * Iterator for modifiers in the environment. |
163 | * | 163 | * |
164 | * @param cls Closure. | 164 | * @param cls Closure. |
@@ -171,7 +171,7 @@ typedef int | |||
171 | (*GNUNET_ENV_Iterator) (void *cls, struct GNUNET_ENV_Modifier *mod); | 171 | (*GNUNET_ENV_Iterator) (void *cls, struct GNUNET_ENV_Modifier *mod); |
172 | 172 | ||
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Iterate through all modifiers in the environment. | 175 | * Iterate through all modifiers in the environment. |
176 | * | 176 | * |
177 | * @param env The environment. | 177 | * @param env The environment. |
@@ -183,7 +183,7 @@ GNUNET_ENV_environment_iterate (const struct GNUNET_ENV_Environment *env, | |||
183 | GNUNET_ENV_Iterator it, void *it_cls); | 183 | GNUNET_ENV_Iterator it, void *it_cls); |
184 | 184 | ||
185 | 185 | ||
186 | /** | 186 | /** |
187 | * Get the number of modifiers in the environment. | 187 | * Get the number of modifiers in the environment. |
188 | * | 188 | * |
189 | * @param env The environment. | 189 | * @param env The environment. |
@@ -194,7 +194,7 @@ size_t | |||
194 | GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env); | 194 | GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env); |
195 | 195 | ||
196 | 196 | ||
197 | /** | 197 | /** |
198 | * Destroy an environment. | 198 | * Destroy an environment. |
199 | * | 199 | * |
200 | * @param env The environment to destroy. | 200 | * @param env The environment to destroy. |
@@ -203,18 +203,18 @@ void | |||
203 | GNUNET_ENV_environment_destroy (struct GNUNET_ENV_Environment *env); | 203 | GNUNET_ENV_environment_destroy (struct GNUNET_ENV_Environment *env); |
204 | 204 | ||
205 | 205 | ||
206 | /** | 206 | /** |
207 | * Get the type of variable. | 207 | * Get the type of variable. |
208 | * | 208 | * |
209 | * @param name Name of the variable. | 209 | * @param name Name of the variable. |
210 | * | 210 | * |
211 | * @return Variable type. | 211 | * @return Variable type. |
212 | */ | 212 | */ |
213 | enum GNUNET_ENV_Type | 213 | enum GNUNET_ENV_Type |
214 | GNUNET_ENV_var_get_type (char *name); | 214 | GNUNET_ENV_var_get_type (char *name); |
215 | 215 | ||
216 | 216 | ||
217 | /** | 217 | /** |
218 | * Perform an operation on a variable. | 218 | * Perform an operation on a variable. |
219 | * | 219 | * |
220 | * @param name Name of variable. | 220 | * @param name Name of variable. |
@@ -225,7 +225,7 @@ GNUNET_ENV_var_get_type (char *name); | |||
225 | * @param args_size Size of @a args. | 225 | * @param args_size Size of @a args. |
226 | * @param return_value Return value. | 226 | * @param return_value Return value. |
227 | * @param return_value_size Size of @a return_value. | 227 | * @param return_value_size Size of @a return_value. |
228 | * | 228 | * |
229 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR | 229 | * @return #GNUNET_OK on success, else #GNUNET_SYSERR |
230 | */ | 230 | */ |
231 | int | 231 | int |
@@ -234,7 +234,7 @@ GNUNET_ENV_operation (char *name, void *current_value, size_t current_value_size | |||
234 | void **return_value, size_t *return_value_size); | 234 | void **return_value, size_t *return_value_size); |
235 | 235 | ||
236 | 236 | ||
237 | /** | 237 | /** |
238 | * Get the variable's value as an integer. | 238 | * Get the variable's value as an integer. |
239 | * | 239 | * |
240 | * @param size Size of value. | 240 | * @param size Size of value. |
@@ -247,7 +247,7 @@ int | |||
247 | GNUNET_ENV_value_to_number (size_t size, const void *value, int64_t *number); | 247 | GNUNET_ENV_value_to_number (size_t size, const void *value, int64_t *number); |
248 | 248 | ||
249 | 249 | ||
250 | /** | 250 | /** |
251 | * Get the variable's value as a list. | 251 | * Get the variable's value as a list. |
252 | * | 252 | * |
253 | * @param size Size of value. | 253 | * @param size Size of value. |
@@ -260,7 +260,7 @@ int | |||
260 | GNUNET_ENV_value_to_list (size_t size, const void *value, struct GNUNET_CONTAINER_SList **list); | 260 | GNUNET_ENV_value_to_list (size_t size, const void *value, struct GNUNET_CONTAINER_SList **list); |
261 | 261 | ||
262 | 262 | ||
263 | /** | 263 | /** |
264 | * Get the variable's value as a dictionary. | 264 | * Get the variable's value as a dictionary. |
265 | * | 265 | * |
266 | * @param size Size of value. | 266 | * @param size Size of value. |
@@ -273,36 +273,36 @@ int | |||
273 | GNUNET_ENV_value_to_dict (size_t size, const void *value, struct GNUNET_CONTAINER_MultiHashMap **dict); | 273 | GNUNET_ENV_value_to_dict (size_t size, const void *value, struct GNUNET_CONTAINER_MultiHashMap **dict); |
274 | 274 | ||
275 | 275 | ||
276 | /** | 276 | /** |
277 | * Create a PSYC variable value from an integer. | 277 | * Create a PSYC variable value from an integer. |
278 | * | 278 | * |
279 | * @param number The number to convert. | 279 | * @param number The number to convert. |
280 | * @param[out] value_size Size of returned value. | 280 | * @param[out] value_size Size of returned value. |
281 | * | 281 | * |
282 | * @return A newly allocated value or NULL on error. | 282 | * @return A newly allocated value or NULL on error. |
283 | */ | 283 | */ |
284 | void * | 284 | void * |
285 | GNUNET_ENV_value_from_number (int64_t number, size_t *value_size); | 285 | GNUNET_ENV_value_from_number (int64_t number, size_t *value_size); |
286 | 286 | ||
287 | 287 | ||
288 | /** | 288 | /** |
289 | * Create a PSYC variable value from a list. | 289 | * Create a PSYC variable value from a list. |
290 | * | 290 | * |
291 | * @param list The list to convert. | 291 | * @param list The list to convert. |
292 | * @param[out] value_size Size of returned value. | 292 | * @param[out] value_size Size of returned value. |
293 | * | 293 | * |
294 | * @return A newly allocated value or NULL on error. | 294 | * @return A newly allocated value or NULL on error. |
295 | */ | 295 | */ |
296 | void * | 296 | void * |
297 | GNUNET_ENV_value_from_list (struct GNUNET_CONTAINER_SList *list, size_t *value_size); | 297 | GNUNET_ENV_value_from_list (struct GNUNET_CONTAINER_SList *list, size_t *value_size); |
298 | 298 | ||
299 | 299 | ||
300 | /** | 300 | /** |
301 | * Create a PSYC variable value from a dictionary. | 301 | * Create a PSYC variable value from a dictionary. |
302 | * | 302 | * |
303 | * @param dict The dict to convert. | 303 | * @param dict The dict to convert. |
304 | * @param[out] value_size Size of returned value. | 304 | * @param[out] value_size Size of returned value. |
305 | * | 305 | * |
306 | * @return A newly allocated value or NULL on error. | 306 | * @return A newly allocated value or NULL on error. |
307 | */ | 307 | */ |
308 | void * | 308 | void * |