1 | /* $Id$ */
|
---|
2 | /** @file
|
---|
3 | * NAT Network - port-forwarding rules, definitions and declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2014 Oracle Corporation
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef _portfwd_h_
|
---|
19 | #define _portfwd_h_
|
---|
20 |
|
---|
21 | #ifndef RT_OS_WINDOWS
|
---|
22 | #include <sys/types.h>
|
---|
23 | #include <sys/socket.h>
|
---|
24 | #include <netinet/in.h>
|
---|
25 | #endif
|
---|
26 |
|
---|
27 | #include "lwip/ip_addr.h"
|
---|
28 |
|
---|
29 |
|
---|
30 | struct fwspec {
|
---|
31 | int sdom; /* PF_INET, PF_INET6 */
|
---|
32 | int stype; /* SOCK_STREAM, SOCK_DGRAM */
|
---|
33 |
|
---|
34 | /* listen on */
|
---|
35 | union {
|
---|
36 | struct sockaddr sa;
|
---|
37 | struct sockaddr_in sin; /* sdom == PF_INET */
|
---|
38 | struct sockaddr_in6 sin6; /* sdom == PF_INET6 */
|
---|
39 | } src;
|
---|
40 |
|
---|
41 | /* forward to */
|
---|
42 | union {
|
---|
43 | struct sockaddr sa;
|
---|
44 | struct sockaddr_in sin; /* sdom == PF_INET */
|
---|
45 | struct sockaddr_in6 sin6; /* sdom == PF_INET6 */
|
---|
46 | } dst;
|
---|
47 | };
|
---|
48 |
|
---|
49 |
|
---|
50 | void portfwd_init(void);
|
---|
51 | int portfwd_rule_add(struct fwspec *);
|
---|
52 | int portfwd_rule_del(struct fwspec *);
|
---|
53 |
|
---|
54 |
|
---|
55 | int fwspec_set(struct fwspec *, int, int,
|
---|
56 | const char *, uint16_t,
|
---|
57 | const char *, uint16_t);
|
---|
58 |
|
---|
59 | int fwspec_equal(struct fwspec *, struct fwspec *);
|
---|
60 |
|
---|
61 | void fwtcp_init(void);
|
---|
62 | void fwudp_init(void);
|
---|
63 |
|
---|
64 | void fwtcp_add(struct fwspec *);
|
---|
65 | void fwtcp_del(struct fwspec *);
|
---|
66 | void fwudp_add(struct fwspec *);
|
---|
67 | void fwudp_del(struct fwspec *);
|
---|
68 |
|
---|
69 | int fwany_ipX_addr_set_src(ipX_addr_t *, const struct sockaddr *);
|
---|
70 |
|
---|
71 | #endif /* _portfwd_h_ */
|
---|