nate on code sonar crack
authorChristian Grothoff <christian@grothoff.org>
Mon, 21 Jun 2010 21:06:48 +0000 (21:06 +0000)
committerChristian Grothoff <christian@grothoff.org>
Mon, 21 Jun 2010 21:06:48 +0000 (21:06 +0000)
src/include/gnunet_server_lib.h
src/transport/plugin_transport_udp.c

index a24e709dcc76ed49e8d6ac1c42cd8be6aa79ebf9..ababbeea9aa094b6721446dbfba28d3adb833c5f 100644 (file)
@@ -610,6 +610,60 @@ GNUNET_SERVER_notification_context_broadcast (struct GNUNET_SERVER_NotificationC
 
 
 
+/**
+ * Handle to a message stream tokenizer.
+ */
+struct GNUNET_SERVER_MessageStreamTokenizer;
+
+/**
+ * Functions with this signature are called whenever a
+ * complete message is received by the tokenizer.
+ *
+ * @param cls closure
+ * @param client identification of the client
+ * @param message the actual message
+ */
+typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls,
+                                                       void *client,
+                                                       const struct
+                                                       GNUNET_MessageHeader *
+                                                       message);
+
+
+/**
+ * Create a message stream tokenizer.
+ *
+ * @param maxbuf maximum message size to support (typically
+ *    GNUNET_SERVER_MAX_MESSAGE_SIZE)
+ * @param client_identity ID of client for which this is a buffer,
+ *        can be NULL (will be passed back to 'cb')
+ * @return handle to tokenizer
+ */
+struct GNUNET_SERVER_MessageStreamTokenizer *
+GNUNET_SERVER_mst_create (size_t maxbuf,
+                         void *client_identity,
+                         GNUNET_SERVER_MessageTokenizerCallback cb,
+                         void *cls);
+
+
+/**
+ *
+ */
+void
+GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
+                          const char *buf,
+                          size_t size,
+                          int purge);
+
+/**
+ * Destroys a tokenizer.
+ *
+ * @param mst tokenizer to destroy
+ */
+void
+GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst);
+
+
 #if 0                           /* keep Emacsens' auto-indent happy */
 {
 #endif
index a8be80deedc6b945108eafe7858c4f5c5c11a4fc..434fd9ba19e412f27e97c6c81b97fc135bab24f3 100644 (file)
@@ -751,7 +751,7 @@ process_interfaces (void *cls,
       v4 = (struct sockaddr_in *) addr;
       if ((plugin->behind_nat == GNUNET_YES) && (plugin->only_nat_addresses == GNUNET_YES))
         {
-          v4->sin_port = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE); /* Indicates to receiver we are behind NAT */
+          v4->sin_port = htons (0); /* Indicates to receiver we are behind NAT */
         }
       else if (plugin->behind_nat == GNUNET_YES) /* We are behind NAT, but will advertise NAT and normal addresses */
         {