Electroneum
commonrdr.h
Go to the documentation of this file.
1 /* $Id: commonrdr.h,v 1.10 2016/02/12 12:34:39 nanard Exp $ */
2 /* MiniUPnP project
3  * (c) 2006-2016 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
9 
10 #include "config.h"
11 
12 /* init and shutdown functions */
13 /* init_redirect() return values :
14  * 0 : OK
15  * -1 : error */
16 int
17 init_redirect(void);
18 
19 void
20 shutdown_redirect(void);
21 
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
27  */
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);
35 
36 /* get_redirect_rule_by_index()
37  * return values :
38  * 0 success (rule found)
39  * -1 error or rule not found */
40 int
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);
48 
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);
54 
55 /* update the port mapping internal port, decription and timestamp */
56 int
57 update_portmapping(const char * ifname, unsigned short eport, int proto,
58  unsigned short iport, const char * desc,
59  unsigned int timestamp);
60 
61 /* update the port mapping decription and timestamp */
62 int
63 update_portmapping_desc_timestamp(const char * ifname,
64  unsigned short eport, int proto,
65  const char * desc, unsigned int timestamp);
66 
67 #endif
int update_portmapping_desc_timestamp(const char *ifname, unsigned short eport, int proto, const char *desc, unsigned int timestamp)
int init_redirect(void)
int get_redirect_rule(const char *ifname, unsigned short eport, int proto, char *iaddr, int iaddrlen, unsigned short *iport, char *desc, int desclen, char *rhost, int rhostlen, unsigned int *timestamp, u_int64_t *packets, u_int64_t *bytes)
int get_redirect_rule_by_index(int index, char *ifname, unsigned short *eport, char *iaddr, int iaddrlen, unsigned short *iport, int *proto, char *desc, int desclen, char *rhost, int rhostlen, unsigned int *timestamp, u_int64_t *packets, u_int64_t *bytes)
int update_portmapping(const char *ifname, unsigned short eport, int proto, unsigned short iport, const char *desc, unsigned int timestamp)
void shutdown_redirect(void)
unsigned short * get_portmappings_in_range(unsigned short startport, unsigned short endport, int proto, unsigned int *number)