aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2010-06-21 21:06:48 +0000
committerChristian Grothoff <christian@grothoff.org>2010-06-21 21:06:48 +0000
commit46cfd0e998c3946f75b7dd7376fc7587a6f4b562 (patch)
treea45c98420c67e06a99dd83c22b62e2bc8a48f3c7 /src
parent79437ecb24ce042d8c7e92d80da2276536bb2b86 (diff)
downloadgnunet-46cfd0e998c3946f75b7dd7376fc7587a6f4b562.tar.gz
gnunet-46cfd0e998c3946f75b7dd7376fc7587a6f4b562.zip
nate on code sonar crack
Diffstat (limited to 'src')
-rw-r--r--src/include/gnunet_server_lib.h54
-rw-r--r--src/transport/plugin_transport_udp.c2
2 files changed, 55 insertions, 1 deletions
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
610 610
611 611
612 612
613/**
614 * Handle to a message stream tokenizer.
615 */
616struct GNUNET_SERVER_MessageStreamTokenizer;
617
618/**
619 * Functions with this signature are called whenever a
620 * complete message is received by the tokenizer.
621 *
622 * @param cls closure
623 * @param client identification of the client
624 * @param message the actual message
625 */
626typedef void (*GNUNET_SERVER_MessageTokenizerCallback) (void *cls,
627 void *client,
628 const struct
629 GNUNET_MessageHeader *
630 message);
631
632
633/**
634 * Create a message stream tokenizer.
635 *
636 * @param maxbuf maximum message size to support (typically
637 * GNUNET_SERVER_MAX_MESSAGE_SIZE)
638 * @param client_identity ID of client for which this is a buffer,
639 * can be NULL (will be passed back to 'cb')
640 * @return handle to tokenizer
641 */
642struct GNUNET_SERVER_MessageStreamTokenizer *
643GNUNET_SERVER_mst_create (size_t maxbuf,
644 void *client_identity,
645 GNUNET_SERVER_MessageTokenizerCallback cb,
646 void *cls);
647
648
649/**
650 *
651 */
652void
653GNUNET_SERVER_mst_receive (struct GNUNET_SERVER_MessageStreamTokenizer *mst,
654 const char *buf,
655 size_t size,
656 int purge);
657
658/**
659 * Destroys a tokenizer.
660 *
661 * @param mst tokenizer to destroy
662 */
663void
664GNUNET_SERVER_mst_destroy (struct GNUNET_SERVER_MessageStreamTokenizer *mst);
665
666
613#if 0 /* keep Emacsens' auto-indent happy */ 667#if 0 /* keep Emacsens' auto-indent happy */
614{ 668{
615#endif 669#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,
751 v4 = (struct sockaddr_in *) addr; 751 v4 = (struct sockaddr_in *) addr;
752 if ((plugin->behind_nat == GNUNET_YES) && (plugin->only_nat_addresses == GNUNET_YES)) 752 if ((plugin->behind_nat == GNUNET_YES) && (plugin->only_nat_addresses == GNUNET_YES))
753 { 753 {
754 v4->sin_port = htons (GNUNET_MESSAGE_TYPE_TRANSPORT_UDP_MESSAGE); /* Indicates to receiver we are behind NAT */ 754 v4->sin_port = htons (0); /* Indicates to receiver we are behind NAT */
755 } 755 }
756 else if (plugin->behind_nat == GNUNET_YES) /* We are behind NAT, but will advertise NAT and normal addresses */ 756 else if (plugin->behind_nat == GNUNET_YES) /* We are behind NAT, but will advertise NAT and normal addresses */
757 { 757 {