Monero
Loading...
Searching...
No Matches
upnppermissions.h
Go to the documentation of this file.
1/* $Id: upnppermissions.h,v 1.12 2020/10/30 21:37:35 nanard Exp $ */
2/* MiniUPnP project
3 * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/
4 * (c) 2006-2020 Thomas Bernard
5 * This software is subject to the conditions detailed
6 * in the LICENCE file provided within the distribution */
7
8#ifndef UPNPPERMISSIONS_H_INCLUDED
9#define UPNPPERMISSIONS_H_INCLUDED
10
11#include <sys/types.h>
12#include <sys/socket.h>
13#include <netinet/in.h>
14#include "config.h"
15
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 */
19struct upnpperm {
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 */
25};
26
27/* read_permission_line()
28 * returns: 0 line read okay
29 * -1 error reading line
30 *
31 * line sample :
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 */
35int
36read_permission_line(struct upnpperm * perm,
37 char * p);
38
39/* check_upnp_rule_against_permissions()
40 * returns: 0 if the upnp rule should be rejected,
41 * 1 if it could be accepted */
42int
44 int n_perms,
45 u_short eport, struct in_addr address,
46 u_short iport);
47
51void
53 const struct upnpperm * permary, int n_perms,
54 in_addr_t addr, u_short iport);
55
56#ifdef USE_MINIUPNPDCTL
57void
58write_permlist(int fd, const struct upnpperm * permary,
59 int nperms);
60#endif
61
62#endif
63
#define fd(x)
Definition aesb.c:127
uint32_t address
Definition getifaddr.c:269
unsigned int uint32_t
Definition stdint.h:126
Definition upnppermissions.h:19
u_short iport_max
Definition upnppermissions.h:24
@ UPNPPERM_ALLOW
Definition upnppermissions.h:20
@ UPNPPERM_DENY
Definition upnppermissions.h:20
enum upnpperm::@277203137046247173055027306032324273113214025046 type
u_short eport_min
Definition upnppermissions.h:22
struct in_addr address mask
Definition upnppermissions.h:23
u_short eport_max
Definition upnppermissions.h:22
u_short iport_min
Definition upnppermissions.h:24
void get_permitted_ext_ports(uint32_t *allowed, const struct upnpperm *permary, int n_perms, in_addr_t addr, u_short iport)
Definition upnppermissions.c:266
int read_permission_line(struct upnpperm *perm, char *p)
Definition upnppermissions.c:25
int check_upnp_rule_against_permissions(const struct upnpperm *permary, int n_perms, u_short eport, struct in_addr address, u_short iport)
Definition upnppermissions.c:244