aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2016-10-07 14:06:00 +0000
committerChristian Grothoff <christian@grothoff.org>2016-10-07 14:06:00 +0000
commitcb0b94bf09c45e690591140d4422b69e1db412cb (patch)
tree250b1d0fee40ee3400ba28c8f3c44901da89bb0a /src/util
parent551918714f3b0de77ef729e23bf80e1313d3c99d (diff)
downloadgnunet-cb0b94bf09c45e690591140d4422b69e1db412cb.tar.gz
gnunet-cb0b94bf09c45e690591140d4422b69e1db412cb.zip
sketch new service start/stop API as needed for testbed
Diffstat (limited to 'src/util')
-rw-r--r--src/util/service_new.c61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/util/service_new.c b/src/util/service_new.c
index 9981ae4c6..cf871eb89 100644
--- a/src/util/service_new.c
+++ b/src/util/service_new.c
@@ -1536,6 +1536,67 @@ detach_terminal (struct GNUNET_SERVICE_Handle *sh)
1536 1536
1537 1537
1538/** 1538/**
1539 * Low-level function to start a service if the scheduler
1540 * is already running. Should only be used directly in
1541 * special cases.
1542 *
1543 * The function will launch the service with the name @a service_name
1544 * using the @a service_options to configure its shutdown
1545 * behavior. When clients connect or disconnect, the respective
1546 * @a connect_cb or @a disconnect_cb functions will be called. For
1547 * messages received from the clients, the respective @a handlers will
1548 * be invoked; for the closure of the handlers we use the return value
1549 * from the @a connect_cb invocation of the respective client.
1550 *
1551 * Each handler MUST call #GNUNET_SERVICE_client_continue() after each
1552 * message to receive further messages from this client. If
1553 * #GNUNET_SERVICE_client_continue() is not called within a short
1554 * time, a warning will be logged. If delays are expected, services
1555 * should call #GNUNET_SERVICE_client_disable_continue_warning() to
1556 * disable the warning.
1557 *
1558 * Clients sending invalid messages (based on @a handlers) will be
1559 * dropped. Additionally, clients can be dropped at any time using
1560 * #GNUNET_SERVICE_client_drop().
1561 *
1562 * The service must be stopped using #GNUNET_SERVICE_stoP().
1563 *
1564 * @param service_name name of the service to run
1565 * @param cfg configuration to use
1566 * @param connect_cb function to call whenever a client connects
1567 * @param disconnect_cb function to call whenever a client disconnects
1568 * @param cls closure argument for @a connect_cb and @a disconnect_cb
1569 * @param handlers NULL-terminated array of message handlers for the service,
1570 * the closure will be set to the value returned by
1571 * the @a connect_cb for the respective connection
1572 * @return NULL on error
1573 */
1574struct GNUNET_SERVICE_Handle *
1575GNUNET_SERVICE_starT (const char *service_name,
1576 const struct GNUNET_CONFIGURATION_Handle *cfg,
1577 GNUNET_SERVICE_ConnectHandler connect_cb,
1578 GNUNET_SERVICE_DisconnectHandler disconnect_cb,
1579 void *cls,
1580 const struct GNUNET_MQ_MessageHandler *handlers)
1581{
1582 GNUNET_break (0); // FIXME: not implemented
1583 return NULL;
1584}
1585
1586
1587/**
1588 * Stops a service that was started with #GNUNET_SERVICE_starT().
1589 *
1590 * @param srv service to stop
1591 */
1592void
1593GNUNET_SERVICE_stoP (struct GNUNET_SERVICE_Handle *srv)
1594{
1595 GNUNET_assert (0); // FIXME: not implemented
1596}
1597
1598
1599/**
1539 * Creates the "main" function for a GNUnet service. You 1600 * Creates the "main" function for a GNUnet service. You
1540 * should almost always use the #GNUNET_SERVICE_MAIN macro 1601 * should almost always use the #GNUNET_SERVICE_MAIN macro
1541 * instead of calling this function directly (except 1602 * instead of calling this function directly (except