first batch of license fixes (boring)
[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 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
16 /**
17  * @file nat/gnunet-service-nat_helper.h
18  * @brief runs the gnunet-helper-nat-server
19  * @author Milan Bouchet-Valat
20  * @author Christian Grothoff
21  */
22 #include "platform.h"
23 #include "gnunet_util_lib.h"
24
25
26 /**
27  * Information we keep per NAT helper process.
28  */
29 struct HelperContext;
30
31
32 /**
33  * Function called whenever we get a connection reversal
34  * request from another peer.
35  *
36  * @param cls closure
37  * @param ra IP address of the peer who wants us to connect to it 
38  */
39 typedef void
40 (*GN_ReversalCallback) (void *cls,
41                         const struct sockaddr_in *ra);
42
43
44 /**
45  * Start the gnunet-helper-nat-server and process incoming
46  * requests.
47  *
48  * @param internal_address
49  * @param cb function to call if we receive a request
50  * @param cb_cls closure for @a cb
51  * @return NULL on error
52  */
53 struct HelperContext *
54 GN_start_gnunet_nat_server_ (const struct in_addr *internal_address,
55                              GN_ReversalCallback cb,
56                              void *cb_cls);
57
58                         
59 /**
60  * Start the gnunet-helper-nat-server and process incoming
61  * requests.
62  *
63  * @param h helper context to stop
64  */
65 void
66 GN_stop_gnunet_nat_server_ (struct HelperContext *h);
67
68
69 /**
70  * We want to connect to a peer that is behind NAT.  Run the
71  * gnunet-helper-nat-client to send dummy ICMP responses to cause
72  * that peer to connect to us (connection reversal).
73  *
74  * @param internal_address out internal address to use
75  * @param internal_port internal port to use
76  * @param remote_v4 the address of the peer (IPv4-only)
77  * @return #GNUNET_SYSERR on error,
78  *         #GNUNET_OK otherwise
79  */
80 int
81 GN_request_connection_reversal (const struct in_addr *internal_address,
82                                 uint16_t internal_port,
83                                 const struct in_addr *sa);
84
85
86 /* end of gnunet-service-nat_helper.h */