aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_nat_lib.h
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2009-11-13 15:01:03 +0000
committerChristian Grothoff <christian@grothoff.org>2009-11-13 15:01:03 +0000
commite8520aa3dad18bc174ea37256c66932062838253 (patch)
tree559750351b39e14b1fa263a25a5ff233ee6f95ab /src/include/gnunet_nat_lib.h
parent10ee738c0a3b74b72ef55cdae37b4d622aff3146 (diff)
downloadgnunet-e8520aa3dad18bc174ea37256c66932062838253.tar.gz
gnunet-e8520aa3dad18bc174ea37256c66932062838253.zip
fixing doxygen and style issues in NAT code
Diffstat (limited to 'src/include/gnunet_nat_lib.h')
-rw-r--r--src/include/gnunet_nat_lib.h66
1 files changed, 40 insertions, 26 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h
index f637bbd48..f03dc3dda 100644
--- a/src/include/gnunet_nat_lib.h
+++ b/src/include/gnunet_nat_lib.h
@@ -36,31 +36,37 @@
36 36
37#include <inttypes.h> 37#include <inttypes.h>
38 38
39/* Used to communicate with the UPnP and NAT-PMP plugins */ 39/**
40typedef enum 40 * Used to communicate with the UPnP and NAT-PMP plugins
41{ 41 * FIXME: move to src/nat/common.h
42 GNUNET_NAT_PORT_ERROR, 42 */
43 GNUNET_NAT_PORT_UNMAPPED, 43enum GNUNET_NAT_port_forwarding
44 GNUNET_NAT_PORT_UNMAPPING, 44 {
45 GNUNET_NAT_PORT_MAPPING, 45 GNUNET_NAT_PORT_ERROR,
46 GNUNET_NAT_PORT_MAPPED 46 GNUNET_NAT_PORT_UNMAPPED,
47} 47 GNUNET_NAT_PORT_UNMAPPING,
48GNUNET_NAT_port_forwarding; 48 GNUNET_NAT_PORT_MAPPING,
49 GNUNET_NAT_PORT_MAPPED
50 };
51
49 52
50/** 53/**
51 * Signature of the callback passed to GNUNET_NAT_register. 54 * Signature of the callback passed to GNUNET_NAT_register.
52 * 55 *
53 * @cls closure 56 * @param cls closure
54 * @add_remove GNUNET_YES to mean the new public IP address, GNUNET_NO to mean 57 * @param add_remove GNUNET_YES to mean the new public IP address, GNUNET_NO to mean
55 * the previous (now invalid) one 58 * the previous (now invalid) one
56 * @addr either the previous or the new public IP address 59 * @param addr either the previous or the new public IP address
57 * @addrlen actual lenght of the address 60 * @param addrlen actual lenght of the address
58 */ 61 */
59typedef void (*GNUNET_NAT_AddressCallback) (void *cls, int add_remove, 62typedef void (*GNUNET_NAT_AddressCallback) (void *cls, int add_remove,
60 const struct sockaddr * addr, 63 const struct sockaddr * addr,
61 socklen_t addrlen); 64 socklen_t addrlen);
62 65
63typedef struct GNUNET_NAT_Handle GNUNET_NAT_Handle; 66/**
67 * Handle for active NAT registrations.
68 */
69struct GNUNET_NAT_Handle;
64 70
65/** 71/**
66 * Attempt to enable port redirection and detect public IP address contacting 72 * Attempt to enable port redirection and detect public IP address contacting
@@ -68,11 +74,12 @@ typedef struct GNUNET_NAT_Handle GNUNET_NAT_Handle;
68 * of the local host's addresses should the external port be mapped. The port 74 * of the local host's addresses should the external port be mapped. The port
69 * is taken from the corresponding sockaddr_in[6] field. 75 * is taken from the corresponding sockaddr_in[6] field.
70 * 76 *
71 * @sched the sheduler used in the program 77 * @param sched the sheduler used in the program
72 * @addr the local address packets should be redirected to 78 * @param addr the local address packets should be redirected to
73 * @addrlen actual lenght of the address 79 * @param addrlen actual lenght of the address
74 * @callback function to call everytime the public IP address changes 80 * @param callback function to call everytime the public IP address changes
75 * @callback_cls closure for @callback 81 * @param callback_cls closure for callback
82 * @return NULL on error, otherwise handle that can be used to unregister
76 */ 83 */
77struct GNUNET_NAT_Handle *GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle 84struct GNUNET_NAT_Handle *GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle
78 *sched, 85 *sched,
@@ -85,15 +92,22 @@ struct GNUNET_NAT_Handle *GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle
85 * Stop port redirection and public IP address detection for the given handle. 92 * Stop port redirection and public IP address detection for the given handle.
86 * This frees the handle, after having sent the needed commands to close open ports. 93 * This frees the handle, after having sent the needed commands to close open ports.
87 * 94 *
88 * @h the handle to stop 95 * @param h the handle to stop
89 */ 96 */
90void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); 97void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h);
91 98
92/** 99/**
93 * Compare the sin(6)_addr fields of AF_INET or AF_INET(6) sockaddr. 100 * Compare the sin(6)_addr fields of AF_INET or AF_INET(6) sockaddr.
94 * @param a first sockaddr 101 * FIXME: move to src/nat/common.h or so.
95 * @param second sockaddr 102 *
96 * @returns 0 if addresses are equal, non-null value otherwise */ 103 * @param param a first sockaddr
97int GNUNET_NAT_cmp_addr (const struct sockaddr *a, const struct sockaddr *b); 104 * @param param b second sockaddr
105 * @return 0 if addresses are equal, non-null value otherwise
106 */
107int GNUNET_NAT_cmp_addr (const struct sockaddr *a,
108 const struct sockaddr *b);
109
110
111#endif
98 112
99#endif /* GNUNET_NAT_LIB_H */ 113/* end of gnunet_nat_lib.h */