summaryrefslogtreecommitdiff
path: root/src/include/gnunet_service_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_service_lib.h')
-rw-r--r--src/include/gnunet_service_lib.h87
1 files changed, 43 insertions, 44 deletions
diff --git a/src/include/gnunet_service_lib.h b/src/include/gnunet_service_lib.h
index fce912277..9cdf4d459 100644
--- a/src/include/gnunet_service_lib.h
+++ b/src/include/gnunet_service_lib.h
@@ -11,12 +11,12 @@
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 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 17
18 SPDX-License-Identifier: AGPL3.0-or-later 18 SPDX-License-Identifier: AGPL3.0-or-later
19*/ 19 */
20 20
21/** 21/**
22 * @author Christian Grothoff 22 * @author Christian Grothoff
@@ -50,8 +50,7 @@ extern "C"
50/** 50/**
51 * Options for the service (bitmask). 51 * Options for the service (bitmask).
52 */ 52 */
53enum GNUNET_SERVICE_Options 53enum GNUNET_SERVICE_Options {
54{
55 /** 54 /**
56 * Use defaults. Terminates all client connections and the listen 55 * Use defaults. Terminates all client connections and the listen
57 * sockets immediately upon receiving the shutdown signal. 56 * sockets immediately upon receiving the shutdown signal.
@@ -165,12 +164,12 @@ typedef void
165 * @return NULL on error 164 * @return NULL on error
166 */ 165 */
167struct GNUNET_SERVICE_Handle * 166struct GNUNET_SERVICE_Handle *
168GNUNET_SERVICE_start (const char *service_name, 167GNUNET_SERVICE_start(const char *service_name,
169 const struct GNUNET_CONFIGURATION_Handle *cfg, 168 const struct GNUNET_CONFIGURATION_Handle *cfg,
170 GNUNET_SERVICE_ConnectHandler connect_cb, 169 GNUNET_SERVICE_ConnectHandler connect_cb,
171 GNUNET_SERVICE_DisconnectHandler disconnect_cb, 170 GNUNET_SERVICE_DisconnectHandler disconnect_cb,
172 void *cls, 171 void *cls,
173 const struct GNUNET_MQ_MessageHandler *handlers); 172 const struct GNUNET_MQ_MessageHandler *handlers);
174 173
175 174
176/** 175/**
@@ -179,7 +178,7 @@ GNUNET_SERVICE_start (const char *service_name,
179 * @param srv service to stop 178 * @param srv service to stop
180 */ 179 */
181void 180void
182GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv); 181GNUNET_SERVICE_stop(struct GNUNET_SERVICE_Handle *srv);
183 182
184 183
185/** 184/**
@@ -224,15 +223,15 @@ GNUNET_SERVICE_stop (struct GNUNET_SERVICE_Handle *srv);
224 * @return 0 on success, non-zero on error 223 * @return 0 on success, non-zero on error
225 */ 224 */
226int 225int
227GNUNET_SERVICE_run_ (int argc, 226GNUNET_SERVICE_run_(int argc,
228 char *const *argv, 227 char *const *argv,
229 const char *service_name, 228 const char *service_name,
230 enum GNUNET_SERVICE_Options options, 229 enum GNUNET_SERVICE_Options options,
231 GNUNET_SERVICE_InitCallback service_init_cb, 230 GNUNET_SERVICE_InitCallback service_init_cb,
232 GNUNET_SERVICE_ConnectHandler connect_cb, 231 GNUNET_SERVICE_ConnectHandler connect_cb,
233 GNUNET_SERVICE_DisconnectHandler disconnect_cb, 232 GNUNET_SERVICE_DisconnectHandler disconnect_cb,
234 void *cls, 233 void *cls,
235 const struct GNUNET_MQ_MessageHandler *handlers); 234 const struct GNUNET_MQ_MessageHandler *handlers);
236 235
237 236
238/** 237/**
@@ -286,29 +285,29 @@ GNUNET_SERVICE_run_ (int argc,
286 * &disconnect_cb, 285 * &disconnect_cb,
287 * closure_for_cb, 286 * closure_for_cb,
288 * GNUNET_MQ_hd_var_size (get, 287 * GNUNET_MQ_hd_var_size (get,
289 * GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST, 288 * GNUNET_MESSAGE_TYPE_RESOLVER_REQUEST,
290 * struct GNUNET_RESOLVER_GetMessage, 289 * struct GNUNET_RESOLVER_GetMessage,
291 * NULL), 290 * NULL),
292 * GNUNET_MQ_handler_end ()); 291 * GNUNET_MQ_handler_end ());
293 * </code> 292 * </code>
294 */ 293 */
295#define GNUNET_SERVICE_MAIN(service_name,service_options,init_cb,connect_cb,disconnect_cb,cls,...) \ 294#define GNUNET_SERVICE_MAIN(service_name, service_options, init_cb, connect_cb, disconnect_cb, cls, ...) \
296 int \ 295 int \
297 main (int argc,\ 296 main(int argc, \
298 char *const *argv)\ 297 char *const *argv) \
299 { \ 298 { \
300 struct GNUNET_MQ_MessageHandler mh[] = { \ 299 struct GNUNET_MQ_MessageHandler mh[] = { \
301 __VA_ARGS__ \ 300 __VA_ARGS__ \
302 }; \ 301 }; \
303 return GNUNET_SERVICE_run_ (argc, \ 302 return GNUNET_SERVICE_run_(argc, \
304 argv, \ 303 argv, \
305 service_name, \ 304 service_name, \
306 service_options, \ 305 service_options, \
307 init_cb, \ 306 init_cb, \
308 connect_cb, \ 307 connect_cb, \
309 disconnect_cb, \ 308 disconnect_cb, \
310 cls, \ 309 cls, \
311 mh); \ 310 mh); \
312 } 311 }
313 312
314 313
@@ -319,7 +318,7 @@ GNUNET_SERVICE_run_ (int argc,
319 * @param sh service to stop accepting connections. 318 * @param sh service to stop accepting connections.
320 */ 319 */
321void 320void
322GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh); 321GNUNET_SERVICE_suspend(struct GNUNET_SERVICE_Handle *sh);
323 322
324 323
325/** 324/**
@@ -328,7 +327,7 @@ GNUNET_SERVICE_suspend (struct GNUNET_SERVICE_Handle *sh);
328 * @param sh service to resume accepting connections. 327 * @param sh service to resume accepting connections.
329 */ 328 */
330void 329void
331GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh); 330GNUNET_SERVICE_resume(struct GNUNET_SERVICE_Handle *sh);
332 331
333 332
334/** 333/**
@@ -338,7 +337,7 @@ GNUNET_SERVICE_resume (struct GNUNET_SERVICE_Handle *sh);
338 * @param c the client to continue receiving from 337 * @param c the client to continue receiving from
339 */ 338 */
340void 339void
341GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c); 340GNUNET_SERVICE_client_continue(struct GNUNET_SERVICE_Client *c);
342 341
343 342
344/** 343/**
@@ -348,7 +347,7 @@ GNUNET_SERVICE_client_continue (struct GNUNET_SERVICE_Client *c);
348 * @return the message queue of @a c 347 * @return the message queue of @a c
349 */ 348 */
350struct GNUNET_MQ_Handle * 349struct GNUNET_MQ_Handle *
351GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c); 350GNUNET_SERVICE_client_get_mq(struct GNUNET_SERVICE_Client *c);
352 351
353 352
354/** 353/**
@@ -360,7 +359,7 @@ GNUNET_SERVICE_client_get_mq (struct GNUNET_SERVICE_Client *c);
360 * @param c client for which to disable the warning 359 * @param c client for which to disable the warning
361 */ 360 */
362void 361void
363GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client *c); 362GNUNET_SERVICE_client_disable_continue_warning(struct GNUNET_SERVICE_Client *c);
364 363
365 364
366/** 365/**
@@ -379,7 +378,7 @@ GNUNET_SERVICE_client_disable_continue_warning (struct GNUNET_SERVICE_Client *c)
379 * @param c client to disconnect now 378 * @param c client to disconnect now
380 */ 379 */
381void 380void
382GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c); 381GNUNET_SERVICE_client_drop(struct GNUNET_SERVICE_Client *c);
383 382
384 383
385/** 384/**
@@ -388,7 +387,7 @@ GNUNET_SERVICE_client_drop (struct GNUNET_SERVICE_Client *c);
388 * @param sh server to shutdown 387 * @param sh server to shutdown
389 */ 388 */
390void 389void
391GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh); 390GNUNET_SERVICE_shutdown(struct GNUNET_SERVICE_Handle *sh);
392 391
393 392
394/** 393/**
@@ -404,7 +403,7 @@ GNUNET_SERVICE_shutdown (struct GNUNET_SERVICE_Handle *sh);
404 * @param c client to mark as a monitor 403 * @param c client to mark as a monitor
405 */ 404 */
406void 405void
407GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c); 406GNUNET_SERVICE_client_mark_monitor(struct GNUNET_SERVICE_Client *c);
408 407
409 408
410/** 409/**
@@ -415,7 +414,7 @@ GNUNET_SERVICE_client_mark_monitor (struct GNUNET_SERVICE_Client *c);
415 * @param c client to persist the socket (never to be closed) 414 * @param c client to persist the socket (never to be closed)
416 */ 415 */
417void 416void
418GNUNET_SERVICE_client_persist (struct GNUNET_SERVICE_Client *c); 417GNUNET_SERVICE_client_persist(struct GNUNET_SERVICE_Client *c);
419 418
420 419
421#if 0 /* keep Emacsens' auto-indent happy */ 420#if 0 /* keep Emacsens' auto-indent happy */