1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2 /* NetworkManager -- Network link manager
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 * Copyright (C) 2008 - 2012 Red Hat, Inc.
21 #ifndef __NETWORKMANAGER_ACTIVE_CONNECTION_H__
22 #define __NETWORKMANAGER_ACTIVE_CONNECTION_H__
24 #include "nm-exported-object.h"
25 #include "nm-connection.h"
27 #define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type ())
28 #define NM_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnection))
29 #define NM_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
30 #define NM_IS_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ACTIVE_CONNECTION))
31 #define NM_IS_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACTIVE_CONNECTION))
32 #define NM_ACTIVE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
34 /* D-Bus Exported Properties */
35 #define NM_ACTIVE_CONNECTION_CONNECTION "connection"
36 #define NM_ACTIVE_CONNECTION_ID "id"
37 #define NM_ACTIVE_CONNECTION_UUID "uuid"
38 #define NM_ACTIVE_CONNECTION_TYPE "type"
39 #define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object"
40 #define NM_ACTIVE_CONNECTION_DEVICES "devices"
41 #define NM_ACTIVE_CONNECTION_STATE "state"
42 #define NM_ACTIVE_CONNECTION_DEFAULT "default"
43 #define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
44 #define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
45 #define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
46 #define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
47 #define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
48 #define NM_ACTIVE_CONNECTION_VPN "vpn"
49 #define NM_ACTIVE_CONNECTION_MASTER "master"
51 /* Internal non-exported properties */
52 #define NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION "int-settings-connection"
53 #define NM_ACTIVE_CONNECTION_INT_DEVICE "int-device"
54 #define NM_ACTIVE_CONNECTION_INT_SUBJECT "int-subject"
55 #define NM_ACTIVE_CONNECTION_INT_MASTER "int-master"
56 #define NM_ACTIVE_CONNECTION_INT_MASTER_READY "int-master-ready"
59 #define NM_ACTIVE_CONNECTION_DEVICE_CHANGED "device-changed"
60 #define NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED "device-metered-changed"
62 struct _NMActiveConnection {
63 NMExportedObject parent;
67 NMExportedObjectClass parent;
69 /* re-emits device state changes as a convenience for subclasses for
70 * device states >= DISCONNECTED.
72 void (*device_state_changed) (NMActiveConnection *connection,
74 NMDeviceState new_state,
75 NMDeviceState old_state);
76 void (*master_failed) (NMActiveConnection *connection);
78 void (*device_changed) (NMActiveConnection *connection,
80 NMDevice *old_device);
82 void (*device_metered_changed) (NMActiveConnection *connection,
84 } NMActiveConnectionClass;
86 guint64 nm_active_connection_version_id_get (NMActiveConnection *self);
87 guint64 nm_active_connection_version_id_bump (NMActiveConnection *self);
89 GType nm_active_connection_get_type (void);
91 typedef void (*NMActiveConnectionAuthResultFunc) (NMActiveConnection *self,
93 const char *error_desc,
97 void nm_active_connection_authorize (NMActiveConnection *self,
98 NMConnection *initial_connection,
99 NMActiveConnectionAuthResultFunc result_func,
101 gpointer user_data2);
103 NMSettingsConnection *nm_active_connection_get_settings_connection (NMActiveConnection *self);
104 NMConnection *nm_active_connection_get_applied_connection (NMActiveConnection *self);
106 NMSettingsConnection *_nm_active_connection_get_settings_connection (NMActiveConnection *self);
108 void nm_active_connection_set_settings_connection (NMActiveConnection *self,
109 NMSettingsConnection *connection);
111 gboolean nm_active_connection_has_unmodified_applied_connection (NMActiveConnection *self,
112 NMSettingCompareFlags compare_flags);
114 const char * nm_active_connection_get_settings_connection_id (NMActiveConnection *self);
116 const char * nm_active_connection_get_specific_object (NMActiveConnection *self);
118 void nm_active_connection_set_specific_object (NMActiveConnection *self,
119 const char *specific_object);
121 void nm_active_connection_set_default (NMActiveConnection *self,
122 gboolean is_default);
124 gboolean nm_active_connection_get_default (NMActiveConnection *self);
126 void nm_active_connection_set_default6 (NMActiveConnection *self,
127 gboolean is_default6);
129 gboolean nm_active_connection_get_default6 (NMActiveConnection *self);
131 NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *self);
133 void nm_active_connection_set_state (NMActiveConnection *self,
134 NMActiveConnectionState state);
136 NMDevice * nm_active_connection_get_device (NMActiveConnection *self);
138 gboolean nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device);
140 NMAuthSubject *nm_active_connection_get_subject (NMActiveConnection *self);
142 gboolean nm_active_connection_get_user_requested (NMActiveConnection *self);
144 NMActiveConnection *nm_active_connection_get_master (NMActiveConnection *self);
146 gboolean nm_active_connection_get_master_ready (NMActiveConnection *self);
148 void nm_active_connection_set_master (NMActiveConnection *self,
149 NMActiveConnection *master);
151 void nm_active_connection_set_assumed (NMActiveConnection *self,
154 gboolean nm_active_connection_get_assumed (NMActiveConnection *self);
156 void nm_active_connection_clear_secrets (NMActiveConnection *self);
158 #endif /* __NETWORKMANAGER_ACTIVE_CONNECTION_H__ */