}
-/**
- * Start handling requests from clients.
- *
- * @param server server used to accept clients from.
- */
-void
-GST_clients_start (struct GNUNET_SERVER_Handle *server)
-{
- GNUNET_SERVER_disconnect_notify (server,
- &client_disconnect_notification, NULL);
-}
-
-
-/**
- * Stop processing clients.
- */
-void
-GST_clients_stop ()
-{
- /* nothing to do */
-}
-
-
/**
* Function called for each of our connected neighbours. Notify the
* client about the existing neighbour.
* @param client the client
* @param message the start message that was sent
*/
-void
-GST_clients_handle_start (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_start (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct StartMessage *start;
struct TransportClient *tc;
* @param client the client
* @param message the HELLO message
*/
-void
-GST_clients_handle_hello (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_hello (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
GST_validation_handle_hello (message);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
* @param client the client
* @param message the send message that was sent
*/
-void
-GST_clients_handle_send (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_send (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct OutboundMessage *obm;
const struct GNUNET_MessageHeader *obmm;
* @param client the client
* @param message the quota changing message
*/
-void
-GST_clients_handle_set_quota (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_set_quota (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct QuotaSetMessage *qsm;
* @param client the client
* @param message the resolution request
*/
-void
-GST_clients_handle_address_lookup (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_address_lookup (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct AddressLookupMessage *alum;
struct GNUNET_TRANSPORT_PluginFunctions *papi;
* @param client the client
* @param message the peer address information request
*/
-void
-GST_clients_handle_peer_address_lookup (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_peer_address_lookup (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
const struct PeerAddressLookupMessage *peer_address_lookup;
struct GNUNET_SERVER_TransmitContext *tc;
* @param client the client
* @param message the peer address information request
*/
-void
-GST_clients_handle_address_iterate (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message)
+static void
+clients_handle_address_iterate (void *cls,
+ struct GNUNET_SERVER_Client *client,
+ const struct GNUNET_MessageHeader *message)
{
struct GNUNET_SERVER_TransmitContext *tc;
}
+/**
+ * Start handling requests from clients.
+ *
+ * @param server server used to accept clients from.
+ */
+void
+GST_clients_start (struct GNUNET_SERVER_Handle *server)
+{
+ static const struct GNUNET_SERVER_MessageHandler handlers[] = {
+ { &clients_handle_start, NULL, sizeof (struct StartMessage)},
+ { &clients_handle_hello, NULL, 0},
+ { &clients_handle_send, NULL, 0},
+ { &clients_handle_set_quota, NULL, sizeof (struct QuotaSetMessage)},
+ { &clients_handle_address_lookup, NULL, 0},
+ { &clients_handle_peer_address_lookup, NULL, sizeof (struct PeerAddressLookupMessage)},
+ { &clients_handle_address_iterate, NULL, sizeof (struct GNUNET_MessageHeader)},
+ {NULL, NULL, 0, 0}
+ };
+ GNUNET_SERVER_add_handlers (server, handlers);
+ GNUNET_SERVER_disconnect_notify (server,
+ &client_disconnect_notification, NULL);
+}
+
+
+/**
+ * Stop processing clients.
+ */
+void
+GST_clients_stop ()
+{
+ /* nothing to do */
+}
+
+
/**
* Broadcast the given message to all of our clients.
*
GST_clients_stop (void);
-/**
- * Initialize a normal client. We got a start message from this
- * client, add him to the list of clients for broadcasting of inbound
- * messages.
- *
- * @param cls unused
- * @param client the client
- * @param message the start message that was sent
- */
-void
-GST_clients_handle_start (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Client sent us a HELLO. Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the HELLO message
- */
-void
-GST_clients_handle_hello (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Client asked for transmission to a peer. Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the send message that was sent
- */
-void
-GST_clients_handle_send (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Client asked for a quota change for a particular peer. Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the quota changing message
- */
-void
-GST_clients_handle_set_quota (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Client asked to resolve an address. Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the resolution request
- */
-void
-GST_clients_handle_address_lookup (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Client asked to obtain information about a peer's addresses.
- * Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the peer address information request
- */
-void
-GST_clients_handle_peer_address_lookup (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
-/**
- * Client asked to obtain information about all addresses.
- * Process the request.
- *
- * @param cls unused
- * @param client the client
- * @param message the peer address information request
- */
-void
-GST_clients_handle_address_iterate (void *cls,
- struct GNUNET_SERVER_Client *client,
- const struct GNUNET_MessageHeader *message);
-
-
/**
* Broadcast the given message to all of our clients.
*