2012-09-18 08:31:52 +00:00
|
|
|
/* $Id: upnppinhole.h,v 1.2 2012/09/18 08:29:49 nanard Exp $ */
|
2016-01-18 19:16:06 +00:00
|
|
|
/* vim: tabstop=4 shiftwidth=4 noexpandtab
|
|
|
|
* MiniUPnP project
|
2012-05-01 20:25:30 +00:00
|
|
|
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
|
2016-01-18 19:16:06 +00:00
|
|
|
* (c) 2006-2016 Thomas Bernard
|
2012-05-01 20:25:30 +00:00
|
|
|
* This software is subject to the conditions detailed
|
|
|
|
* in the LICENCE file provided within the distribution */
|
|
|
|
|
2012-09-20 20:52:51 +00:00
|
|
|
#ifndef UPNPPINHOLE_H_INCLUDED
|
|
|
|
#define UPNPPINHOLE_H_INCLUDED
|
2012-05-01 20:25:30 +00:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
2014-05-10 11:09:48 +00:00
|
|
|
#ifdef ENABLE_UPNPPINHOLE
|
|
|
|
|
2021-08-17 07:19:33 +00:00
|
|
|
#ifdef ENABLE_LEASEFILE
|
|
|
|
int reload_from_lease_file6(void);
|
|
|
|
int lease_file6_expire(void);
|
|
|
|
#endif
|
|
|
|
|
2016-01-18 19:16:06 +00:00
|
|
|
/* functions to be used by WANIPv6_FirewallControl implementation
|
|
|
|
* and PCP (IPv6) */
|
2012-05-01 20:25:30 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* retrieve outbound pinhole timeout */
|
|
|
|
int
|
|
|
|
upnp_check_outbound_pinhole(int proto, int * timeout);
|
|
|
|
#endif
|
|
|
|
|
2016-01-18 19:16:06 +00:00
|
|
|
/* find an inbound pinhole base on remove host:port / local host:port
|
|
|
|
* return the (positive) uid or a negative value if not found */
|
|
|
|
int
|
|
|
|
upnp_find_inboundpinhole(const char * raddr, unsigned short rport,
|
|
|
|
const char * iaddr, unsigned short iport,
|
|
|
|
int proto,
|
|
|
|
char * desc, int desc_len, unsigned int * leasetime);
|
|
|
|
|
|
|
|
|
2012-05-01 20:25:30 +00:00
|
|
|
/* add an inbound pinehole
|
|
|
|
* return value :
|
|
|
|
* 1 = success
|
|
|
|
* -1 = Pinhole space exhausted
|
|
|
|
* .. = error */
|
|
|
|
int
|
|
|
|
upnp_add_inboundpinhole(const char * raddr, unsigned short rport,
|
2014-05-10 12:30:58 +00:00
|
|
|
const char * iaddr, unsigned short iport,
|
|
|
|
int proto, char * desc,
|
|
|
|
unsigned int leasetime, int * uid);
|
2012-05-01 20:25:30 +00:00
|
|
|
|
2016-01-18 19:16:06 +00:00
|
|
|
/* get from uid
|
2012-05-01 20:25:30 +00:00
|
|
|
* return values :
|
|
|
|
* -1 not found
|
|
|
|
* */
|
|
|
|
int
|
|
|
|
upnp_get_pinhole_info(unsigned short uid,
|
|
|
|
char * raddr, int raddrlen,
|
|
|
|
unsigned short * rport,
|
|
|
|
char * iaddr, int iaddrlen,
|
|
|
|
unsigned short * iport,
|
2014-05-10 11:09:48 +00:00
|
|
|
int * proto, char * desc, int desclen,
|
2012-05-01 20:25:30 +00:00
|
|
|
unsigned int * leasetime,
|
|
|
|
unsigned int * packets);
|
|
|
|
|
2014-05-10 11:09:48 +00:00
|
|
|
/*
|
|
|
|
* return values:
|
|
|
|
* -1 = not found
|
|
|
|
* 0 .. 65535 = uid of the rule for the index
|
|
|
|
*/
|
|
|
|
int
|
|
|
|
upnp_get_pinhole_uid_by_index(int index);
|
|
|
|
|
2012-05-01 20:25:30 +00:00
|
|
|
/* update the lease time */
|
|
|
|
int
|
|
|
|
upnp_update_inboundpinhole(unsigned short uid, unsigned int leasetime);
|
|
|
|
|
|
|
|
/* remove the inbound pinhole */
|
|
|
|
int
|
|
|
|
upnp_delete_inboundpinhole(unsigned short uid);
|
|
|
|
|
|
|
|
/* ... */
|
|
|
|
#if 0
|
|
|
|
int
|
|
|
|
upnp_check_pinhole_working(const char * uid, char * eaddr, char * iaddr, unsigned short * eport, unsigned short * iport, char * protocol, int * rulenum_used);
|
|
|
|
#endif
|
|
|
|
|
2012-09-18 08:31:52 +00:00
|
|
|
/* return the number of expired pinhole removed
|
|
|
|
* write timestamp to next pinhole to exprire to next_timestamp
|
|
|
|
* next_timestamp is left untouched if there is no pinhole lest */
|
2012-05-01 20:25:30 +00:00
|
|
|
int
|
|
|
|
upnp_clean_expired_pinholes(unsigned int * next_timestamp);
|
|
|
|
|
2014-05-10 11:09:48 +00:00
|
|
|
#endif /* ENABLE_UPNPPINHOLE */
|
2012-05-01 20:25:30 +00:00
|
|
|
|
2014-05-10 11:09:48 +00:00
|
|
|
#endif /* !UPNPPINHOLE_H_INCLUDED */
|