1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2004 Red Hat, Inc.
4 */
5
6/* D-Bus-related definitions for NetworkManager VPN plugins.
7 *
8 * Note that although this header is installed as part of libnm, it is also
9 * used by some external code that does not link to libnm.
10 */
11
12#ifndef __NM_VPN_DBUS_INTERFACE_H__
13#define __NM_VPN_DBUS_INTERFACE_H__
14
15#include "nm-dbus-interface.h"
16
17#ifndef NM_VERSION_H
18#define NM_DEPRECATED_IN_1_8_FOR(n)
19#endif
20
21/*
22 * dbus services details
23 */
24#define NM_DBUS_PATH_VPN "/org/freedesktop/NetworkManager/VPN/Manager"
25#define NM_DBUS_INTERFACE_VPN "org.freedesktop.NetworkManager.VPN.Manager"
26
27#define NM_DBUS_PATH_VPN_CONNECTION "/org/freedesktop/NetworkManager/VPN/Connection"
28#define NM_DBUS_INTERFACE_VPN_CONNECTION "org.freedesktop.NetworkManager.VPN.Connection"
29
30#define NM_VPN_DBUS_PLUGIN_PATH "/org/freedesktop/NetworkManager/VPN/Plugin"
31#define NM_VPN_DBUS_PLUGIN_INTERFACE "org.freedesktop.NetworkManager.VPN.Plugin"
32
33/*
34 * VPN Errors
35 */
36#define NM_DBUS_NO_ACTIVE_VPN_CONNECTION \
37 "org.freedesktop.NetworkManager.VPNConnections.NoActiveVPNConnection"
38#define NM_DBUS_NO_VPN_CONNECTIONS "org.freedesktop.NetworkManager.VPNConnections.NoVPNConnections"
39#define NM_DBUS_INVALID_VPN_CONNECTION \
40 "org.freedesktop.NetworkManager.VPNConnections.InvalidVPNConnection"
41
42#define NM_DBUS_VPN_ERROR_PREFIX "org.freedesktop.NetworkManager.VPN.Error"
43#define NM_DBUS_VPN_STARTING_IN_PROGRESS "StartingInProgress"
44#define NM_DBUS_VPN_ALREADY_STARTED "AlreadyStarted"
45#define NM_DBUS_VPN_STOPPING_IN_PROGRESS "StoppingInProgress"
46#define NM_DBUS_VPN_ALREADY_STOPPED "AlreadyStopped"
47#define NM_DBUS_VPN_WRONG_STATE "WrongState"
48#define NM_DBUS_VPN_BAD_ARGUMENTS "BadArguments"
49#define NM_DBUS_VPN_INTERACTIVE_NOT_SUPPORTED "InteractiveNotSupported"
50
51/*
52 * VPN daemon signals
53 */
54#define NM_DBUS_VPN_SIGNAL_LOGIN_BANNER "LoginBanner"
55#define NM_DBUS_VPN_SIGNAL_LOGIN_FAILED "LoginFailed"
56#define NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED "LaunchFailed"
57#define NM_DBUS_VPN_SIGNAL_CONNECT_FAILED "ConnectFailed"
58#define NM_DBUS_VPN_SIGNAL_VPN_CONFIG_BAD "VPNConfigBad"
59#define NM_DBUS_VPN_SIGNAL_IP_CONFIG_BAD "IPConfigBad"
60#define NM_DBUS_VPN_SIGNAL_STATE_CHANGE "StateChange"
61#define NM_DBUS_VPN_SIGNAL_IP4_CONFIG "IP4Config"
62
63/**
64 * NMVpnServiceState:
65 * @NM_VPN_SERVICE_STATE_UNKNOWN: The state of the VPN plugin is unknown.
66 * @NM_VPN_SERVICE_STATE_INIT: The VPN plugin is initialized.
67 * @NM_VPN_SERVICE_STATE_SHUTDOWN: Not used.
68 * @NM_VPN_SERVICE_STATE_STARTING: The plugin is attempting to connect to a VPN server.
69 * @NM_VPN_SERVICE_STATE_STARTED: The plugin has connected to a VPN server.
70 * @NM_VPN_SERVICE_STATE_STOPPING: The plugin is disconnecting from the VPN server.
71 * @NM_VPN_SERVICE_STATE_STOPPED: The plugin has disconnected from the VPN server.
72 *
73 * VPN daemon states
74 */
75typedef enum {
76 NM_VPN_SERVICE_STATE_UNKNOWN = 0,
77 NM_VPN_SERVICE_STATE_INIT,
78 NM_VPN_SERVICE_STATE_SHUTDOWN,
79 NM_VPN_SERVICE_STATE_STARTING,
80 NM_VPN_SERVICE_STATE_STARTED,
81 NM_VPN_SERVICE_STATE_STOPPING,
82 NM_VPN_SERVICE_STATE_STOPPED
83} NMVpnServiceState;
84
85/**
86 * NMVpnConnectionState:
87 * @NM_VPN_CONNECTION_STATE_UNKNOWN: The state of the VPN connection is
88 * unknown.
89 * @NM_VPN_CONNECTION_STATE_PREPARE: The VPN connection is preparing to
90 * connect.
91 * @NM_VPN_CONNECTION_STATE_NEED_AUTH: The VPN connection needs authorization
92 * credentials.
93 * @NM_VPN_CONNECTION_STATE_CONNECT: The VPN connection is being established.
94 * @NM_VPN_CONNECTION_STATE_IP_CONFIG_GET: The VPN connection is getting an IP
95 * address.
96 * @NM_VPN_CONNECTION_STATE_ACTIVATED: The VPN connection is active.
97 * @NM_VPN_CONNECTION_STATE_FAILED: The VPN connection failed.
98 * @NM_VPN_CONNECTION_STATE_DISCONNECTED: The VPN connection is disconnected.
99 *
100 * VPN connection states
101 */
102typedef enum {
103 NM_VPN_CONNECTION_STATE_UNKNOWN = 0,
104 NM_VPN_CONNECTION_STATE_PREPARE,
105 NM_VPN_CONNECTION_STATE_NEED_AUTH,
106 NM_VPN_CONNECTION_STATE_CONNECT,
107 NM_VPN_CONNECTION_STATE_IP_CONFIG_GET,
108 NM_VPN_CONNECTION_STATE_ACTIVATED,
109 NM_VPN_CONNECTION_STATE_FAILED,
110 NM_VPN_CONNECTION_STATE_DISCONNECTED
111} NMVpnConnectionState;
112
113/**
114 * NMVpnConnectionStateReason:
115 * @NM_VPN_CONNECTION_STATE_REASON_UNKNOWN: The reason for the VPN connection
116 * state change is unknown.
117 * @NM_VPN_CONNECTION_STATE_REASON_NONE: No reason was given for the VPN
118 * connection state change.
119 * @NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED: The VPN connection changed
120 * state because the user disconnected it.
121 * @NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED: The VPN connection
122 * changed state because the device it was using was disconnected.
123 * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED: The service providing the
124 * VPN connection was stopped.
125 * @NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID: The IP config of the VPN
126 * connection was invalid.
127 * @NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT: The connection attempt to
128 * the VPN service timed out.
129 * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT: A timeout occurred
130 * while starting the service providing the VPN connection.
131 * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED: Starting the service
132 * starting the service providing the VPN connection failed.
133 * @NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS: Necessary secrets for the VPN
134 * connection were not provided.
135 * @NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED: Authentication to the VPN
136 * server failed.
137 * @NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED: The connection was
138 * deleted from settings.
139 *
140 * VPN connection state reasons
141 */
142NM_DEPRECATED_IN_1_8_FOR(NMActiveConnectionStateReason)
143typedef enum {
144 NM_VPN_CONNECTION_STATE_REASON_UNKNOWN = 0,
145 NM_VPN_CONNECTION_STATE_REASON_NONE = 1,
146 NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED = 2,
147 NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED = 3,
148 NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED = 4,
149 NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID = 5,
150 NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT = 6,
151 NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT = 7,
152 NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED = 8,
153 NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS = 9,
154 NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED = 10,
155 NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED = 11,
156} NMVpnConnectionStateReason;
157
158/**
159 * NMVpnPluginFailure:
160 * @NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED: Login failed.
161 * @NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED: Connect failed.
162 * @NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG: Invalid IP configuration returned from
163 * the VPN plugin.
164 *
165 * VPN plugin failure reasons
166 */
167typedef enum {
168 NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED,
169 NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED,
170 NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG
171} NMVpnPluginFailure;
172
173#ifndef NM_VERSION_H
174#undef NM_DEPRECATED_IN_1_8_FOR
175#endif
176
177/*** Generic config ***/
178
179/* string: VPN interface name (tun0, tap0, etc) */
180#define NM_VPN_PLUGIN_CONFIG_TUNDEV "tundev"
181
182/* string: Proxy PAC */
183#define NM_VPN_PLUGIN_CONFIG_PROXY_PAC "pac"
184
185/* string: Login message */
186#define NM_VPN_PLUGIN_CONFIG_BANNER "banner"
187
188/* uint32 / array of uint8: IP address of the public external VPN gateway (network byte order) */
189#define NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY "gateway"
190
191/* uint32: Maximum Transfer Unit that the VPN interface should use */
192#define NM_VPN_PLUGIN_CONFIG_MTU "mtu"
193
194/* boolean: Has IP4 configuration? */
195#define NM_VPN_PLUGIN_CONFIG_HAS_IP4 "has-ip4"
196
197/* boolean: Has IP6 configuration? */
198#define NM_VPN_PLUGIN_CONFIG_HAS_IP6 "has-ip6"
199
200/* boolean: If %TRUE the VPN plugin can persist/reconnect the connection over
201 * link changes and VPN server dropouts.
202 */
203#define NM_VPN_PLUGIN_CAN_PERSIST "can-persist"
204
205/*** Ip4Config ***/
206
207/* uint32: IP address of the internal gateway of the subnet the VPN interface is
208 * on, if the VPN uses subnet configuration (network byte order)
209 */
210#define NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY "internal-gateway"
211
212/* uint32: internal IP address of the local VPN interface (network byte order) */
213#define NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS "address"
214
215/* uint32: IP address of the other side of Point-to-Point connection if the VPN
216 * uses Point-to-Point configuration. (network byte order)
217 */
218#define NM_VPN_PLUGIN_IP4_CONFIG_PTP "ptp"
219
220/* uint32: IP prefix of the VPN interface; 1 - 32 inclusive */
221#define NM_VPN_PLUGIN_IP4_CONFIG_PREFIX "prefix"
222
223/* array of uint32: IP addresses of DNS servers for the VPN (network byte order) */
224#define NM_VPN_PLUGIN_IP4_CONFIG_DNS "dns"
225
226/* array of uint32: IP addresses of NBNS/WINS servers for the VPN (network byte order) */
227#define NM_VPN_PLUGIN_IP4_CONFIG_NBNS "nbns"
228
229/* uint32: Message Segment Size that the VPN interface should use */
230#define NM_VPN_PLUGIN_IP4_CONFIG_MSS "mss"
231
232/* string: DNS domain name */
233#define NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN "domain"
234
235/* array of strings: DNS domain names */
236#define NM_VPN_PLUGIN_IP4_CONFIG_DOMAINS "domains"
237
238/* [ip4 routes]: custom routes the client should apply, in the format used
239 * by nm_utils_ip4_routes_to/from_gvalue
240 */
241#define NM_VPN_PLUGIN_IP4_CONFIG_ROUTES "routes"
242
243/* whether the previous IP4 routing configuration should be preserved. */
244#define NM_VPN_PLUGIN_IP4_CONFIG_PRESERVE_ROUTES "preserve-routes"
245
246/* boolean: prevent this VPN connection from ever getting the default route */
247#define NM_VPN_PLUGIN_IP4_CONFIG_NEVER_DEFAULT "never-default"
248
249/* Deprecated */
250#define NM_VPN_PLUGIN_IP4_CONFIG_GATEWAY NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY
251
252/* Legacy IP4 items; these are included in the IP4 config by older plugins,
253 * but in the generic config by newer plugins.
254 */
255
256#define NM_VPN_PLUGIN_IP4_CONFIG_BANNER NM_VPN_PLUGIN_CONFIG_BANNER
257#define NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY
258#define NM_VPN_PLUGIN_IP4_CONFIG_MTU NM_VPN_PLUGIN_CONFIG_MTU
259#define NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV NM_VPN_PLUGIN_CONFIG_TUNDEV
260
261/*** Ip6Config ***/
262
263/* array of uint8: IP address of the internal gateway of the subnet the VPN interface is
264 * on, if the VPN uses subnet configuration (network byte order)
265 */
266#define NM_VPN_PLUGIN_IP6_CONFIG_INT_GATEWAY "internal-gateway"
267
268/* array of uint8: internal IP address of the local VPN interface (network byte order) */
269#define NM_VPN_PLUGIN_IP6_CONFIG_ADDRESS "address"
270
271/* array of uint8: IP address of the other side of Point-to-Point connection if the VPN
272 * uses Point-to-Point configuration. (network byte order)
273 */
274#define NM_VPN_PLUGIN_IP6_CONFIG_PTP "ptp"
275
276/* uint32: prefix length of the VPN interface; 1 - 128 inclusive */
277#define NM_VPN_PLUGIN_IP6_CONFIG_PREFIX "prefix"
278
279/* array of array of uint8: IP addresses of DNS servers for the VPN (network byte order) */
280#define NM_VPN_PLUGIN_IP6_CONFIG_DNS "dns"
281
282/* uint32: Message Segment Size that the VPN interface should use */
283#define NM_VPN_PLUGIN_IP6_CONFIG_MSS "mss"
284
285/* string: DNS domain name */
286#define NM_VPN_PLUGIN_IP6_CONFIG_DOMAIN "domain"
287
288/* array of strings: DNS domain names */
289#define NM_VPN_PLUGIN_IP6_CONFIG_DOMAINS "domains"
290
291/* [ip6 routes]: custom routes the client should apply, in the format used
292 * by nm_utils_ip6_routes_to/from_gvalue
293 */
294#define NM_VPN_PLUGIN_IP6_CONFIG_ROUTES "routes"
295
296/* whether the previous IP6 routing configuration should be preserved. */
297#define NM_VPN_PLUGIN_IP6_CONFIG_PRESERVE_ROUTES "preserve-routes"
298
299/* boolean: prevent this VPN connection from ever getting the default route */
300#define NM_VPN_PLUGIN_IP6_CONFIG_NEVER_DEFAULT "never-default"
301
302#endif /* __NM_VPN_DBUS_INTERFACE_H__ */
303

source code of include/libnm/nm-vpn-dbus-interface.h