Fix: Cast closure to proper type
[oweals/gnunet.git] / src / nat / gnunet-service-nat_helper.h
1 /*
2      This file is part of GNUnet.
3      Copyright (C) 2009, 2010, 2011, 2016 GNUnet e.V.
4
5      GNUnet is free software: you can redistribute it and/or modify it
6      under the terms of the GNU Affero General Public License as published
7      by the Free Software Foundation, either version 3 of the License,
8      or (at your option) any later version.
9
10      GNUnet is distributed in the hope that it will be useful, but
11      WITHOUT ANY WARRANTY; without even the implied warranty of
12      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13      Affero General Public License for more details.
14     
15      You should have received a copy of the GNU Affero General Public License
16      along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 */
18
19 /**
20  * @file nat/gnunet-service-nat_helper.h
21  * @brief runs the gnunet-helper-nat-server
22  * @author Milan Bouchet-Valat
23  * @author Christian Grothoff
24  */
25 #include "platform.h"
26 #include "gnunet_util_lib.h"
27
28
29 /**
30  * Information we keep per NAT helper process.
31  */
32 struct HelperContext;
33
34
35 /**
36  * Function called whenever we get a connection reversal
37  * request from another peer.
38  *
39  * @param cls closure
40  * @param ra IP address of the peer who wants us to connect to it 
41  */
42 typedef void
43 (*GN_ReversalCallback) (void *cls,
44                         const struct sockaddr_in *ra);
45
46
47 /**
48  * Start the gnunet-helper-nat-server and process incoming
49  * requests.
50  *
51  * @param internal_address
52  * @param cb function to call if we receive a request
53  * @param cb_cls closure for @a cb
54  * @return NULL on error
55  */
56 struct HelperContext *
57 GN_start_gnunet_nat_server_ (const struct in_addr *internal_address,
58                              GN_ReversalCallback cb,
59                              void *cb_cls);
60
61                         
62 /**
63  * Start the gnunet-helper-nat-server and process incoming
64  * requests.
65  *
66  * @param h helper context to stop
67  */
68 void
69 GN_stop_gnunet_nat_server_ (struct HelperContext *h);
70
71
72 /**
73  * We want to connect to a peer that is behind NAT.  Run the
74  * gnunet-helper-nat-client to send dummy ICMP responses to cause
75  * that peer to connect to us (connection reversal).
76  *
77  * @param internal_address out internal address to use
78  * @param internal_port internal port to use
79  * @param remote_v4 the address of the peer (IPv4-only)
80  * @return #GNUNET_SYSERR on error,
81  *         #GNUNET_OK otherwise
82  */
83 int
84 GN_request_connection_reversal (const struct in_addr *internal_address,
85                                 uint16_t internal_port,
86                                 const struct in_addr *sa);
87
88
89 /* end of gnunet-service-nat_helper.h */