1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License along
14 * with this program; if not, write to the Free Software Foundation, Inc.,
15 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17 * Copyright 2004 Red Hat, Inc.
20 /* D-Bus-related definitions for NetworkManager VPN plugins.
22 * Note that although this header is installed as part of libnm-util, it is also
23 * used by some external code that does not link to libnm-util.
26 #ifndef NETWORK_MANAGER_VPN_H
27 #define NETWORK_MANAGER_VPN_H
30 * dbus services details
32 #define NM_DBUS_PATH_VPN "/org/freedesktop/NetworkManager/VPN/Manager"
33 #define NM_DBUS_INTERFACE_VPN "org.freedesktop.NetworkManager.VPN.Manager"
35 #define NM_DBUS_PATH_VPN_CONNECTION "/org/freedesktop/NetworkManager/VPN/Connection"
36 #define NM_DBUS_INTERFACE_VPN_CONNECTION "org.freedesktop.NetworkManager.VPN.Connection"
38 #define NM_VPN_DBUS_PLUGIN_PATH "/org/freedesktop/NetworkManager/VPN/Plugin"
39 #define NM_VPN_DBUS_PLUGIN_INTERFACE "org.freedesktop.NetworkManager.VPN.Plugin"
44 #define NM_DBUS_NO_ACTIVE_VPN_CONNECTION "org.freedesktop.NetworkManager.VPNConnections.NoActiveVPNConnection"
45 #define NM_DBUS_NO_VPN_CONNECTIONS "org.freedesktop.NetworkManager.VPNConnections.NoVPNConnections"
46 #define NM_DBUS_INVALID_VPN_CONNECTION "org.freedesktop.NetworkManager.VPNConnections.InvalidVPNConnection"
48 #define NM_DBUS_VPN_ERROR_PREFIX "org.freedesktop.NetworkManager.VPN.Error"
49 #define NM_DBUS_VPN_STARTING_IN_PROGRESS "StartingInProgress"
50 #define NM_DBUS_VPN_ALREADY_STARTED "AlreadyStarted"
51 #define NM_DBUS_VPN_STOPPING_IN_PROGRESS "StoppingInProgress"
52 #define NM_DBUS_VPN_ALREADY_STOPPED "AlreadyStopped"
53 #define NM_DBUS_VPN_WRONG_STATE "WrongState"
54 #define NM_DBUS_VPN_BAD_ARGUMENTS "BadArguments"
55 #define NM_DBUS_VPN_INTERACTIVE_NOT_SUPPORTED "InteractiveNotSupported"
61 #define NM_DBUS_VPN_SIGNAL_LOGIN_BANNER "LoginBanner"
62 #define NM_DBUS_VPN_SIGNAL_LOGIN_FAILED "LoginFailed"
63 #define NM_DBUS_VPN_SIGNAL_LAUNCH_FAILED "LaunchFailed"
64 #define NM_DBUS_VPN_SIGNAL_CONNECT_FAILED "ConnectFailed"
65 #define NM_DBUS_VPN_SIGNAL_VPN_CONFIG_BAD "VPNConfigBad"
66 #define NM_DBUS_VPN_SIGNAL_IP_CONFIG_BAD "IPConfigBad"
67 #define NM_DBUS_VPN_SIGNAL_STATE_CHANGE "StateChange"
68 #define NM_DBUS_VPN_SIGNAL_IP4_CONFIG "IP4Config"
72 * @NM_VPN_SERVICE_STATE_UNKNOWN: The state of the VPN plugin is unknown.
73 * @NM_VPN_SERVICE_STATE_INIT: The VPN plugin is initialized.
74 * @NM_VPN_SERVICE_STATE_SHUTDOWN: Not used.
75 * @NM_VPN_SERVICE_STATE_STARTING: The plugin is attempting to connect to a VPN server.
76 * @NM_VPN_SERVICE_STATE_STARTED: The plugin has connected to a VPN server.
77 * @NM_VPN_SERVICE_STATE_STOPPING: The plugin is disconnecting from the VPN server.
78 * @NM_VPN_SERVICE_STATE_STOPPED: The plugin has disconnected from the VPN server.
82 * (Corresponds to the NM_VPN_SERVICE_STATE type in nm-vpn-connection.xml.)
84 typedef enum NMVPNServiceState {
85 NM_VPN_SERVICE_STATE_UNKNOWN = 0,
86 NM_VPN_SERVICE_STATE_INIT,
87 NM_VPN_SERVICE_STATE_SHUTDOWN,
88 NM_VPN_SERVICE_STATE_STARTING,
89 NM_VPN_SERVICE_STATE_STARTED,
90 NM_VPN_SERVICE_STATE_STOPPING,
91 NM_VPN_SERVICE_STATE_STOPPED
96 * NMVPNConnectionState:
97 * @NM_VPN_CONNECTION_STATE_UNKNOWN: The state of the VPN connection is
99 * @NM_VPN_CONNECTION_STATE_PREPARE: The VPN connection is preparing to
101 * @NM_VPN_CONNECTION_STATE_NEED_AUTH: The VPN connection needs authorization
103 * @NM_VPN_CONNECTION_STATE_CONNECT: The VPN connection is being established.
104 * @NM_VPN_CONNECTION_STATE_IP_CONFIG_GET: The VPN connection is getting an IP
106 * @NM_VPN_CONNECTION_STATE_ACTIVATED: The VPN connection is active.
107 * @NM_VPN_CONNECTION_STATE_FAILED: The VPN connection failed.
108 * @NM_VPN_CONNECTION_STATE_DISCONNECTED: The VPN connection is disconnected.
110 * VPN connection states
112 * (Corresponds to the NM_VPN_CONNECTION_STATE type in nm-vpn-connection.xml.)
114 typedef enum NMVPNConnectionState {
115 NM_VPN_CONNECTION_STATE_UNKNOWN = 0,
116 NM_VPN_CONNECTION_STATE_PREPARE,
117 NM_VPN_CONNECTION_STATE_NEED_AUTH,
118 NM_VPN_CONNECTION_STATE_CONNECT,
119 NM_VPN_CONNECTION_STATE_IP_CONFIG_GET,
120 NM_VPN_CONNECTION_STATE_ACTIVATED,
121 NM_VPN_CONNECTION_STATE_FAILED,
122 NM_VPN_CONNECTION_STATE_DISCONNECTED
123 } NMVPNConnectionState;
126 * NMVPNConnectionStateReason:
127 * @NM_VPN_CONNECTION_STATE_REASON_UNKNOWN: The reason for the VPN connection
128 * state change is unknown.
129 * @NM_VPN_CONNECTION_STATE_REASON_NONE: No reason was given for the VPN
130 * connection state change.
131 * @NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED: The VPN connection changed
132 * state because the user disconnected it.
133 * @NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED: The VPN connection
134 * changed state because the device it was using was disconnected.
135 * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED: The service providing the
136 * VPN connection was stopped.
137 * @NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID: The IP config of the VPN
138 * connection was invalid.
139 * @NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT: The connection attempt to
140 * the VPN service timed out.
141 * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT: A timeout occurred
142 * while starting the service providing the VPN connection.
143 * @NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED: Starting the service
144 * starting the service providing the VPN connection failed.
145 * @NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS: Necessary secrets for the VPN
146 * connection were not provided.
147 * @NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED: Authentication to the VPN
149 * @NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED: The connection was
150 * deleted from settings.
152 * VPN connection state reasons
154 * (Corresponds to the NM_VPN_CONNECTION_STATE_REASON type in nm-vpn-connection.xml.)
156 typedef enum NMVPNConnectionStateReason {
157 NM_VPN_CONNECTION_STATE_REASON_UNKNOWN = 0,
158 NM_VPN_CONNECTION_STATE_REASON_NONE,
159 NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED,
160 NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED,
161 NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED,
162 NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID,
163 NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT,
164 NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT,
165 NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED,
166 NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS,
167 NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED,
168 NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED
169 } NMVPNConnectionStateReason;
172 * NMVPNPluginFailure:
173 * @NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED: Login failed.
174 * @NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED: Connect failed.
175 * @NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG: Invalid IP configuration returned from
178 * VPN plugin failure reasons
180 * (Corresponds to the NM_VPN_PLUGIN_FAILURE type in nm-vpn-plugin.xml.)
183 NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED,
184 NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED,
185 NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG
186 } NMVPNPluginFailure;
189 /*** Generic config ***/
191 /* string: VPN interface name (tun0, tap0, etc) */
192 #define NM_VPN_PLUGIN_CONFIG_TUNDEV "tundev"
194 /* string: Login message */
195 #define NM_VPN_PLUGIN_CONFIG_BANNER "banner"
197 /* uint32 / array of uint8: IP address of the public external VPN gateway (network byte order) */
198 #define NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY "gateway"
200 /* uint32: Maximum Transfer Unit that the VPN interface should use */
201 #define NM_VPN_PLUGIN_CONFIG_MTU "mtu"
203 /* boolean: Has IP4 configuration? */
204 #define NM_VPN_PLUGIN_CONFIG_HAS_IP4 "has-ip4"
206 /* boolean: Has IP6 configuration? */
207 #define NM_VPN_PLUGIN_CONFIG_HAS_IP6 "has-ip6"
209 /* boolean: If %TRUE the VPN plugin can persist/reconnect the connection over
210 * link changes and VPN server dropouts.
212 #define NM_VPN_PLUGIN_CAN_PERSIST "can-persist"
217 /* uint32: IP address of the internal gateway of the subnet the VPN interface is
218 * on, if the VPN uses subnet configuration (network byte order)
220 #define NM_VPN_PLUGIN_IP4_CONFIG_INT_GATEWAY "internal-gateway"
222 /* uint32: internal IP address of the local VPN interface (network byte order) */
223 #define NM_VPN_PLUGIN_IP4_CONFIG_ADDRESS "address"
225 /* uint32: IP address of the other side of Point-to-Point connection if the VPN
226 * uses Point-to-Point configuration. (network byte order)
228 #define NM_VPN_PLUGIN_IP4_CONFIG_PTP "ptp"
230 /* uint32: IP prefix of the VPN interface; 1 - 32 inclusive */
231 #define NM_VPN_PLUGIN_IP4_CONFIG_PREFIX "prefix"
233 /* array of uint32: IP addresses of DNS servers for the VPN (network byte order) */
234 #define NM_VPN_PLUGIN_IP4_CONFIG_DNS "dns"
236 /* array of uint32: IP addresses of NBNS/WINS servers for the VPN (network byte order) */
237 #define NM_VPN_PLUGIN_IP4_CONFIG_NBNS "nbns"
239 /* uint32: Message Segment Size that the VPN interface should use */
240 #define NM_VPN_PLUGIN_IP4_CONFIG_MSS "mss"
242 /* string: DNS domain name */
243 #define NM_VPN_PLUGIN_IP4_CONFIG_DOMAIN "domain"
245 /* array of strings: DNS domain names */
246 #define NM_VPN_PLUGIN_IP4_CONFIG_DOMAINS "domains"
248 /* [ip4 routes]: custom routes the client should apply, in the format used
249 * by nm_utils_ip4_routes_to/from_gvalue
251 #define NM_VPN_PLUGIN_IP4_CONFIG_ROUTES "routes"
253 /* boolean: prevent this VPN connection from ever getting the default route */
254 #define NM_VPN_PLUGIN_IP4_CONFIG_NEVER_DEFAULT "never-default"
257 #define NM_VPN_PLUGIN_IP4_CONFIG_GATEWAY NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY
259 /* Legacy IP4 items; these are included in the IP4 config by older plugins,
260 * but in the generic config by newer plugins.
263 #define NM_VPN_PLUGIN_IP4_CONFIG_BANNER NM_VPN_PLUGIN_CONFIG_BANNER
264 #define NM_VPN_PLUGIN_IP4_CONFIG_EXT_GATEWAY NM_VPN_PLUGIN_CONFIG_EXT_GATEWAY
265 #define NM_VPN_PLUGIN_IP4_CONFIG_MTU NM_VPN_PLUGIN_CONFIG_MTU
266 #define NM_VPN_PLUGIN_IP4_CONFIG_TUNDEV NM_VPN_PLUGIN_CONFIG_TUNDEV
271 /* array of uint8: IP address of the internal gateway of the subnet the VPN interface is
272 * on, if the VPN uses subnet configuration (network byte order)
274 #define NM_VPN_PLUGIN_IP6_CONFIG_INT_GATEWAY "internal-gateway"
276 /* array of uint8: internal IP address of the local VPN interface (network byte order) */
277 #define NM_VPN_PLUGIN_IP6_CONFIG_ADDRESS "address"
279 /* array of uint8: IP address of the other side of Point-to-Point connection if the VPN
280 * uses Point-to-Point configuration. (network byte order)
282 #define NM_VPN_PLUGIN_IP6_CONFIG_PTP "ptp"
284 /* uint32: prefix length of the VPN interface; 1 - 128 inclusive */
285 #define NM_VPN_PLUGIN_IP6_CONFIG_PREFIX "prefix"
287 /* array of array of uint8: IP addresses of DNS servers for the VPN (network byte order) */
288 #define NM_VPN_PLUGIN_IP6_CONFIG_DNS "dns"
290 /* uint32: Message Segment Size that the VPN interface should use */
291 #define NM_VPN_PLUGIN_IP6_CONFIG_MSS "mss"
293 /* string: DNS domain name */
294 #define NM_VPN_PLUGIN_IP6_CONFIG_DOMAIN "domain"
296 /* array of strings: DNS domain names */
297 #define NM_VPN_PLUGIN_IP6_CONFIG_DOMAINS "domains"
299 /* [ip6 routes]: custom routes the client should apply, in the format used
300 * by nm_utils_ip6_routes_to/from_gvalue
302 #define NM_VPN_PLUGIN_IP6_CONFIG_ROUTES "routes"
304 /* boolean: prevent this VPN connection from ever getting the default route */
305 #define NM_VPN_PLUGIN_IP6_CONFIG_NEVER_DEFAULT "never-default"
307 #endif /* NETWORK_MANAGER_VPN_H */