]>
Commit | Line | Data |
---|---|---|
a24dd2e3 HH |
1 | /* |
2 | * OpenVPN -- An application to securely tunnel IP networks | |
3 | * over a single TCP/UDP port, with support for SSL/TLS-based | |
4 | * session authentication and key exchange, | |
5 | * packet encryption, packet authentication, and | |
6 | * packet compression. | |
7 | * | |
022f0a43 | 8 | * Copyright (C) 2013-2025 Heiko Hund <heiko.hund@sophos.com> |
a24dd2e3 HH |
9 | * |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License version 2 | |
12 | * as published by the Free Software Foundation. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
caa54ac3 DS |
19 | * You should have received a copy of the GNU General Public License along |
20 | * with this program; if not, write to the Free Software Foundation, Inc., | |
21 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
a24dd2e3 HH |
22 | */ |
23 | ||
24 | #ifndef OPENVPN_MSG_H_ | |
25 | #define OPENVPN_MSG_H_ | |
26 | ||
bf887c95 HH |
27 | #include <windef.h> |
28 | #include <ws2tcpip.h> | |
29 | ||
a24dd2e3 | 30 | typedef enum { |
81d882d5 DS |
31 | msg_acknowledgement, |
32 | msg_add_address, | |
33 | msg_del_address, | |
34 | msg_add_route, | |
35 | msg_del_route, | |
36 | msg_add_dns_cfg, | |
37 | msg_del_dns_cfg, | |
0f3b7d17 HH |
38 | msg_add_nrpt_cfg, |
39 | msg_del_nrpt_cfg, | |
81d882d5 DS |
40 | msg_add_nbt_cfg, |
41 | msg_del_nbt_cfg, | |
42 | msg_flush_neighbors, | |
bf887c95 HH |
43 | msg_add_wfp_block, |
44 | msg_del_wfp_block, | |
b4fc8bbd SN |
45 | msg_register_dns, |
46 | msg_enable_dhcp, | |
ad7a6945 | 47 | deprecated_msg_register_ring_buffers, |
18826de5 LS |
48 | msg_set_mtu, |
49 | msg_add_wins_cfg, | |
c1c330b6 LS |
50 | msg_del_wins_cfg, |
51 | msg_create_adapter | |
a24dd2e3 HH |
52 | } message_type_t; |
53 | ||
54 | typedef struct { | |
81d882d5 DS |
55 | message_type_t type; |
56 | size_t size; | |
57 | int message_id; | |
a24dd2e3 HH |
58 | } message_header_t; |
59 | ||
60 | typedef union { | |
81d882d5 DS |
61 | struct in_addr ipv4; |
62 | struct in6_addr ipv6; | |
a24dd2e3 HH |
63 | } inet_address_t; |
64 | ||
65 | typedef struct { | |
81d882d5 DS |
66 | int index; |
67 | char name[256]; | |
a24dd2e3 HH |
68 | } interface_t; |
69 | ||
bf887c95 HH |
70 | typedef enum { |
71 | wfp_block_local = 1<<0, | |
72 | wfp_block_dns = 1<<1 | |
73 | } wfp_block_flags_t; | |
74 | ||
a24dd2e3 | 75 | typedef struct { |
81d882d5 DS |
76 | message_header_t header; |
77 | short family; | |
78 | inet_address_t address; | |
79 | int prefix_len; | |
80 | interface_t iface; | |
a24dd2e3 HH |
81 | } address_message_t; |
82 | ||
83 | typedef struct { | |
81d882d5 DS |
84 | message_header_t header; |
85 | short family; | |
86 | inet_address_t prefix; | |
87 | int prefix_len; | |
88 | inet_address_t gateway; | |
89 | interface_t iface; | |
90 | int metric; | |
a24dd2e3 HH |
91 | } route_message_t; |
92 | ||
93 | typedef struct { | |
81d882d5 DS |
94 | message_header_t header; |
95 | interface_t iface; | |
96 | char domains[512]; | |
97 | short family; | |
98 | int addr_len; | |
99 | inet_address_t addr[4]; /* support up to 4 dns addresses */ | |
a24dd2e3 | 100 | } dns_cfg_message_t; |
18826de5 | 101 | |
0f3b7d17 HH |
102 | |
103 | typedef enum { | |
104 | nrpt_dnssec | |
105 | } nrpt_flags_t; | |
106 | ||
107 | #define NRPT_ADDR_NUM 8 /* Max. number of addresses */ | |
108 | #define NRPT_ADDR_SIZE 48 /* Max. address strlen + some */ | |
109 | typedef char nrpt_address_t[NRPT_ADDR_SIZE]; | |
110 | typedef struct { | |
111 | message_header_t header; | |
112 | interface_t iface; | |
113 | nrpt_address_t addresses[NRPT_ADDR_NUM]; | |
114 | char resolve_domains[512]; /* double \0 terminated */ | |
115 | char search_domains[512]; | |
116 | nrpt_flags_t flags; | |
117 | } nrpt_dns_cfg_message_t; | |
118 | ||
18826de5 LS |
119 | typedef struct { |
120 | message_header_t header; | |
121 | interface_t iface; | |
122 | int addr_len; | |
123 | inet_address_t addr[4]; /* support up to 4 dns addresses */ | |
124 | } wins_cfg_message_t; | |
a24dd2e3 HH |
125 | |
126 | typedef struct { | |
81d882d5 DS |
127 | message_header_t header; |
128 | interface_t iface; | |
129 | int disable_nbt; | |
130 | int nbt_type; | |
131 | char scope_id[256]; | |
132 | struct in_addr primary_nbns; | |
133 | struct in_addr secondary_nbns; | |
a24dd2e3 HH |
134 | } nbt_cfg_message_t; |
135 | ||
81d882d5 | 136 | /* TODO: NTP */ |
a24dd2e3 HH |
137 | |
138 | typedef struct { | |
81d882d5 DS |
139 | message_header_t header; |
140 | short family; | |
141 | interface_t iface; | |
a24dd2e3 HH |
142 | } flush_neighbors_message_t; |
143 | ||
144 | typedef struct { | |
81d882d5 DS |
145 | message_header_t header; |
146 | int error_number; | |
a24dd2e3 HH |
147 | } ack_message_t; |
148 | ||
2282b1be | 149 | typedef struct { |
81d882d5 | 150 | message_header_t header; |
bf887c95 | 151 | wfp_block_flags_t flags; |
81d882d5 | 152 | interface_t iface; |
bf887c95 | 153 | } wfp_block_message_t; |
2282b1be | 154 | |
b4fc8bbd SN |
155 | typedef struct { |
156 | message_header_t header; | |
157 | interface_t iface; | |
158 | } enable_dhcp_message_t; | |
159 | ||
0213f80e CS |
160 | typedef struct { |
161 | message_header_t header; | |
162 | interface_t iface; | |
163 | short family; | |
164 | int mtu; | |
165 | } set_mtu_message_t; | |
166 | ||
c1c330b6 LS |
167 | typedef enum { |
168 | ADAPTER_TYPE_DCO, | |
169 | ADAPTER_TYPE_TAP, | |
c1c330b6 LS |
170 | } adapter_type_t; |
171 | ||
172 | typedef struct { | |
173 | message_header_t header; | |
174 | adapter_type_t adapter_type; | |
175 | } create_adapter_message_t; | |
176 | ||
81d882d5 | 177 | #endif /* ifndef OPENVPN_MSG_H_ */ |