aboutsummaryrefslogtreecommitdiff
path: root/src/include/gnunet_nat_lib.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/include/gnunet_nat_lib.h')
-rw-r--r--src/include/gnunet_nat_lib.h52
1 files changed, 12 insertions, 40 deletions
diff --git a/src/include/gnunet_nat_lib.h b/src/include/gnunet_nat_lib.h
index 868edbee1..9c6e171b6 100644
--- a/src/include/gnunet_nat_lib.h
+++ b/src/include/gnunet_nat_lib.h
@@ -1,6 +1,6 @@
1/* 1/*
2 This file is part of GNUnet. 2 This file is part of GNUnet.
3 (C) 2007, 2008, 2009 Christian Grothoff (and other contributing authors) 3 (C) 2007, 2008, 2009, 2010 Christian Grothoff (and other contributing authors)
4 4
5 GNUnet is free software; you can redistribute it and/or modify 5 GNUnet is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published 6 it under the terms of the GNU General Public License as published
@@ -27,28 +27,9 @@
27 */ 27 */
28 28
29#ifndef GNUNET_NAT_LIB_H 29#ifndef GNUNET_NAT_LIB_H
30#define GNUNET_NAT_LIB_H 1 30#define GNUNET_NAT_LIB_H
31 31
32#include "platform.h"
33#include "gnunet_util_lib.h" 32#include "gnunet_util_lib.h"
34#include "upnp.h"
35#include "natpmp.h"
36
37#include <inttypes.h>
38
39/**
40 * Used to communicate with the UPnP and NAT-PMP plugins
41 * FIXME: move to src/nat/common.h
42 */
43enum GNUNET_NAT_port_forwarding
44 {
45 GNUNET_NAT_PORT_ERROR,
46 GNUNET_NAT_PORT_UNMAPPED,
47 GNUNET_NAT_PORT_UNMAPPING,
48 GNUNET_NAT_PORT_MAPPING,
49 GNUNET_NAT_PORT_MAPPED
50 };
51
52 33
53/** 34/**
54 * Signature of the callback passed to GNUNET_NAT_register. 35 * Signature of the callback passed to GNUNET_NAT_register.
@@ -59,10 +40,12 @@ enum GNUNET_NAT_port_forwarding
59 * @param addr either the previous or the new public IP address 40 * @param addr either the previous or the new public IP address
60 * @param addrlen actual lenght of the address 41 * @param addrlen actual lenght of the address
61 */ 42 */
62typedef void (*GNUNET_NAT_AddressCallback) (void *cls, int add_remove, 43typedef void (*GNUNET_NAT_AddressCallback) (void *cls,
44 int add_remove,
63 const struct sockaddr * addr, 45 const struct sockaddr * addr,
64 socklen_t addrlen); 46 socklen_t addrlen);
65 47
48
66/** 49/**
67 * Handle for active NAT registrations. 50 * Handle for active NAT registrations.
68 */ 51 */
@@ -81,12 +64,13 @@ struct GNUNET_NAT_Handle;
81 * @param callback_cls closure for callback 64 * @param callback_cls closure for callback
82 * @return NULL on error, otherwise handle that can be used to unregister 65 * @return NULL on error, otherwise handle that can be used to unregister
83 */ 66 */
84struct GNUNET_NAT_Handle *GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle 67struct GNUNET_NAT_Handle *
85 *sched, 68GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle *sched,
86 const struct sockaddr *addr, 69 const struct sockaddr *addr,
87 socklen_t addrlen, 70 socklen_t addrlen,
88 GNUNET_NAT_AddressCallback 71 GNUNET_NAT_AddressCallback callback,
89 callback, void *callback_cls); 72 void *callback_cls);
73
90 74
91/** 75/**
92 * Stop port redirection and public IP address detection for the given handle. 76 * Stop port redirection and public IP address detection for the given handle.
@@ -96,18 +80,6 @@ struct GNUNET_NAT_Handle *GNUNET_NAT_register (struct GNUNET_SCHEDULER_Handle
96 */ 80 */
97void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h); 81void GNUNET_NAT_unregister (struct GNUNET_NAT_Handle *h);
98 82
99/**
100 * Compare the sin(6)_addr fields of AF_INET or AF_INET(6) sockaddr.
101 * FIXME: move to src/nat/common.h or so.
102 *
103 * @param a first sockaddr
104 * @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 83#endif
112 84
113/* end of gnunet_nat_lib.h */ 85/* end of gnunet_nat_lib.h */