aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorGabor X Toth <*@tg-x.net>2013-09-25 17:45:59 +0000
committerGabor X Toth <*@tg-x.net>2013-09-25 17:45:59 +0000
commitffc11bb1c2c09cda9e7bed84e56cedb8ed49d46c (patch)
tree8003be1feb88db1f585e5c480b11b2a01cf3109b /src/include
parent38f919aee243423fdc49828687c5735ab77b9128 (diff)
downloadgnunet-ffc11bb1c2c09cda9e7bed84e56cedb8ed49d46c.tar.gz
gnunet-ffc11bb1c2c09cda9e7bed84e56cedb8ed49d46c.zip
env lib
Diffstat (limited to 'src/include')
-rw-r--r--src/include/gnunet_env_lib.h102
1 files changed, 57 insertions, 45 deletions
diff --git a/src/include/gnunet_env_lib.h b/src/include/gnunet_env_lib.h
index 0a7e195be..89c41d2c1 100644
--- a/src/include/gnunet_env_lib.h
+++ b/src/include/gnunet_env_lib.h
@@ -1,22 +1,22 @@
1/* 1/*
2 This file is part of GNUnet. 2 * This file is part of GNUnet.
3 (C) 2013 Christian Grothoff (and other contributing authors) 3 * (C) 2013 Christian Grothoff (and other contributing authors)
4 4 *
5 GNUnet is free software; you can redistribute it and/or modify 5 * GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 * it under the terms of the GNU General Public License as published
7 by the Free Software Foundation; either version 3, or (at your 7 * by the Free Software Foundation; either version 3, or (at your
8 option) any later version. 8 * option) any later version.
9 9 *
10 GNUnet is distributed in the hope that it will be useful, but 10 * GNUnet is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 General Public License for more details. 13 * General Public License for more details.
14 14 *
15 You should have received a copy of the GNU General Public License 15 * You should have received a copy of the GNU General Public License
16 along with GNUnet; see the file COPYING. If not, write to the 16 * along with GNUnet; see the file COPYING. If not, write to the
17 Free Software Foundation, Inc., 59 Temple Place - Suite 330, 17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
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
@@ -113,6 +113,16 @@ struct GNUNET_ENV_Modifier {
113 * Value of variable. 113 * Value of variable.
114 */ 114 */
115 const void *value; 115 const void *value;
116
117 /**
118 * Next modifier.
119 */
120 struct GNUNET_ENV_Modifier *next;
121
122 /**
123 * Previous modifier.
124 */
125 struct GNUNET_ENV_Modifier *prev;
116}; 126};
117 127
118 128
@@ -134,52 +144,54 @@ GNUNET_ENV_environment_create ();
134 144
135 145
136/** 146/**
137 * Add an operation on a variable to the environment. 147 * Add a modifier to the environment.
138 * 148 *
139 * @param env The environment. 149 * @param env The environment.
140 * @param oper Operation to perform. 150 * @param oper Operation to perform.
141 * @param name Name of the variable. 151 * @param name Name of the variable.
142 * @param value_size Size of @a value.
143 * @param value Value of the variable. 152 * @param value Value of the variable.
144 * 153 * @param value_size Size of @a value.
145 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error.
146 */ 154 */
147int 155void
148GNUNET_ENV_environment_operation (struct GNUNET_ENV_Environment *env, 156GNUNET_ENV_environment_add_mod (struct GNUNET_ENV_Environment *env,
149 enum GNUNET_ENV_Operator oper, 157 enum GNUNET_ENV_Operator oper, const char *name,
150 const char *name, 158 const void *value, size_t value_size);
151 size_t value_size, const void *value);
152 159
153 160
154/** 161/**
155 * Get all modifiers in the environment. 162 * Iterator for modifiers in the environment.
156 * 163 *
157 * FIXME: use an iterator instead, as we'll likely use a SList to store the 164 * @param cls Closure.
158 * modifiers in the environment. 165 * @param mod Modifier.
166 *
167 * @return #GNUNET_YES to continue iterating,
168 * #GNUNET_NO to stop.
169 */
170typedef int
171(*GNUNET_ENV_Iterator) (void *cls, struct GNUNET_ENV_Modifier *mod);
172
173
174/**
175 * Iterate through all modifiers in the environment.
159 * 176 *
160 * @param env The environment. 177 * @param env The environment.
161 * @param[out] modifier_count Set to the number of returned modifiers. 178 * @param it Iterator.
162 * 179 * @param it_cls Closure for iterator.
163 * @return Array of modifiers.
164 */ 180 */
165const struct GNUNET_ENV_Modifier * 181void
166GNUNET_ENV_environment_get_modifiers (const struct GNUNET_ENV_Environment *env, 182GNUNET_ENV_environment_iterate (const struct GNUNET_ENV_Environment *env,
167 size_t *modifier_count); 183 GNUNET_ENV_Iterator it, void *it_cls);
168 184
169 185
170/** 186/**
171 * Add list of modifiers to the environment. 187 * Get the number of modifiers in the environment.
172 * 188 *
173 * @param env The environment. 189 * @param env The environment.
174 * @param modifier_count Number of @a modifiers. 190 *
175 * @param modifiers Array of modifiers to add. 191 * @return Number of modifiers.
176 *
177 * @return #GNUNET_OK on success, #GNUNET_SYSERR on error.
178 */ 192 */
179int 193size_t
180GNUNET_ENV_environment_set_modifiers (const struct GNUNET_ENV_Environment *env, 194GNUNET_ENV_environment_get_mod_count (const struct GNUNET_ENV_Environment *env);
181 size_t modifier_count,
182 const struct GNUNET_ENV_Modifier *modifiers);
183 195
184 196
185/** 197/**