ethernet: define NMDeviceEthernet on nm-libnm-utils.h

NMDeviceEthernet will be used to support Veth interfaces. Therefore, it
needs to be defined on libnm/nm-libnm-utils.h

Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
This commit is contained in:
Fernando Fernandez Mancera 2020-11-17 19:40:55 +01:00 committed by Thomas Haller
parent d615b902d8
commit de1d849f17
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728
2 changed files with 36 additions and 21 deletions

View file

@ -8,6 +8,7 @@
#include "nm-device-ethernet.h"
#include "nm-libnm-utils.h"
#include "nm-setting-connection.h"
#include "nm-setting-wired.h"
#include "nm-setting-pppoe.h"
@ -21,26 +22,17 @@ NM_GOBJECT_PROPERTIES_DEFINE_BASE(PROP_PERM_HW_ADDRESS,
PROP_CARRIER,
PROP_S390_SUBCHANNELS, );
typedef struct {
typedef struct _NMDeviceEthernetPrivate {
char ** s390_subchannels;
char * perm_hw_address;
guint32 speed;
bool carrier;
} NMDeviceEthernetPrivate;
struct _NMDeviceEthernet {
NMDevice parent;
NMDeviceEthernetPrivate _priv;
};
struct _NMDeviceEthernetClass {
NMDeviceClass parent;
};
G_DEFINE_TYPE(NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE)
#define NM_DEVICE_ETHERNET_GET_PRIVATE(self) \
_NM_GET_PRIVATE(self, NMDeviceEthernet, NM_IS_DEVICE_ETHERNET, NMObject, NMDevice)
_NM_GET_PRIVATE_PTR(self, NMDeviceEthernet, NM_IS_DEVICE_ETHERNET, NMObject)
/*****************************************************************************/
@ -271,7 +263,13 @@ get_setting_type(NMDevice *device)
static void
nm_device_ethernet_init(NMDeviceEthernet *device)
{}
{
NMDeviceEthernetPrivate *priv;
priv = G_TYPE_INSTANCE_GET_PRIVATE(device, NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetPrivate);
device->_priv = priv;
}
static void
finalize(GObject *object)
@ -321,26 +319,29 @@ const NMLDBusMetaIface _nml_dbus_meta_iface_nm_device_wired = NML_DBUS_META_IFAC
nm_device_ethernet_get_type,
NML_DBUS_META_INTERFACE_PRIO_INSTANTIATE_30,
NML_DBUS_META_IFACE_DBUS_PROPERTIES(
NML_DBUS_META_PROPERTY_INIT_B("Carrier", PROP_CARRIER, NMDeviceEthernet, _priv.carrier),
NML_DBUS_META_PROPERTY_INIT_B("Carrier", PROP_CARRIER, NMDeviceEthernetPrivate, carrier),
NML_DBUS_META_PROPERTY_INIT_FCN("HwAddress",
0,
"s",
_nm_device_notify_update_prop_hw_address),
NML_DBUS_META_PROPERTY_INIT_S("PermHwAddress",
PROP_PERM_HW_ADDRESS,
NMDeviceEthernet,
_priv.perm_hw_address),
NMDeviceEthernetPrivate,
perm_hw_address),
NML_DBUS_META_PROPERTY_INIT_AS("S390Subchannels",
PROP_S390_SUBCHANNELS,
NMDeviceEthernet,
_priv.s390_subchannels),
NML_DBUS_META_PROPERTY_INIT_U("Speed", PROP_SPEED, NMDeviceEthernet, _priv.speed), ), );
NMDeviceEthernetPrivate,
s390_subchannels),
NML_DBUS_META_PROPERTY_INIT_U("Speed", PROP_SPEED, NMDeviceEthernetPrivate, speed), ),
.base_struct_offset = G_STRUCT_OFFSET(NMDeviceEthernet, _priv), );
static void
nm_device_ethernet_class_init(NMDeviceEthernetClass *eth_class)
nm_device_ethernet_class_init(NMDeviceEthernetClass *klass)
{
GObjectClass * object_class = G_OBJECT_CLASS(eth_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS(eth_class);
GObjectClass * object_class = G_OBJECT_CLASS(klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS(klass);
g_type_class_add_private(klass, sizeof(NMDeviceEthernetPrivate));
object_class->get_property = get_property;
object_class->finalize = finalize;

View file

@ -7,6 +7,7 @@
#define __NM_LIBNM_UTILS_H__
#include "c-list/src/c-list.h"
#include "nm-device.h"
#include "nm-glib-aux/nm-ref-string.h"
#include "nm-glib-aux/nm-logging-fwd.h"
#include "nm-types.h"
@ -817,6 +818,19 @@ struct _NMDeviceClass {
/*****************************************************************************/
struct _NMDeviceEthernetPrivate;
struct _NMDeviceEthernet {
NMDevice parent;
struct _NMDeviceEthernetPrivate *_priv;
};
struct _NMDeviceEthernetClass {
NMDeviceClass parent;
};
/*****************************************************************************/
struct _NMActiveConnectionPrivate;
struct _NMActiveConnection {