Commit 1bf2d3b0 authored by Beniamino Galvani's avatar Beniamino Galvani

libnm-core: add dummy connection setting

The setting must be present in connections with type=dummy. It does
not contain any property.
parent f95b6cad
......@@ -374,6 +374,7 @@ libnm_core_lib_h_pub_real = \
libnm-core/nm-setting-cdma.h \
libnm-core/nm-setting-connection.h \
libnm-core/nm-setting-dcb.h \
libnm-core/nm-setting-dummy.h \
libnm-core/nm-setting-generic.h \
libnm-core/nm-setting-gsm.h \
libnm-core/nm-setting-infiniband.h \
......@@ -439,6 +440,7 @@ libnm_core_lib_c_real = \
libnm-core/nm-setting-cdma.c \
libnm-core/nm-setting-connection.c \
libnm-core/nm-setting-dcb.c \
libnm-core/nm-setting-dummy.c \
libnm-core/nm-setting-generic.c \
libnm-core/nm-setting-gsm.c \
libnm-core/nm-setting-infiniband.c \
......
......@@ -1845,6 +1845,7 @@ nm_connection_is_virtual (NMConnection *connection)
g_return_val_if_fail (type != NULL, FALSE);
if ( !strcmp (type, NM_SETTING_BOND_SETTING_NAME)
|| !strcmp (type, NM_SETTING_DUMMY_SETTING_NAME)
|| !strcmp (type, NM_SETTING_TEAM_SETTING_NAME)
|| !strcmp (type, NM_SETTING_BRIDGE_SETTING_NAME)
|| !strcmp (type, NM_SETTING_VLAN_SETTING_NAME)
......@@ -2054,6 +2055,24 @@ nm_connection_get_setting_dcb (NMConnection *connection)
return (NMSettingDcb *) nm_connection_get_setting (connection, NM_TYPE_SETTING_DCB);
}
/**
* nm_connection_get_setting_dummy:
* @connection: the #NMConnection
*
* A shortcut to return any #NMSettingDummy the connection might contain.
*
* Returns: (transfer none): an #NMSettingDummy if the connection contains one, otherwise %NULL
*
* Since: 1.8
**/
NMSettingDummy *
nm_connection_get_setting_dummy (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
return (NMSettingDummy *) nm_connection_get_setting (connection, NM_TYPE_SETTING_DUMMY);
}
/**
* nm_connection_get_setting_generic:
* @connection: the #NMConnection
......
......@@ -199,6 +199,8 @@ NMSettingBridgePort * nm_connection_get_setting_bridge_port (NMConnec
NMSettingCdma * nm_connection_get_setting_cdma (NMConnection *connection);
NMSettingConnection * nm_connection_get_setting_connection (NMConnection *connection);
NMSettingDcb * nm_connection_get_setting_dcb (NMConnection *connection);
NM_AVAILABLE_IN_1_8
NMSettingDummy * nm_connection_get_setting_dummy (NMConnection *connection);
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
......
......@@ -45,6 +45,7 @@
#include "nm-setting-cdma.h"
#include "nm-setting-connection.h"
#include "nm-setting-dcb.h"
#include "nm-setting-dummy.h"
#include "nm-setting-generic.h"
#include "nm-setting-gsm.h"
#include "nm-setting-infiniband.h"
......
......@@ -38,6 +38,7 @@ typedef struct _NMSettingBridgePort NMSettingBridgePort;
typedef struct _NMSettingCdma NMSettingCdma;
typedef struct _NMSettingConnection NMSettingConnection;
typedef struct _NMSettingDcb NMSettingDcb;
typedef struct _NMSettingDummy NMSettingDummy;
typedef struct _NMSettingGeneric NMSettingGeneric;
typedef struct _NMSettingGsm NMSettingGsm;
typedef struct _NMSettingInfiniband NMSettingInfiniband;
......
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2017 Red Hat, Inc.
*/
#include "nm-default.h"
#include "nm-setting-dummy.h"
#include "nm-setting-connection.h"
#include "nm-setting-private.h"
/**
* SECTION:nm-setting-dummy
* @short_description: Describes connection properties for dummy interfaces
*
* The #NMSettingDummy object is a #NMSetting subclass that describes properties
* necessary for connection to dummy devices
**/
G_DEFINE_TYPE_WITH_CODE (NMSettingDummy, nm_setting_dummy, NM_TYPE_SETTING,
_nm_register_setting (DUMMY, 1))
NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_DUMMY)
/**
* nm_setting_dummy_new:
*
* Creates a new #NMSettingDummy object with default values.
*
* Returns: (transfer full): the new empty #NMSettingDummy object
*
* Since: 1.8
**/
NMSetting *
nm_setting_dummy_new (void)
{
return (NMSetting *) g_object_new (NM_TYPE_SETTING_DUMMY, NULL);
}
static void
nm_setting_dummy_init (NMSettingDummy *setting)
{
}
static void
nm_setting_dummy_class_init (NMSettingDummyClass *setting_class)
{
}
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA.
*
* Copyright 2017 Red Hat, Inc.
*/
#ifndef __NM_SETTING_DUMMY_H__
#define __NM_SETTING_DUMMY_H__
#if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-setting.h"
G_BEGIN_DECLS
#define NM_TYPE_SETTING_DUMMY (nm_setting_dummy_get_type ())
#define NM_SETTING_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_DUMMY, NMSettingDummy))
#define NM_SETTING_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_DUMMYCONFIG, NMSettingDummyClass))
#define NM_IS_SETTING_DUMMY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_DUMMY))
#define NM_IS_SETTING_DUMMY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_DUMMY))
#define NM_SETTING_DUMMY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_DUMMY, NMSettingDummyClass))
#define NM_SETTING_DUMMY_SETTING_NAME "dummy"
/**
* NMSettingDummy:
*/
struct _NMSettingDummy {
NMSetting parent;
};
typedef struct {
NMSettingClass parent;
/*< private >*/
gpointer padding[4];
} NMSettingDummyClass;
NM_AVAILABLE_IN_1_8
GType nm_setting_dummy_get_type (void);
NM_AVAILABLE_IN_1_8
NMSetting *nm_setting_dummy_new (void);
G_END_DECLS
#endif /* __NM_SETTING_DUMMY_H__ */
......@@ -61,6 +61,7 @@
#include <nm-setting-cdma.h>
#include <nm-setting-connection.h>
#include <nm-setting-dcb.h>
#include <nm-setting-dummy.h>
#include <nm-setting-generic.h>
#include <nm-setting-gsm.h>
#include <nm-setting-infiniband.h>
......
......@@ -1146,6 +1146,7 @@ global:
libnm_1_8_0 {
global:
nm_connection_get_setting_dummy;
nm_setting_802_1x_auth_flags_get_type;
nm_setting_802_1x_get_auth_timeout;
nm_setting_802_1x_get_ca_cert_password;
......@@ -1158,5 +1159,7 @@ global:
nm_setting_802_1x_get_phase2_client_cert_password;
nm_setting_802_1x_get_phase2_client_cert_password_flags;
nm_setting_cdma_get_mtu;
nm_setting_dummy_get_type;
nm_setting_dummy_new;
nm_setting_gsm_get_mtu;
} libnm_1_6_0;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment