1: /* $Id: upnpredirect.h,v 1.1.1.1 2012/02/21 23:16:02 misho Exp $ */
2: /* MiniUPnP project
3: * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4: * (c) 2006 Thomas Bernard
5: * This software is subject to the conditions detailed
6: * in the LICENCE file provided within the distribution */
7:
8: #ifndef __UPNPREDIRECT_H__
9: #define __UPNPREDIRECT_H__
10:
11: #include "config.h"
12:
13: #ifdef ENABLE_LEASEFILE
14: int reload_from_lease_file();
15: #endif
16:
17: /* upnp_redirect()
18: * calls OS/fw dependant implementation of the redirection.
19: * protocol should be the string "TCP" or "UDP"
20: * returns: 0 on success
21: * -1 failed to redirect
22: * -2 already redirected
23: * -3 permission check failed
24: */
25: int
26: upnp_redirect(unsigned short eport,
27: const char * iaddr, unsigned short iport,
28: const char * protocol, const char * desc);
29:
30: /* upnp_redirect_internal()
31: * same as upnp_redirect() without any check */
32: int
33: upnp_redirect_internal(unsigned short eport,
34: const char * iaddr, unsigned short iport,
35: int proto, const char * desc);
36:
37: /* upnp_get_redirection_infos() */
38: int
39: upnp_get_redirection_infos(unsigned short eport, const char * protocol,
40: unsigned short * iport, char * iaddr, int iaddrlen,
41: char * desc, int desclen);
42:
43: /* upnp_get_redirection_infos_by_index */
44: int
45: upnp_get_redirection_infos_by_index(int index,
46: unsigned short * eport, char * protocol,
47: unsigned short * iport,
48: char * iaddr, int iaddrlen,
49: char * desc, int desclen);
50:
51: /* upnp_delete_redirection()
52: * returns: 0 on success
53: * -1 on failure*/
54: int
55: upnp_delete_redirection(unsigned short eport, const char * protocol);
56:
57: /* _upnp_delete_redir()
58: * same as above */
59: int
60: _upnp_delete_redir(unsigned short eport, int proto);
61:
62: /* Periodic cleanup functions
63: */
64: struct rule_state
65: {
66: u_int64_t packets;
67: u_int64_t bytes;
68: struct rule_state * next;
69: unsigned short eport;
70: short proto;
71: };
72:
73: struct rule_state *
74: get_upnp_rules_state_list(int max_rules_number_target);
75:
76: int
77: upnp_get_portmapping_number_of_entries();
78:
79: /* remove_unused_rules() :
80: * also free the list */
81: void
82: remove_unused_rules(struct rule_state * list);
83:
84: /* stuff for responding to miniupnpdctl */
85: #ifdef USE_MINIUPNPDCTL
86: void
87: write_ruleset_details(int s);
88: #endif
89:
90: #endif
91:
92:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>