aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-12-13 19:51:37 +0000
committerChristian Grothoff <christian@grothoff.org>2013-12-13 19:51:37 +0000
commit98b6e10103105f2c9e28cbf61d343fbfd7b1eae3 (patch)
tree4f70c15393b7bb23ff9544a7692ef4dff7f81162 /src/transport/plugin_transport_udp.c
parent11db9d8466a4581b231cac6a4bebb01719db5f28 (diff)
downloadgnunet-98b6e10103105f2c9e28cbf61d343fbfd7b1eae3.tar.gz
gnunet-98b6e10103105f2c9e28cbf61d343fbfd7b1eae3.zip
-doxygen, indentation
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c43
1 files changed, 26 insertions, 17 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index cc02b1671..904473ace 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -213,6 +213,9 @@ struct Session
213}; 213};
214 214
215 215
216/**
217 * Closure for #session_cmp_it().
218 */
216struct SessionCompareContext 219struct SessionCompareContext
217{ 220{
218 struct Session *res; 221 struct Session *res;
@@ -222,7 +225,7 @@ struct SessionCompareContext
222 225
223 226
224/** 227/**
225 * Closure for 'process_inbound_tokenized_messages' 228 * Closure for #process_inbound_tokenized_messages().
226 */ 229 */
227struct SourceInformation 230struct SourceInformation
228{ 231{
@@ -236,6 +239,9 @@ struct SourceInformation
236 */ 239 */
237 const void *arg; 240 const void *arg;
238 241
242 /**
243 * Associated session.
244 */
239 struct Session *session; 245 struct Session *session;
240 246
241 /** 247 /**
@@ -247,7 +253,7 @@ struct SourceInformation
247 253
248 254
249/** 255/**
250 * Closure for 'find_receive_context'. 256 * Closure for #find_receive_context().
251 */ 257 */
252struct FindReceiveContext 258struct FindReceiveContext
253{ 259{
@@ -788,7 +794,7 @@ append_port (void *cls, const char *hostname)
788 * @param numeric should (IP) addresses be displayed in numeric form? 794 * @param numeric should (IP) addresses be displayed in numeric form?
789 * @param timeout after how long should we give up? 795 * @param timeout after how long should we give up?
790 * @param asc function to call on each string 796 * @param asc function to call on each string
791 * @param asc_cls closure for asc 797 * @param asc_cls closure for @a asc
792 */ 798 */
793static void 799static void
794udp_plugin_address_pretty_printer (void *cls, const char *type, 800udp_plugin_address_pretty_printer (void *cls, const char *type,
@@ -1036,11 +1042,11 @@ call_continuation (struct UDP_MessageWrapper *udpw, int result)
1036/** 1042/**
1037 * Check if the given port is plausible (must be either our listen 1043 * Check if the given port is plausible (must be either our listen
1038 * port or our advertised port). If it is neither, we return 1044 * port or our advertised port). If it is neither, we return
1039 * GNUNET_SYSERR. 1045 * #GNUNET_SYSERR.
1040 * 1046 *
1041 * @param plugin global variables 1047 * @param plugin global variables
1042 * @param in_port port number to check 1048 * @param in_port port number to check
1043 * @return GNUNET_OK if port is either open_port or adv_port 1049 * @return #GNUNET_OK if port is either open_port or adv_port
1044 */ 1050 */
1045static int 1051static int
1046check_port (struct Plugin *plugin, uint16_t in_port) 1052check_port (struct Plugin *plugin, uint16_t in_port)
@@ -1062,13 +1068,15 @@ check_port (struct Plugin *plugin, uint16_t in_port)
1062 * 1068 *
1063 * @param cls closure, should be our handle to the Plugin 1069 * @param cls closure, should be our handle to the Plugin
1064 * @param addr pointer to the address 1070 * @param addr pointer to the address
1065 * @param addrlen length of addr 1071 * @param addrlen length of @a addr
1066 * @return GNUNET_OK if this is a plausible address for this peer 1072 * @return #GNUNET_OK if this is a plausible address for this peer
1067 * and transport, GNUNET_SYSERR if not 1073 * and transport, #GNUNET_SYSERR if not
1068 * 1074 *
1069 */ 1075 */
1070static int 1076static int
1071udp_plugin_check_address (void *cls, const void *addr, size_t addrlen) 1077udp_plugin_check_address (void *cls,
1078 const void *addr,
1079 size_t addrlen)
1072{ 1080{
1073 struct Plugin *plugin = cls; 1081 struct Plugin *plugin = cls;
1074 struct IPv4UdpAddress *v4; 1082 struct IPv4UdpAddress *v4;
@@ -1077,6 +1085,7 @@ udp_plugin_check_address (void *cls, const void *addr, size_t addrlen)
1077 if ((addrlen != sizeof (struct IPv4UdpAddress)) && 1085 if ((addrlen != sizeof (struct IPv4UdpAddress)) &&
1078 (addrlen != sizeof (struct IPv6UdpAddress))) 1086 (addrlen != sizeof (struct IPv6UdpAddress)))
1079 { 1087 {
1088 GNUNET_break_op (0);
1080 return GNUNET_SYSERR; 1089 return GNUNET_SYSERR;
1081 } 1090 }
1082 if (addrlen == sizeof (struct IPv4UdpAddress)) 1091 if (addrlen == sizeof (struct IPv4UdpAddress))
@@ -1488,7 +1497,6 @@ session_cmp_it (void *cls,
1488 struct SessionCompareContext * cctx = cls; 1497 struct SessionCompareContext * cctx = cls;
1489 const struct GNUNET_HELLO_Address *address = cctx->addr; 1498 const struct GNUNET_HELLO_Address *address = cctx->addr;
1490 struct Session *s = value; 1499 struct Session *s = value;
1491
1492 socklen_t s_addrlen = s->addrlen; 1500 socklen_t s_addrlen = s->addrlen;
1493 1501
1494 LOG (GNUNET_ERROR_TYPE_DEBUG, 1502 LOG (GNUNET_ERROR_TYPE_DEBUG,
@@ -1536,7 +1544,7 @@ session_cmp_it (void *cls,
1536 * 1544 *
1537 * @param cls closure ('struct Plugin*') 1545 * @param cls closure ('struct Plugin*')
1538 * @param session the session 1546 * @param session the session
1539 * @return the network type in HBO or #GNUNET_SYSERR 1547 * @return the network type
1540 */ 1548 */
1541static enum GNUNET_ATS_Network_Type 1549static enum GNUNET_ATS_Network_Type
1542udp_get_network (void *cls, 1550udp_get_network (void *cls,
@@ -1547,8 +1555,8 @@ udp_get_network (void *cls,
1547 1555
1548 1556
1549/** 1557/**
1550 * Creates a new outbound session the transport service will use to send data to the 1558 * Creates a new outbound session the transport service will use to
1551 * peer 1559 * send data to the peer
1552 * 1560 *
1553 * @param cls the plugin 1561 * @param cls the plugin
1554 * @param address the address 1562 * @param address the address
@@ -1963,8 +1971,9 @@ udp_nat_port_map_callback (void *cls, int add_remove,
1963 * to the service. 1971 * to the service.
1964 * 1972 *
1965 * @param cls the 'struct Plugin' 1973 * @param cls the 'struct Plugin'
1966 * @param client the 'struct SourceInformation' 1974 * @param client the `struct SourceInformation`
1967 * @param hdr the actual message 1975 * @param hdr the actual message
1976 * @return #GNUNET_OK (always)
1968 */ 1977 */
1969static int 1978static int
1970process_inbound_tokenized_messages (void *cls, void *client, 1979process_inbound_tokenized_messages (void *cls, void *client,
@@ -2091,12 +2100,12 @@ process_udp_message (struct Plugin *plugin, const struct UDPMessage *msg,
2091/** 2100/**
2092 * Scan the heap for a receive context with the given address. 2101 * Scan the heap for a receive context with the given address.
2093 * 2102 *
2094 * @param cls the 'struct FindReceiveContext' 2103 * @param cls the `struct FindReceiveContext`
2095 * @param node internal node of the heap 2104 * @param node internal node of the heap
2096 * @param element value stored at the node (a 'struct ReceiveContext') 2105 * @param element value stored at the node (a 'struct ReceiveContext')
2097 * @param cost cost associated with the node 2106 * @param cost cost associated with the node
2098 * @return GNUNET_YES if we should continue to iterate, 2107 * @return #GNUNET_YES if we should continue to iterate,
2099 * GNUNET_NO if not. 2108 * #GNUNET_NO if not.
2100 */ 2109 */
2101static int 2110static int
2102find_receive_context (void *cls, struct GNUNET_CONTAINER_HeapNode *node, 2111find_receive_context (void *cls, struct GNUNET_CONTAINER_HeapNode *node,