Electroneum
Loading...
Searching...
No Matches
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 */
16int
18
19void
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 */
28int
29get_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 */
40int
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 */
51unsigned short *
52get_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 */
56int
57update_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 */
62int
64 unsigned short eport, int proto,
65 const char * desc, unsigned int timestamp);
66
67#endif
unsigned short * get_portmappings_in_range(unsigned short startport, unsigned short endport, int proto, unsigned int *number)
void shutdown_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 update_portmapping(const char *ifname, unsigned short eport, int proto, unsigned short iport, const char *desc, unsigned int timestamp)
int update_portmapping_desc_timestamp(const char *ifname, unsigned short eport, int proto, const char *desc, unsigned int timestamp)
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 init_redirect(void)