1 /* $Id: upnppermissions.h,v 1.11 2014/03/13 10:11:25 nanard Exp $ */
3 * http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/
4 * (c) 2006-2014 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
8 #ifndef UPNPPERMISSIONS_H_INCLUDED
9 #define UPNPPERMISSIONS_H_INCLUDED
11 #include <sys/types.h>
12 #include <sys/socket.h>
13 #include <netinet/in.h>
16 /* UPnP permission rule samples:
17 * allow 1024-65535 192.168.3.0/24 1024-65535
18 * deny 0-65535 192.168.1.125/32 0-65535 */
20 enum {UPNPPERM_ALLOW
=1, UPNPPERM_DENY
=2 } type
;
21 /* is it an allow or deny permission rule ? */
22 u_short eport_min
, eport_max
; /* external port range */
23 struct in_addr address
, mask
; /* ip/mask */
24 u_short iport_min
, iport_max
; /* internal port range */
27 /* read_permission_line()
28 * returns: 0 line read okay
29 * -1 error reading line
32 * allow 1024-65535 192.168.3.0/24 1024-65535
33 * allow 22 192.168.4.33/32 22
34 * deny 0-65535 0.0.0.0/0 0-65535 */
36 read_permission_line(struct upnpperm
* perm
,
39 /* check_upnp_rule_against_permissions()
40 * returns: 0 if the upnp rule should be rejected,
41 * 1 if it could be accepted */
43 check_upnp_rule_against_permissions(const struct upnpperm
* permary
,
45 u_short eport
, struct in_addr address
,
48 #ifdef USE_MINIUPNPDCTL
50 write_permlist(int fd
, const struct upnpperm
* permary
,