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"
61 #define NM_ACTIVE_CONNECTION_PARENT_ACTIVE "parent-active"
63 struct _NMActiveConnection {
64 NMExportedObject parent;
68 NMExportedObjectClass parent;
70 /* re-emits device state changes as a convenience for subclasses for
71 * device states >= DISCONNECTED.
73 void (*device_state_changed) (NMActiveConnection *connection,
75 NMDeviceState new_state,
76 NMDeviceState old_state);
77 void (*master_failed) (NMActiveConnection *connection);
79 void (*device_changed) (NMActiveConnection *connection,
81 NMDevice *old_device);
83 void (*device_metered_changed) (NMActiveConnection *connection,
86 void (*parent_active) (NMActiveConnection *connection);
87 } NMActiveConnectionClass;
89 guint64 nm_active_connection_version_id_get (NMActiveConnection *self);
90 guint64 nm_active_connection_version_id_bump (NMActiveConnection *self);
92 GType nm_active_connection_get_type (void);
94 typedef void (*NMActiveConnectionAuthResultFunc) (NMActiveConnection *self,
96 const char *error_desc,
100 void nm_active_connection_authorize (NMActiveConnection *self,
101 NMConnection *initial_connection,
102 NMActiveConnectionAuthResultFunc result_func,
104 gpointer user_data2);
106 NMSettingsConnection *nm_active_connection_get_settings_connection (NMActiveConnection *self);
107 NMConnection *nm_active_connection_get_applied_connection (NMActiveConnection *self);
109 NMSettingsConnection *_nm_active_connection_get_settings_connection (NMActiveConnection *self);
111 void nm_active_connection_set_settings_connection (NMActiveConnection *self,
112 NMSettingsConnection *connection);
114 gboolean nm_active_connection_has_unmodified_applied_connection (NMActiveConnection *self,
115 NMSettingCompareFlags compare_flags);
117 const char * nm_active_connection_get_settings_connection_id (NMActiveConnection *self);
119 const char * nm_active_connection_get_specific_object (NMActiveConnection *self);
121 void nm_active_connection_set_specific_object (NMActiveConnection *self,
122 const char *specific_object);
124 void nm_active_connection_set_default (NMActiveConnection *self,
125 gboolean is_default);
127 gboolean nm_active_connection_get_default (NMActiveConnection *self);
129 void nm_active_connection_set_default6 (NMActiveConnection *self,
130 gboolean is_default6);
132 gboolean nm_active_connection_get_default6 (NMActiveConnection *self);
134 NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *self);
136 void nm_active_connection_set_state (NMActiveConnection *self,
137 NMActiveConnectionState state);
139 NMDevice * nm_active_connection_get_device (NMActiveConnection *self);
141 gboolean nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device);
143 NMAuthSubject *nm_active_connection_get_subject (NMActiveConnection *self);
145 gboolean nm_active_connection_get_user_requested (NMActiveConnection *self);
147 NMActiveConnection *nm_active_connection_get_master (NMActiveConnection *self);
149 gboolean nm_active_connection_get_master_ready (NMActiveConnection *self);
151 void nm_active_connection_set_master (NMActiveConnection *self,
152 NMActiveConnection *master);
154 void nm_active_connection_set_parent (NMActiveConnection *self,
155 NMActiveConnection *parent);
157 void nm_active_connection_set_assumed (NMActiveConnection *self,
160 gboolean nm_active_connection_get_assumed (NMActiveConnection *self);
162 void nm_active_connection_clear_secrets (NMActiveConnection *self);
164 #endif /* __NETWORKMANAGER_ACTIVE_CONNECTION_H__ */