1 /* $Id: upnppinhole.h,v 1.6 2016/01/19 10:03:30 nanard Exp $ */
2 /* vim: tabstop=4 shiftwidth=4 noexpandtab
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 */
9 #ifndef UPNPPINHOLE_H_INCLUDED
10 #define UPNPPINHOLE_H_INCLUDED
14 #ifdef ENABLE_UPNPPINHOLE
16 /* functions to be used by WANIPv6_FirewallControl implementation
20 /* retrieve outbound pinhole timeout */
22 upnp_check_outbound_pinhole(int proto
, int * timeout
);
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 */
28 upnp_find_inboundpinhole(const char * raddr
, unsigned short rport
,
29 const char * iaddr
, unsigned short iport
,
31 char * desc
, int desc_len
, unsigned int * leasetime
);
34 /* add an inbound pinehole
37 * -1 = Pinhole space exhausted
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
);
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
);
62 * 0 .. 65535 = uid of the rule for the index
65 upnp_get_pinhole_uid_by_index(int index
);
67 /* update the lease time */
69 upnp_update_inboundpinhole(unsigned short uid
, unsigned int leasetime
);
71 /* remove the inbound pinhole */
73 upnp_delete_inboundpinhole(unsigned short uid
);
78 upnp_check_pinhole_working(const char * uid
, char * eaddr
, char * iaddr
, unsigned short * eport
, unsigned short * iport
, char * protocol
, int * rulenum_used
);
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 */
85 upnp_clean_expired_pinholes(unsigned int * next_timestamp
);
87 #endif /* ENABLE_UPNPPINHOLE */
89 #endif /* !UPNPPINHOLE_H_INCLUDED */