miniupnpd 1.9 (20160113)
[tomato.git] / release / src / router / miniupnpd / commonrdr.h
blob7c0bd7c1bbbef681339dfbc3e71d18f5ecfb7e55
1 /* $Id: commonrdr.h,v 1.9 2014/02/11 09:36:15 nanard Exp $ */
2 /* MiniUPnP project
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
10 #include "config.h"
12 /* init and shutdown functions */
13 /* init_redirect() return values :
14 * 0 : OK
15 * -1 : error */
16 int
17 init_redirect(void);
19 void
20 shutdown_redirect(void);
22 /* get_redirect_rule() gets internal IP and port from
23 * interface, external port and protocol
24 * return value :
25 * 0 success (rule found)
26 * -1 error or rule not found
28 int
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()
37 * return values :
38 * 0 success (rule found)
39 * -1 error or rule not found */
40 int
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 */
51 unsigned short *
52 get_portmappings_in_range(unsigned short startport, unsigned short endport,
53 int proto, unsigned int * number);
55 #endif