gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r16489 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r16489 - gnunet/src/transport
Date: Sat, 13 Aug 2011 23:59:41 +0200

Author: grothoff
Date: 2011-08-13 23:59:41 +0200 (Sat, 13 Aug 2011)
New Revision: 16489

Modified:
   gnunet/src/transport/gnunet-service-transport-new.c
   gnunet/src/transport/gnunet-service-transport_clients.c
   gnunet/src/transport/gnunet-service-transport_clients.h
Log:
setup handlers

Modified: gnunet/src/transport/gnunet-service-transport-new.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport-new.c 2011-08-13 21:19:05 UTC 
(rev 16488)
+++ gnunet/src/transport/gnunet-service-transport-new.c 2011-08-13 21:59:41 UTC 
(rev 16489)
@@ -354,11 +354,6 @@
      struct GNUNET_SERVER_Handle *server,
      const struct GNUNET_CONFIGURATION_Handle *c)
 {
-#if 0
-  static const struct GNUNET_SERVER_MessageHandler handlers[] = {
-    {NULL, NULL, 0, 0}
-  };
-#endif
   char *keyfile;
 
   /* setup globals */

Modified: gnunet/src/transport/gnunet-service-transport_clients.c
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.c     2011-08-13 
21:19:05 UTC (rev 16488)
+++ gnunet/src/transport/gnunet-service-transport_clients.c     2011-08-13 
21:59:41 UTC (rev 16489)
@@ -326,29 +326,6 @@
 
 
 /**
- * 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.
  *
@@ -391,10 +368,10 @@
  * @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;
@@ -434,10 +411,10 @@
  * @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);
@@ -493,10 +470,10 @@
  * @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;
@@ -563,10 +540,10 @@
  * @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;
 
@@ -622,10 +599,10 @@
  * @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;
@@ -734,10 +711,10 @@
  * @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;
@@ -791,10 +768,10 @@
  * @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;
 
@@ -809,6 +786,40 @@
 
 
 /**
+ * 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.
  *
  * @param msg message to broadcast

Modified: gnunet/src/transport/gnunet-service-transport_clients.h
===================================================================
--- gnunet/src/transport/gnunet-service-transport_clients.h     2011-08-13 
21:19:05 UTC (rev 16488)
+++ gnunet/src/transport/gnunet-service-transport_clients.h     2011-08-13 
21:59:41 UTC (rev 16489)
@@ -47,101 +47,6 @@
 
 
 /**
- * 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.
  *
  * @param msg message to broadcast




reply via email to

[Prev in Thread] Current Thread [Next in Thread]