]>
Commit | Line | Data |
---|---|---|
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 | * | |
8 | * Copyright (C) 2013-2025 Heiko Hund <heiko.hund@sophos.com> | |
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 | * | |
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. | |
22 | */ | |
23 | ||
24 | #ifndef OPENVPN_MSG_H_ | |
25 | #define OPENVPN_MSG_H_ | |
26 | ||
27 | #include <windef.h> | |
28 | #include <ws2tcpip.h> | |
29 | ||
30 | typedef enum { | |
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, | |
38 | msg_add_nrpt_cfg, | |
39 | msg_del_nrpt_cfg, | |
40 | msg_add_nbt_cfg, | |
41 | msg_del_nbt_cfg, | |
42 | msg_flush_neighbors, | |
43 | msg_add_wfp_block, | |
44 | msg_del_wfp_block, | |
45 | msg_register_dns, | |
46 | msg_enable_dhcp, | |
47 | deprecated_msg_register_ring_buffers, | |
48 | msg_set_mtu, | |
49 | msg_add_wins_cfg, | |
50 | msg_del_wins_cfg, | |
51 | msg_create_adapter | |
52 | } message_type_t; | |
53 | ||
54 | typedef struct { | |
55 | message_type_t type; | |
56 | size_t size; | |
57 | int message_id; | |
58 | } message_header_t; | |
59 | ||
60 | typedef union { | |
61 | struct in_addr ipv4; | |
62 | struct in6_addr ipv6; | |
63 | } inet_address_t; | |
64 | ||
65 | typedef struct { | |
66 | int index; | |
67 | char name[256]; | |
68 | } interface_t; | |
69 | ||
70 | typedef enum { | |
71 | wfp_block_local = 1<<0, | |
72 | wfp_block_dns = 1<<1 | |
73 | } wfp_block_flags_t; | |
74 | ||
75 | typedef struct { | |
76 | message_header_t header; | |
77 | short family; | |
78 | inet_address_t address; | |
79 | int prefix_len; | |
80 | interface_t iface; | |
81 | } address_message_t; | |
82 | ||
83 | typedef struct { | |
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; | |
91 | } route_message_t; | |
92 | ||
93 | typedef struct { | |
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 */ | |
100 | } dns_cfg_message_t; | |
101 | ||
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 | ||
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; | |
125 | ||
126 | typedef struct { | |
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; | |
134 | } nbt_cfg_message_t; | |
135 | ||
136 | /* TODO: NTP */ | |
137 | ||
138 | typedef struct { | |
139 | message_header_t header; | |
140 | short family; | |
141 | interface_t iface; | |
142 | } flush_neighbors_message_t; | |
143 | ||
144 | typedef struct { | |
145 | message_header_t header; | |
146 | int error_number; | |
147 | } ack_message_t; | |
148 | ||
149 | typedef struct { | |
150 | message_header_t header; | |
151 | wfp_block_flags_t flags; | |
152 | interface_t iface; | |
153 | } wfp_block_message_t; | |
154 | ||
155 | typedef struct { | |
156 | message_header_t header; | |
157 | interface_t iface; | |
158 | } enable_dhcp_message_t; | |
159 | ||
160 | typedef struct { | |
161 | message_header_t header; | |
162 | interface_t iface; | |
163 | short family; | |
164 | int mtu; | |
165 | } set_mtu_message_t; | |
166 | ||
167 | typedef enum { | |
168 | ADAPTER_TYPE_DCO, | |
169 | ADAPTER_TYPE_TAP, | |
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 | ||
177 | #endif /* ifndef OPENVPN_MSG_H_ */ |