aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Cabral <bcabral@uw.edu>2015-08-21 13:44:20 +0000
committerBruno Cabral <bcabral@uw.edu>2015-08-21 13:44:20 +0000
commitdd1927b960c7cea13733e061a11142274652ba27 (patch)
treec9c2423fd434befbbf434c6d9bcea41b5e6f6634
parentecc90530eb2b3f4d0d5037d8d8b69722dda2a2cb (diff)
downloadgnunet-dd1927b960c7cea13733e061a11142274652ba27.tar.gz
gnunet-dd1927b960c7cea13733e061a11142274652ba27.zip
Forget to commit some files
-rw-r--r--src/include/gnunet_nat_lib.h28
-rw-r--r--src/transport/plugin_transport_udp.c2
2 files changed, 16 insertions, 14 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h
index 5692dc294..3e9d8171c 100644
--- a/src/include/gnunet_nat_lib.h
+++ b/src/include/gnunet_nat_lib.h
@@ -489,9 +489,9 @@ typedef void
489 * @param server, the address of the stun server 489 * @param server, the address of the stun server
490 * @param port, port of the stun server 490 * @param port, port of the stun server
491 * @param sock the socket used to send the request 491 * @param sock the socket used to send the request
492 * @return GNUNET_NAT_STUN_Handle on success, NULL on error. 492 * @return #GNUNET_OK success, #GNUNET_NO on error.
493 */ 493 */
494struct GNUNET_NAT_STUN_Handle * 494int
495GNUNET_NAT_stun_make_request(char * server, 495GNUNET_NAT_stun_make_request(char * server,
496 int port, 496 int port,
497 struct GNUNET_NETWORK_Handle * sock, GNUNET_NAT_stun_RequestCallback cb, 497 struct GNUNET_NETWORK_Handle * sock, GNUNET_NAT_stun_RequestCallback cb,
@@ -499,17 +499,18 @@ GNUNET_NAT_stun_make_request(char * server,
499 499
500 500
501/** 501/**
502 *
502 * Handle an incoming STUN message, Do some basic sanity checks on packet size and content, 503 * Handle an incoming STUN message, Do some basic sanity checks on packet size and content,
503 * try to extract a bit of information, and possibly reply. 504 * try to extract a bit of information, and possibly reply.
504 * At the moment this only processes BIND requests, and returns 505 * At the moment this only processes BIND requests, and returns
505 * the externally visible address of the request. 506 * the externally visible address of the request.
506 * If a callback is specified, invoke it with the attribute. 507 * If a callback is specified, invoke it with the attribute.
507 * 508 *
508 * @param data, pointer where we will set the type 509 * @param data, the packet
509 * @param len, pointer where we will set the type 510 * @param len, the length of the packet
510 * @param st, pointer where we will set the type 511 * @param arg, sockaddr_in where we will set our discovered packet
511 * 512 *
512 * @return, 0 on IGNORE, -1 if the packet is invalid ( not a stun packet) 513 * @return, #GNUNET_OK on OK, #GNUNET_NO if the packet is invalid ( not a stun packet)
513 */ 514 */
514int 515int
515GNUNET_NAT_stun_handle_packet(const void *data, 516GNUNET_NAT_stun_handle_packet(const void *data,
@@ -517,17 +518,18 @@ GNUNET_NAT_stun_handle_packet(const void *data,
517 struct sockaddr_in *arg); 518 struct sockaddr_in *arg);
518 519
519/** 520/**
520 * CHECK if is a valid STUN packet sending to GNUNET_NAT_stun_handle_packet 521 * CHECK if is a valid STUN packet sending to GNUNET_NAT_stun_handle_packet.
522 * It also check if it can handle the packet based on the NAT handler.
523 * You don't need to call anything else to check if the packet is valid,
521 * 524 *
522 * @param cls, NAT callback 525 * @param cls the NAT handle
523 * @param data, pointer where we will set the type 526 * @param data, packet
524 * @param len, pointer where we will set the type 527 * @param len, packet length
525 * @param st, pointer where we will set the type
526 * 528 *
527 * @return, 0 on IGNORE, -1 if the packet is invalid ( not a stun packet) 529 * @return #GNUNET_NO if it can't decode,# GNUNET_YES if is a packet
528 */ 530 */
529int 531int
530GNUNET_NAT_try_decode_stun_packet(void *cls, 532GNUNET_NAT_is_valid_stun_packet(void *cls,
531 const void *data, 533 const void *data,
532 size_t len); 534 size_t len);
533 535
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index d031e6008..5836f28bc 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -2857,7 +2857,7 @@ udp_select_read (struct Plugin *plugin,
2857 2857
2858 2858
2859 /* PROCESS STUN PACKET */ 2859 /* PROCESS STUN PACKET */
2860 if(GNUNET_NAT_try_decode_stun_packet(plugin->nat,(uint8_t *)buf, size )) 2860 if(GNUNET_NAT_is_valid_stun_packet(plugin->nat,(uint8_t *)buf, size ))
2861 return; 2861 return;
2862 2862
2863 2863