version 1.1.1.1, 2012/02/21 23:16:02
|
version 1.1.1.3, 2013/07/22 00:32:35
|
Line 1
|
Line 1
|
/* $Id$ */ |
/* $Id$ */ |
/* MiniUPnP project |
/* MiniUPnP project |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ |
* (c) 2006 Thomas Bernard | * (c) 2006-2012 Thomas Bernard |
* This software is subject to the conditions detailed |
* This software is subject to the conditions detailed |
* in the LICENCE file provided within the distribution */ |
* in the LICENCE file provided within the distribution */ |
|
|
#ifndef __UPNPREDIRECT_H__ | #ifndef UPNPREDIRECT_H_INCLUDED |
#define __UPNPREDIRECT_H__ | #define UPNPREDIRECT_H_INCLUDED |
|
|
|
/* for u_int64_t */ |
|
#include <sys/types.h> |
|
|
#include "config.h" |
#include "config.h" |
|
|
#ifdef ENABLE_LEASEFILE |
#ifdef ENABLE_LEASEFILE |
int reload_from_lease_file(); | int reload_from_lease_file(void); |
#endif |
#endif |
|
|
/* upnp_redirect() | /* upnp_redirect() |
* calls OS/fw dependant implementation of the redirection. |
* calls OS/fw dependant implementation of the redirection. |
* protocol should be the string "TCP" or "UDP" |
* protocol should be the string "TCP" or "UDP" |
* returns: 0 on success |
* returns: 0 on success |
Line 23 int reload_from_lease_file();
|
Line 26 int reload_from_lease_file();
|
* -3 permission check failed |
* -3 permission check failed |
*/ |
*/ |
int |
int |
upnp_redirect(unsigned short eport, | upnp_redirect(const char * rhost, unsigned short eport, |
const char * iaddr, unsigned short iport, |
const char * iaddr, unsigned short iport, |
const char * protocol, const char * desc); | const char * protocol, const char * desc, |
| unsigned int leaseduration); |
|
|
/* upnp_redirect_internal() |
/* upnp_redirect_internal() |
* same as upnp_redirect() without any check */ |
* same as upnp_redirect() without any check */ |
int |
int |
upnp_redirect_internal(unsigned short eport, | upnp_redirect_internal(const char * rhost, unsigned short eport, |
const char * iaddr, unsigned short iport, |
const char * iaddr, unsigned short iport, |
int proto, const char * desc); | int proto, const char * desc, |
| unsigned int timestamp); |
|
|
/* upnp_get_redirection_infos() */ | /* upnp_get_redirection_infos() |
| * returns : 0 on success |
| * -1 failed to get the port mapping entry or no entry exists */ |
int |
int |
upnp_get_redirection_infos(unsigned short eport, const char * protocol, |
upnp_get_redirection_infos(unsigned short eport, const char * protocol, |
unsigned short * iport, char * iaddr, int iaddrlen, |
unsigned short * iport, char * iaddr, int iaddrlen, |
char * desc, int desclen); | char * desc, int desclen, |
| char * rhost, int rhostlen, |
| unsigned int * leaseduration); |
|
|
/* upnp_get_redirection_infos_by_index */ | /* upnp_get_redirection_infos_by_index() |
| * returns : 0 on success |
| * -1 failed to get the port mapping or index out of range */ |
int |
int |
upnp_get_redirection_infos_by_index(int index, |
upnp_get_redirection_infos_by_index(int index, |
unsigned short * eport, char * protocol, |
unsigned short * eport, char * protocol, |
unsigned short * iport, | unsigned short * iport, |
char * iaddr, int iaddrlen, |
char * iaddr, int iaddrlen, |
char * desc, int desclen); | char * desc, int desclen, |
| char * rhost, int rhostlen, |
| unsigned int * leaseduration); |
|
|
/* upnp_delete_redirection() |
/* upnp_delete_redirection() |
* returns: 0 on success |
* returns: 0 on success |
Line 67 struct rule_state
|
Line 80 struct rule_state
|
u_int64_t bytes; |
u_int64_t bytes; |
struct rule_state * next; |
struct rule_state * next; |
unsigned short eport; |
unsigned short eport; |
short proto; | unsigned char proto; |
| unsigned char to_remove; |
}; |
}; |
|
|
|
/* return a linked list of all rules |
|
* or an empty list if there are not enough |
|
* As a "side effect", delete rules which are expired */ |
struct rule_state * |
struct rule_state * |
get_upnp_rules_state_list(int max_rules_number_target); |
get_upnp_rules_state_list(int max_rules_number_target); |
|
|
|
/* return the number of port mapping entries */ |
int |
int |
upnp_get_portmapping_number_of_entries(); | upnp_get_portmapping_number_of_entries(void); |
|
|
/* remove_unused_rules() : |
/* remove_unused_rules() : |
* also free the list */ |
* also free the list */ |
void |
void |
remove_unused_rules(struct rule_state * list); |
remove_unused_rules(struct rule_state * list); |
|
|
|
/* upnp_get_portmappings_in_range() |
|
* return a list of all "external" ports for which a port |
|
* mapping exists */ |
|
unsigned short * |
|
upnp_get_portmappings_in_range(unsigned short startport, |
|
unsigned short endport, |
|
const char * protocol, |
|
unsigned int * number); |
|
|
/* stuff for responding to miniupnpdctl */ |
/* stuff for responding to miniupnpdctl */ |
#ifdef USE_MINIUPNPDCTL |
#ifdef USE_MINIUPNPDCTL |