2008-11-03 04:13:42 +00:00
|
|
|
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
|
2008-03-26 13:43:01 +00:00
|
|
|
/* NetworkManager -- Network link manager
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
* (at your option) any later version.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
2008-06-26 18:31:52 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
2008-03-26 13:43:01 +00:00
|
|
|
*
|
2012-02-03 14:53:09 -06:00
|
|
|
* Copyright (C) 2008 - 2012 Red Hat, Inc.
|
2008-03-26 13:43:01 +00:00
|
|
|
*/
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#ifndef __NETWORKMANAGER_ACTIVE_CONNECTION_H__
|
|
|
|
|
#define __NETWORKMANAGER_ACTIVE_CONNECTION_H__
|
2008-03-26 13:43:01 +00:00
|
|
|
|
2015-04-13 13:31:42 -04:00
|
|
|
#include "nm-exported-object.h"
|
2008-03-26 13:43:01 +00:00
|
|
|
#include "nm-connection.h"
|
|
|
|
|
|
2017-11-23 21:30:09 +01:00
|
|
|
#include "nm-utils/c-list.h"
|
|
|
|
|
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_TYPE_ACTIVE_CONNECTION (nm_active_connection_get_type ())
|
|
|
|
|
#define NM_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnection))
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
|
|
|
|
|
#define NM_IS_ACTIVE_CONNECTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_ACTIVE_CONNECTION))
|
2012-07-27 13:15:54 +02:00
|
|
|
#define NM_IS_ACTIVE_CONNECTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_ACTIVE_CONNECTION))
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_ACTIVE_CONNECTION, NMActiveConnectionClass))
|
|
|
|
|
|
2012-08-22 09:38:01 -05:00
|
|
|
/* D-Bus Exported Properties */
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_CONNECTION "connection"
|
2014-03-03 15:01:36 +01:00
|
|
|
#define NM_ACTIVE_CONNECTION_ID "id"
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_UUID "uuid"
|
2014-03-03 15:01:36 +01:00
|
|
|
#define NM_ACTIVE_CONNECTION_TYPE "type"
|
2008-03-26 13:43:01 +00:00
|
|
|
#define NM_ACTIVE_CONNECTION_SPECIFIC_OBJECT "specific-object"
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_DEVICES "devices"
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_STATE "state"
|
2017-09-25 19:06:02 +02:00
|
|
|
#define NM_ACTIVE_CONNECTION_STATE_FLAGS "state-flags"
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_DEFAULT "default"
|
2013-12-18 08:46:43 -05:00
|
|
|
#define NM_ACTIVE_CONNECTION_IP4_CONFIG "ip4-config"
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_DHCP4_CONFIG "dhcp4-config"
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_DEFAULT6 "default6"
|
2013-12-18 08:46:43 -05:00
|
|
|
#define NM_ACTIVE_CONNECTION_IP6_CONFIG "ip6-config"
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_DHCP6_CONFIG "dhcp6-config"
|
2012-02-03 14:53:09 -06:00
|
|
|
#define NM_ACTIVE_CONNECTION_VPN "vpn"
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_MASTER "master"
|
|
|
|
|
|
2013-09-16 17:43:31 -05:00
|
|
|
/* Internal non-exported properties */
|
2015-07-14 16:53:24 +02:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_SETTINGS_CONNECTION "int-settings-connection"
|
2016-09-07 17:47:26 +02:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_APPLIED_CONNECTION "int-applied-connection"
|
2012-08-22 09:38:01 -05:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_DEVICE "int-device"
|
2013-07-29 13:11:47 -05:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_SUBJECT "int-subject"
|
2012-08-22 09:38:01 -05:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_MASTER "int-master"
|
2013-09-27 17:13:43 -05:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_MASTER_READY "int-master-ready"
|
2017-03-07 11:04:36 +01:00
|
|
|
#define NM_ACTIVE_CONNECTION_INT_ACTIVATION_TYPE "int-activation-type"
|
2012-08-22 09:38:01 -05:00
|
|
|
|
2017-03-05 15:30:24 +01:00
|
|
|
/* Signals */
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_STATE_CHANGED "state-changed"
|
|
|
|
|
|
2014-10-23 17:04:49 -05:00
|
|
|
/* Internal signals*/
|
2015-06-03 09:15:24 +02:00
|
|
|
#define NM_ACTIVE_CONNECTION_DEVICE_CHANGED "device-changed"
|
|
|
|
|
#define NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED "device-metered-changed"
|
2016-03-23 14:47:02 +01:00
|
|
|
#define NM_ACTIVE_CONNECTION_PARENT_ACTIVE "parent-active"
|
2014-10-23 17:04:49 -05:00
|
|
|
|
2016-09-28 15:58:24 +02:00
|
|
|
struct _NMActiveConnectionPrivate;
|
|
|
|
|
|
2014-07-17 17:06:44 -04:00
|
|
|
struct _NMActiveConnection {
|
2015-04-13 13:31:42 -04:00
|
|
|
NMExportedObject parent;
|
2016-09-28 15:58:24 +02:00
|
|
|
struct _NMActiveConnectionPrivate *_priv;
|
2017-11-23 21:30:09 +01:00
|
|
|
|
|
|
|
|
/* active connection can be tracked in a list by NMManager. This is
|
|
|
|
|
* the list node. */
|
|
|
|
|
CList active_connections_lst;
|
2014-07-17 17:06:44 -04:00
|
|
|
};
|
2012-02-03 14:53:09 -06:00
|
|
|
|
|
|
|
|
typedef struct {
|
2015-04-13 13:31:42 -04:00
|
|
|
NMExportedObjectClass parent;
|
2013-08-28 09:08:43 -05:00
|
|
|
|
2013-09-27 14:40:18 -05:00
|
|
|
/* re-emits device state changes as a convenience for subclasses for
|
|
|
|
|
* device states >= DISCONNECTED.
|
|
|
|
|
*/
|
|
|
|
|
void (*device_state_changed) (NMActiveConnection *connection,
|
|
|
|
|
NMDevice *device,
|
|
|
|
|
NMDeviceState new_state,
|
|
|
|
|
NMDeviceState old_state);
|
|
|
|
|
void (*master_failed) (NMActiveConnection *connection);
|
2014-10-23 17:04:49 -05:00
|
|
|
|
|
|
|
|
void (*device_changed) (NMActiveConnection *connection,
|
|
|
|
|
NMDevice *new_device,
|
|
|
|
|
NMDevice *old_device);
|
2015-06-03 09:15:24 +02:00
|
|
|
|
|
|
|
|
void (*device_metered_changed) (NMActiveConnection *connection,
|
|
|
|
|
NMMetered new_value);
|
2016-03-23 14:47:02 +01:00
|
|
|
|
|
|
|
|
void (*parent_active) (NMActiveConnection *connection);
|
2012-02-03 14:53:09 -06:00
|
|
|
} NMActiveConnectionClass;
|
|
|
|
|
|
2016-02-11 08:36:39 +01:00
|
|
|
guint64 nm_active_connection_version_id_get (NMActiveConnection *self);
|
|
|
|
|
guint64 nm_active_connection_version_id_bump (NMActiveConnection *self);
|
|
|
|
|
|
2012-02-03 14:53:09 -06:00
|
|
|
GType nm_active_connection_get_type (void);
|
|
|
|
|
|
2012-09-17 10:53:41 -05:00
|
|
|
typedef void (*NMActiveConnectionAuthResultFunc) (NMActiveConnection *self,
|
|
|
|
|
gboolean success,
|
|
|
|
|
const char *error_desc,
|
|
|
|
|
gpointer user_data1,
|
|
|
|
|
gpointer user_data2);
|
|
|
|
|
|
|
|
|
|
void nm_active_connection_authorize (NMActiveConnection *self,
|
2015-07-14 16:53:24 +02:00
|
|
|
NMConnection *initial_connection,
|
2012-09-17 10:53:41 -05:00
|
|
|
NMActiveConnectionAuthResultFunc result_func,
|
|
|
|
|
gpointer user_data1,
|
|
|
|
|
gpointer user_data2);
|
|
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
NMSettingsConnection *nm_active_connection_get_settings_connection (NMActiveConnection *self);
|
|
|
|
|
NMConnection *nm_active_connection_get_applied_connection (NMActiveConnection *self);
|
2012-09-17 10:53:41 -05:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
NMSettingsConnection *_nm_active_connection_get_settings_connection (NMActiveConnection *self);
|
2013-08-28 11:43:50 -05:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
void nm_active_connection_set_settings_connection (NMActiveConnection *self,
|
|
|
|
|
NMSettingsConnection *connection);
|
2012-02-03 14:53:09 -06:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
gboolean nm_active_connection_has_unmodified_applied_connection (NMActiveConnection *self,
|
|
|
|
|
NMSettingCompareFlags compare_flags);
|
2014-03-03 15:01:36 +01:00
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
const char * nm_active_connection_get_settings_connection_id (NMActiveConnection *self);
|
2014-03-03 15:01:36 +01:00
|
|
|
|
2012-02-03 14:53:09 -06:00
|
|
|
const char * nm_active_connection_get_specific_object (NMActiveConnection *self);
|
|
|
|
|
|
|
|
|
|
void nm_active_connection_set_specific_object (NMActiveConnection *self,
|
|
|
|
|
const char *specific_object);
|
|
|
|
|
|
|
|
|
|
void nm_active_connection_set_default (NMActiveConnection *self,
|
2017-11-23 21:53:04 +01:00
|
|
|
int addr_family,
|
2012-02-03 14:53:09 -06:00
|
|
|
gboolean is_default);
|
|
|
|
|
|
2017-11-23 21:53:04 +01:00
|
|
|
gboolean nm_active_connection_get_default (NMActiveConnection *self, int addr_family);
|
2012-02-03 14:53:09 -06:00
|
|
|
|
2012-02-26 17:38:41 -06:00
|
|
|
NMActiveConnectionState nm_active_connection_get_state (NMActiveConnection *self);
|
|
|
|
|
|
2012-02-03 14:53:09 -06:00
|
|
|
void nm_active_connection_set_state (NMActiveConnection *self,
|
2017-03-05 15:30:24 +01:00
|
|
|
NMActiveConnectionState state,
|
|
|
|
|
NMActiveConnectionStateReason reason);
|
2008-03-26 13:43:01 +00:00
|
|
|
|
2017-09-25 19:06:02 +02:00
|
|
|
NMActivationStateFlags nm_active_connection_get_state_flags (NMActiveConnection *self);
|
|
|
|
|
|
|
|
|
|
void nm_active_connection_set_state_flags_full (NMActiveConnection *self,
|
|
|
|
|
NMActivationStateFlags state_flags,
|
|
|
|
|
NMActivationStateFlags mask);
|
|
|
|
|
|
|
|
|
|
static inline void
|
|
|
|
|
nm_active_connection_set_state_flags (NMActiveConnection *self,
|
|
|
|
|
NMActivationStateFlags state_flags)
|
|
|
|
|
{
|
|
|
|
|
nm_active_connection_set_state_flags_full (self, state_flags, state_flags);
|
|
|
|
|
}
|
|
|
|
|
|
2012-08-22 09:38:01 -05:00
|
|
|
NMDevice * nm_active_connection_get_device (NMActiveConnection *self);
|
|
|
|
|
|
2013-09-16 17:43:31 -05:00
|
|
|
gboolean nm_active_connection_set_device (NMActiveConnection *self, NMDevice *device);
|
|
|
|
|
|
2013-07-29 13:11:47 -05:00
|
|
|
NMAuthSubject *nm_active_connection_get_subject (NMActiveConnection *self);
|
|
|
|
|
|
2012-08-22 09:38:01 -05:00
|
|
|
gboolean nm_active_connection_get_user_requested (NMActiveConnection *self);
|
|
|
|
|
|
2013-08-27 12:16:57 -05:00
|
|
|
NMActiveConnection *nm_active_connection_get_master (NMActiveConnection *self);
|
2012-08-22 09:38:01 -05:00
|
|
|
|
2013-09-27 17:13:43 -05:00
|
|
|
gboolean nm_active_connection_get_master_ready (NMActiveConnection *self);
|
|
|
|
|
|
2013-08-27 12:16:57 -05:00
|
|
|
void nm_active_connection_set_master (NMActiveConnection *self,
|
|
|
|
|
NMActiveConnection *master);
|
2013-07-29 16:26:09 -05:00
|
|
|
|
2016-03-23 14:47:02 +01:00
|
|
|
void nm_active_connection_set_parent (NMActiveConnection *self,
|
|
|
|
|
NMActiveConnection *parent);
|
|
|
|
|
|
2017-03-07 11:04:36 +01:00
|
|
|
NMActivationType nm_active_connection_get_activation_type (NMActiveConnection *self);
|
|
|
|
|
|
2015-07-14 16:53:24 +02:00
|
|
|
void nm_active_connection_clear_secrets (NMActiveConnection *self);
|
|
|
|
|
|
all: fix up multiple-include-guard defines
Previously, src/nm-ip4-config.h, libnm/nm-ip4-config.h, and
libnm-glib/nm-ip4-config.h all used "NM_IP4_CONFIG_H" as an include
guard, which meant that nm-test-utils.h could not tell which of them
was being included (and so, eg, if you tried to include
nm-ip4-config.h in a libnm test, it would fail to compile because
nm-test-utils.h was referring to symbols in src/nm-ip4-config.h).
Fix this by changing the include guards in the non-API-stable parts of
the tree:
- libnm-glib/nm-ip4-config.h remains NM_IP4_CONFIG_H
- libnm/nm-ip4-config.h now uses __NM_IP4_CONFIG_H__
- src/nm-ip4-config.h now uses __NETWORKMANAGER_IP4_CONFIG_H__
And likewise for all other headers.
The two non-"nm"-prefixed headers, libnm/NetworkManager.h and
src/NetworkManagerUtils.h are now __NETWORKMANAGER_H__ and
__NETWORKMANAGER_UTILS_H__ respectively, which, while not entirely
consistent with the general scheme, do still mostly make sense in
isolation.
2014-08-13 14:10:11 -04:00
|
|
|
#endif /* __NETWORKMANAGER_ACTIVE_CONNECTION_H__ */
|