extend API to enalbe exclusive port ranges to be specified for testing-system objects
[oweals/gnunet.git] / src / include / gnunet_server_lib.h
index 2f939f18c884f4c2d0f9be6c83b9a3d1ec2f15be..73fe8000e6f20e1eff6042e11c496dc2969e199d 100644 (file)
@@ -154,13 +154,23 @@ GNUNET_SERVER_create (GNUNET_CONNECTION_AccessCheck access, void *access_cls,
                       int require_found);
 
 
+/**
+ * Stop the listen socket and get ready to shutdown the server
+ * once only 'monitor' clients are left.
+ *
+ * @param server server to stop listening on
+ */
+void
+GNUNET_SERVER_stop_listening (struct GNUNET_SERVER_Handle *server);
+
+
 /**
  * Free resources held by this server.
  *
- * @param s server to destroy
+ * @param server server to destroy
  */
 void
-GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *s);
+GNUNET_SERVER_destroy (struct GNUNET_SERVER_Handle *server);
 
 
 /**
@@ -214,6 +224,22 @@ void
 GNUNET_SERVER_notify_transmit_ready_cancel (struct GNUNET_SERVER_TransmitHandle *th);
 
 
+/**
+ * Set the 'monitor' flag on this client.  Clients which have been
+ * marked as 'monitors' won't prevent the server from shutting down
+ * once 'GNUNET_SERVER_stop_listening' has been invoked.  The idea is
+ * that for "normal" clients we likely want to allow them to process
+ * their requests; however, monitor-clients are likely to 'never'
+ * disconnect during shutdown and thus will not be considered when
+ * determining if the server should continue to exist after
+ * 'GNUNET_SERVER_destroy' has been called.
+ *
+ * @param client the client to set the 'monitor' flag on
+ */
+void
+GNUNET_SERVER_client_mark_monitor (struct GNUNET_SERVER_Client *client);
+
+
 /**
  * Set the persistent flag on this client, used to setup client connection
  * to only be killed when the service it's connected to is actually dead.
@@ -223,6 +249,7 @@ GNUNET_SERVER_notify_transmit_ready_cancel (struct GNUNET_SERVER_TransmitHandle
 void
 GNUNET_SERVER_client_persist_ (struct GNUNET_SERVER_Client *client);
 
+
 /**
  * Resume receiving from this client, we are done processing the
  * current request.  This function must be called from within each
@@ -396,22 +423,6 @@ void
 GNUNET_SERVER_client_disconnect (struct GNUNET_SERVER_Client *client);
 
 
-/**
- * Configure this server's connections to continue handling client
- * requests as usual even after we get a shutdown signal.  The change
- * only applies to clients that connect to the server from the outside
- * using TCP after this call.  Clients managed previously or those
- * added using GNUNET_SERVER_connect_socket and
- * GNUNET_SERVER_connect_callback are not affected by this option.
- *
- * @param h server handle
- * @param do_ignore GNUNET_YES to ignore, GNUNET_NO to restore default
- */
-void
-GNUNET_SERVER_ignore_shutdown (struct GNUNET_SERVER_Handle *h, int do_ignore);
-
-
-
 /**
  * Disable the "CORK" feature for communication with the given client,
  * forcing the OS to immediately flush the buffer on transmission
@@ -596,11 +607,15 @@ struct GNUNET_SERVER_MessageStreamTokenizer;
  * Functions with this signature are called whenever a
  * complete message is received by the tokenizer.
  *
+ * Do not call GNUNET_SERVER_mst_destroy in callback
+ *
  * @param cls closure
  * @param client identification of the client
  * @param message the actual message
+ *
+ * @return GNUNET_OK on success, GNUNET_SYSERR to stop further processing
  */
-typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, void *client,
+typedef int (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls, void *client,
                                                         const struct
                                                         GNUNET_MessageHeader *
                                                         message);