From: Christian Grothoff Date: Mon, 21 Jun 2010 21:06:48 +0000 (+0000) Subject: nate on code sonar crack X-Git-Tag: initial-import-from-subversion-38251~21301 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=46cfd0e998c3946f75b7dd7376fc7587a6f4b562;p=oweals%2Fgnunet.git nate on code sonar crack --- diff --git a/src/include/gnunet_server_lib.h b/src/include/gnunet_server_lib.h index a24e709dc..ababbeea9 100644 --- a/src/include/gnunet_server_lib.h +++ b/src/include/gnunet_server_lib.h @@ -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 diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c index a8be80dee..434fd9ba1 100644 --- a/src/transport/plugin_transport_udp.c +++ b/src/transport/plugin_transport_udp.c @@ -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 */ {