HKDF (does not work yet)
[oweals/gnunet.git] / src / include / gnunet_service_lib.h
index 82089954edb497c78a6055d0edfcc93f6d1dfeee..c17af065fe7c780ff9757ccf29064032b5ee0088 100644 (file)
@@ -38,6 +38,34 @@ extern "C"
 #include "gnunet_configuration_lib.h"
 #include "gnunet_server_lib.h"
 
+
+/**
+ * Get the list of addresses that a server for the given service
+ * should bind to.
+ *
+ * @param serviceName name of the service
+ * @param cfg configuration (which specifies the addresses)
+ * @param addrs set (call by reference) to an array of pointers to the
+ *              addresses the server should bind to and listen on; the
+ *              array will be NULL-terminated (on success)
+ * @param addr_lens set (call by reference) to an array of the lengths
+ *              of the respective 'struct sockaddr' struct in the 'addrs'
+ *              array (on success)
+ * @return number of addresses found on success,
+ *              GNUNET_SYSERR if the configuration
+ *              did not specify reasonable finding information or
+ *              if it specified a hostname that could not be resolved;
+ *              GNUNET_NO if the number of addresses configured is
+ *              zero (in this case, '*addrs' and '*addr_lens' will be
+ *              set to NULL).
+ */
+int
+GNUNET_SERVICE_get_server_addresses (const char *serviceName,
+                                    const struct GNUNET_CONFIGURATION_Handle *cfg,
+                                    struct sockaddr ***addrs,
+                                    socklen_t **addr_lens);
+
+
 /**
  * Function called by the service's run
  * method to run service-specific setup code.
@@ -54,6 +82,24 @@ typedef void (*GNUNET_SERVICE_Main) (void *cls,
                                      cfg);
 
 
+/**
+ * Options for the service (bitmask).
+ */
+enum GNUNET_SERVICE_Options
+  {
+    /**
+     * Use defaults.
+     */
+    GNUNET_SERVICE_OPTION_NONE = 0,
+
+    /**
+     * Do not trigger server shutdown on signals, allow for the user
+     * to terminate the server explicitly when needed.
+     */
+    GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN = 1
+  };
+
+
 /**
  * Run a standard GNUnet service startup sequence (initialize loggers
  * and configuration, parse options).
@@ -61,6 +107,7 @@ typedef void (*GNUNET_SERVICE_Main) (void *cls,
  * @param argc number of command line arguments
  * @param argv command line arguments
  * @param serviceName our service name
+ * @param opt service options
  * @param task main task of the service
  * @param task_cls closure for task
  * @return GNUNET_SYSERR on error, GNUNET_OK
@@ -69,6 +116,7 @@ typedef void (*GNUNET_SERVICE_Main) (void *cls,
 int GNUNET_SERVICE_run (int argc,
                         char *const *argv,
                         const char *serviceName,
+                       enum GNUNET_SERVICE_Options opt,
                         GNUNET_SERVICE_Main task,
                         void *task_cls);