1 | /* $Id: portfwd.h 93115 2022-01-01 11:31:46Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * NAT Network - port-forwarding rules, definitions and declarations.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2013-2022 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 VBOX_INCLUDED_SRC_NAT_portfwd_h
|
---|
19 | #define VBOX_INCLUDED_SRC_NAT_portfwd_h
|
---|
20 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
21 | # pragma once
|
---|
22 | #endif
|
---|
23 |
|
---|
24 | #ifndef RT_OS_WINDOWS
|
---|
25 | #include <sys/types.h>
|
---|
26 | #include <sys/socket.h>
|
---|
27 | #include <netinet/in.h>
|
---|
28 | #endif
|
---|
29 |
|
---|
30 | #include "lwip/ip_addr.h"
|
---|
31 |
|
---|
32 |
|
---|
33 | struct fwspec {
|
---|
34 | int sdom; /* PF_INET, PF_INET6 */
|
---|
35 | int stype; /* SOCK_STREAM, SOCK_DGRAM */
|
---|
36 |
|
---|
37 | /* listen on */
|
---|
38 | union {
|
---|
39 | struct sockaddr sa;
|
---|
40 | struct sockaddr_in sin; /* sdom == PF_INET */
|
---|
41 | struct sockaddr_in6 sin6; /* sdom == PF_INET6 */
|
---|
42 | } src;
|
---|
43 |
|
---|
44 | /* forward to */
|
---|
45 | union {
|
---|
46 | struct sockaddr sa;
|
---|
47 | struct sockaddr_in sin; /* sdom == PF_INET */
|
---|
48 | struct sockaddr_in6 sin6; /* sdom == PF_INET6 */
|
---|
49 | } dst;
|
---|
50 | };
|
---|
51 |
|
---|
52 |
|
---|
53 | void portfwd_init(void);
|
---|
54 | int portfwd_rule_add(struct fwspec *);
|
---|
55 | int portfwd_rule_del(struct fwspec *);
|
---|
56 |
|
---|
57 |
|
---|
58 | int fwspec_set(struct fwspec *, int, int,
|
---|
59 | const char *, uint16_t,
|
---|
60 | const char *, uint16_t);
|
---|
61 |
|
---|
62 | int fwspec_equal(struct fwspec *, struct fwspec *);
|
---|
63 |
|
---|
64 | void fwtcp_init(void);
|
---|
65 | void fwudp_init(void);
|
---|
66 |
|
---|
67 | void fwtcp_add(struct fwspec *);
|
---|
68 | void fwtcp_del(struct fwspec *);
|
---|
69 | void fwudp_add(struct fwspec *);
|
---|
70 | void fwudp_del(struct fwspec *);
|
---|
71 |
|
---|
72 | int fwany_ipX_addr_set_src(ipX_addr_t *, const struct sockaddr *);
|
---|
73 |
|
---|
74 | #endif /* !VBOX_INCLUDED_SRC_NAT_portfwd_h */
|
---|