1 /* $Id: commonrdr.h,v 1.9 2014/02/11 09:36:15 nanard Exp $ */
3 * (c) 2006-2014 Thomas Bernard
4 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
7 #ifndef COMMONRDR_H_INCLUDED
8 #define COMMONRDR_H_INCLUDED
12 /* init and shutdown functions */
13 /* init_redirect() return values :
20 shutdown_redirect(void);
22 /* get_redirect_rule() gets internal IP and port from
23 * interface, external port and protocol
25 * 0 success (rule found)
26 * -1 error or rule not found
29 get_redirect_rule(const char * ifname
, unsigned short eport
, int proto
,
30 char * iaddr
, int iaddrlen
, unsigned short * iport
,
31 char * desc
, int desclen
,
32 char * rhost
, int rhostlen
,
33 unsigned int * timestamp
,
34 u_int64_t
* packets
, u_int64_t
* bytes
);
36 /* get_redirect_rule_by_index()
38 * 0 success (rule found)
39 * -1 error or rule not found */
41 get_redirect_rule_by_index(int index
,
42 char * ifname
, unsigned short * eport
,
43 char * iaddr
, int iaddrlen
, unsigned short * iport
,
44 int * proto
, char * desc
, int desclen
,
45 char * rhost
, int rhostlen
,
46 unsigned int * timestamp
,
47 u_int64_t
* packets
, u_int64_t
* bytes
);
49 /* return an (malloc'ed) array of "external" port for which there is
50 * a port mapping. number is the size of the array */
52 get_portmappings_in_range(unsigned short startport
, unsigned short endport
,
53 int proto
, unsigned int * number
);