Electroneum
upnppinhole.h
Go to the documentation of this file.
1 /* $Id: upnppinhole.h,v 1.2 2012/09/18 08:29:49 nanard Exp $ */
2 /* vim: tabstop=4 shiftwidth=4 noexpandtab
3  * MiniUPnP project
4  * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
5  * (c) 2006-2016 Thomas Bernard
6  * This software is subject to the conditions detailed
7  * in the LICENCE file provided within the distribution */
8 
9 #ifndef UPNPPINHOLE_H_INCLUDED
10 #define UPNPPINHOLE_H_INCLUDED
11 
12 #include "config.h"
13 
14 #ifdef ENABLE_UPNPPINHOLE
15 
16 /* functions to be used by WANIPv6_FirewallControl implementation
17  * and PCP (IPv6) */
18 
19 #if 0
20 /* retrieve outbound pinhole timeout */
21 int
22 upnp_check_outbound_pinhole(int proto, int * timeout);
23 #endif
24 
25 /* find an inbound pinhole base on remove host:port / local host:port
26  * return the (positive) uid or a negative value if not found */
27 int
28 upnp_find_inboundpinhole(const char * raddr, unsigned short rport,
29  const char * iaddr, unsigned short iport,
30  int proto,
31  char * desc, int desc_len, unsigned int * leasetime);
32 
33 
34 /* add an inbound pinehole
35  * return value :
36  * 1 = success
37  * -1 = Pinhole space exhausted
38  * .. = error */
39 int
40 upnp_add_inboundpinhole(const char * raddr, unsigned short rport,
41  const char * iaddr, unsigned short iport,
42  int proto, char * desc,
43  unsigned int leasetime, int * uid);
44 
45 /* get from uid
46  * return values :
47  * -1 not found
48  * */
49 int
50 upnp_get_pinhole_info(unsigned short uid,
51  char * raddr, int raddrlen,
52  unsigned short * rport,
53  char * iaddr, int iaddrlen,
54  unsigned short * iport,
55  int * proto, char * desc, int desclen,
56  unsigned int * leasetime,
57  unsigned int * packets);
58 
59 /*
60  * return values:
61  * -1 = not found
62  * 0 .. 65535 = uid of the rule for the index
63  */
64 int
65 upnp_get_pinhole_uid_by_index(int index);
66 
67 /* update the lease time */
68 int
69 upnp_update_inboundpinhole(unsigned short uid, unsigned int leasetime);
70 
71 /* remove the inbound pinhole */
72 int
73 upnp_delete_inboundpinhole(unsigned short uid);
74 
75 /* ... */
76 #if 0
77 int
78 upnp_check_pinhole_working(const char * uid, char * eaddr, char * iaddr, unsigned short * eport, unsigned short * iport, char * protocol, int * rulenum_used);
79 #endif
80 
81 /* return the number of expired pinhole removed
82  * write timestamp to next pinhole to exprire to next_timestamp
83  * next_timestamp is left untouched if there is no pinhole lest */
84 int
85 upnp_clean_expired_pinholes(unsigned int * next_timestamp);
86 
87 #endif /* ENABLE_UPNPPINHOLE */
88 
89 #endif /* !UPNPPINHOLE_H_INCLUDED */