本文整理汇总了C++中NM_DEVICE_CLASS函数的典型用法代码示例。如果您正苦于以下问题:C++ NM_DEVICE_CLASS函数的具体用法?C++ NM_DEVICE_CLASS怎么用?C++ NM_DEVICE_CLASS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NM_DEVICE_CLASS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: nm_device_veth_class_init
static void
nm_device_veth_class_init (NMDeviceVethClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDeviceClass *device_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (klass, sizeof (NMDeviceVethPrivate));
object_class->get_property = get_property;
object_class->dispose = dispose;
device_class->can_unmanaged_external_down = can_unmanaged_external_down;
/* properties */
g_object_class_install_property
(object_class, PROP_PEER,
g_param_spec_string (NM_DEVICE_VETH_PEER, "", "",
NULL,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_VETH_SKELETON,
NULL);
}
示例2: connection_compatible
static gboolean
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMDeviceTunPrivate *priv = NM_DEVICE_TUN_GET_PRIVATE (device);
NMSettingTunMode mode;
NMSettingTun *s_tun;
if (!NM_DEVICE_CLASS (nm_device_tun_parent_class)->connection_compatible (device, connection, error))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_TUN_SETTING_NAME)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
_("The connection was not a tun connection."));
return FALSE;
}
s_tun = nm_connection_get_setting_tun (connection);
mode = tun_mode_from_string (priv->mode);
if (s_tun && mode != nm_setting_tun_get_mode (s_tun)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
_("The mode of the device and the connection didn't match"));
return FALSE;
}
return TRUE;
}
示例3: connection_compatible
static gboolean
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingWimax *s_wimax;
const char *hwaddr, *setting_hwaddr;
if (!NM_DEVICE_CLASS (nm_device_wimax_parent_class)->connection_compatible (device, connection, error))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_WIMAX_SETTING_NAME)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
_("The connection was not a WiMAX connection."));
return FALSE;
}
/* Check MAC address */
hwaddr = nm_device_wimax_get_hw_address (NM_DEVICE_WIMAX (device));
if (hwaddr) {
if (!nm_utils_hwaddr_valid (hwaddr, ETH_ALEN)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
_("Invalid device MAC address."));
return FALSE;
}
s_wimax = nm_connection_get_setting_wimax (connection);
setting_hwaddr = nm_setting_wimax_get_mac_address (s_wimax);
if (setting_hwaddr && !nm_utils_hwaddr_matches (setting_hwaddr, -1, hwaddr, -1)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
_("The MACs of the device and the connection didn't match."));
return FALSE;
}
}
return TRUE;
}
示例4: nm_device_bond_class_init
static void
nm_device_bond_class_init (NMDeviceBondClass *eth_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (eth_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (eth_class);
g_type_class_add_private (eth_class, sizeof (NMDeviceBondPrivate));
/* virtual methods */
object_class->constructed = constructed;
object_class->dispose = dispose;
object_class->finalize = finalize;
object_class->get_property = get_property;
device_class->connection_compatible = connection_compatible;
device_class->get_setting_type = get_setting_type;
device_class->get_hw_address = get_hw_address;
/* properties */
/**
* NMDeviceBond:hw-address:
*
* The hardware (MAC) address of the device.
**/
g_object_class_install_property
(object_class, PROP_HW_ADDRESS,
g_param_spec_string (NM_DEVICE_BOND_HW_ADDRESS,
"Active MAC Address",
"Currently set hardware MAC address",
NULL,
G_PARAM_READABLE));
/**
* NMDeviceBond:carrier:
*
* Whether the device has carrier.
**/
g_object_class_install_property
(object_class, PROP_CARRIER,
g_param_spec_boolean (NM_DEVICE_BOND_CARRIER,
"Carrier",
"Carrier",
FALSE,
G_PARAM_READABLE));
/**
* NMDeviceBond:slaves:
*
* The devices (#NMDevice) slaved to the bond device.
*
* Since: 0.9.8
**/
g_object_class_install_property
(object_class, PROP_SLAVES,
g_param_spec_boxed (NM_DEVICE_BOND_SLAVES,
"Slaves",
"Slaves",
NM_TYPE_OBJECT_ARRAY,
G_PARAM_READABLE));
}
示例5: connection_compatible
static gboolean
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingConnection *s_con;
NMSettingOlpcMesh *s_olpc_mesh;
const char *ctype;
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
ctype = nm_setting_connection_get_connection_type (s_con);
if (strcmp (ctype, NM_SETTING_OLPC_MESH_SETTING_NAME) != 0) {
g_set_error (error, NM_DEVICE_OLPC_MESH_ERROR, NM_DEVICE_OLPC_MESH_ERROR_NOT_OLPC_MESH_CONNECTION,
"The connection was not a Olpc Mesh connection.");
return FALSE;
}
s_olpc_mesh = nm_connection_get_setting_olpc_mesh (connection);
if (!s_olpc_mesh) {
g_set_error (error, NM_DEVICE_OLPC_MESH_ERROR, NM_DEVICE_OLPC_MESH_ERROR_INVALID_OLPC_MESH_CONNECTION,
"The connection was not a valid Olpc Mesh connection.");
return FALSE;
}
return NM_DEVICE_CLASS (nm_device_olpc_mesh_parent_class)->connection_compatible (device, connection, error);
}
示例6: nm_device_adsl_class_init
static void
nm_device_adsl_class_init (NMDeviceAdslClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate));
object_class->constructed = constructed;
object_class->dispose = dispose;
object_class->get_property = get_property;
object_class->set_property = set_property;
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->complete_connection = complete_connection;
parent_class->act_stage2_config = act_stage2_config;
parent_class->act_stage3_ip4_config_start = act_stage3_ip4_config_start;
parent_class->deactivate = deactivate;
/* properties */
g_object_class_install_property
(object_class, PROP_ATM_INDEX,
g_param_spec_int (NM_DEVICE_ADSL_ATM_INDEX, "", "",
-1, G_MAXINT, -1,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_ADSL_SKELETON,
NULL);
}
示例7: nm_device_generic_class_init
static void
nm_device_generic_class_init (NMDeviceGenericClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (klass, sizeof (NMDeviceGenericPrivate));
NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_GENERIC_SETTING_NAME, NM_LINK_TYPE_ANY)
object_class->constructor = constructor;
object_class->dispose = dispose;
object_class->get_property = get_property;
object_class->set_property = set_property;
parent_class->realize_start_notify = realize_start_notify;
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->get_type_description = get_type_description;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->update_connection = update_connection;
/* properties */
g_object_class_install_property
(object_class, PROP_TYPE_DESCRIPTION,
g_param_spec_string (NM_DEVICE_GENERIC_TYPE_DESCRIPTION, "", "",
NULL,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY |
G_PARAM_STATIC_STRINGS));
nm_exported_object_class_add_interface (NM_EXPORTED_OBJECT_CLASS (klass),
NMDBUS_TYPE_DEVICE_GENERIC_SKELETON,
NULL);
}
示例8: nm_device_infiniband_class_init
static void
nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
NMDeviceClass *parent_class = NM_DEVICE_CLASS (klass);
g_type_class_add_private (object_class, sizeof (NMDeviceInfinibandPrivate));
/* virtual methods */
object_class->get_property = get_property;
object_class->set_property = set_property;
parent_class->get_generic_capabilities = get_generic_capabilities;
parent_class->check_connection_compatible = check_connection_compatible;
parent_class->complete_connection = complete_connection;
parent_class->update_connection = update_connection;
parent_class->act_stage1_prepare = act_stage1_prepare;
parent_class->ip4_config_pre_commit = ip4_config_pre_commit;
/* properties */
nm_dbus_manager_register_exported_type (nm_dbus_manager_get (),
G_TYPE_FROM_CLASS (klass),
&dbus_glib_nm_device_infiniband_object_info);
}
示例9: real_act_stage3_ip4_config_start
static NMActStageReturn
real_act_stage3_ip4_config_start (NMDevice *device, NMDeviceStateReason *reason)
{
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (device);
NMActStageReturn ret;
if (priv->bt_type == NM_BT_CAPABILITY_DUN) {
ret = nm_modem_stage3_ip4_config_start (NM_DEVICE_BT_GET_PRIVATE (device)->modem,
device,
NM_DEVICE_CLASS (nm_device_bt_parent_class),
reason);
} else
ret = NM_DEVICE_CLASS (nm_device_bt_parent_class)->act_stage3_ip4_config_start (device, reason);
return ret;
}
示例10: nm_device_adsl_class_init
static void
nm_device_adsl_class_init (NMDeviceAdslClass *adsl_class)
{
GObjectClass *object_class = G_OBJECT_CLASS (adsl_class);
NMDeviceClass *device_class = NM_DEVICE_CLASS (adsl_class);
g_type_class_add_private (object_class, sizeof (NMDeviceAdslPrivate));
/* virtual methods */
object_class->constructed = constructed;
object_class->dispose = dispose;
object_class->finalize = finalize;
object_class->get_property = get_property;
device_class->connection_compatible = connection_compatible;
device_class->get_setting_type = get_setting_type;
/* properties */
/**
* NMDeviceAdsl:carrier:
*
* Whether the device has carrier.
**/
g_object_class_install_property
(object_class, PROP_CARRIER,
g_param_spec_boolean (NM_DEVICE_ADSL_CARRIER, "", "",
FALSE,
G_PARAM_READABLE |
G_PARAM_STATIC_STRINGS));
}
示例11: check_connection_compatible
static gboolean
check_connection_compatible (NMDevice *device, NMConnection *connection)
{
NMSettingInfiniband *s_infiniband;
if (!NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->check_connection_compatible (device, connection))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME))
return FALSE;
s_infiniband = nm_connection_get_setting_infiniband (connection);
if (!s_infiniband)
return FALSE;
if (s_infiniband) {
const char *mac;
mac = nm_setting_infiniband_get_mac_address (s_infiniband);
if (mac && !nm_utils_hwaddr_matches (mac, -1, nm_device_get_hw_address (device), -1))
return FALSE;
}
return TRUE;
}
示例12: connection_compatible
static gboolean
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingConnection *s_con;
NMSettingAdsl *s_adsl;
const char *ctype;
s_con = nm_connection_get_setting_connection (connection);
g_assert (s_con);
ctype = nm_setting_connection_get_connection_type (s_con);
if (strcmp (ctype, NM_SETTING_ADSL_SETTING_NAME) != 0) {
g_set_error (error, NM_DEVICE_ADSL_ERROR, NM_DEVICE_ADSL_ERROR_NOT_ADSL_CONNECTION,
"The connection was not an ADSL connection.");
return FALSE;
}
s_adsl = nm_connection_get_setting_adsl (connection);
if (!s_adsl) {
g_set_error (error, NM_DEVICE_ADSL_ERROR, NM_DEVICE_ADSL_ERROR_INVALID_ADSL_CONNECTION,
"The connection was not a valid ADSL connection.");
return FALSE;
}
return NM_DEVICE_CLASS (nm_device_adsl_parent_class)->connection_compatible (device, connection, error);
}
示例13: connection_compatible
static gboolean
connection_compatible (NMDevice *device, NMConnection *connection, GError **error)
{
NMSettingInfiniband *s_infiniband;
const char *hwaddr, *setting_hwaddr;
if (!NM_DEVICE_CLASS (nm_device_infiniband_parent_class)->connection_compatible (device, connection, error))
return FALSE;
if (!nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
_("The connection was not an InfiniBand connection."));
return FALSE;
}
hwaddr = nm_device_infiniband_get_hw_address (NM_DEVICE_INFINIBAND (device));
if (hwaddr) {
if (!nm_utils_hwaddr_valid (hwaddr, INFINIBAND_ALEN)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED,
_("Invalid device MAC address."));
return FALSE;
}
s_infiniband = nm_connection_get_setting_infiniband (connection);
setting_hwaddr = nm_setting_infiniband_get_mac_address (s_infiniband);
if (setting_hwaddr && !nm_utils_hwaddr_matches (setting_hwaddr, -1, hwaddr, -1)) {
g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION,
_("The MACs of the device and the connection didn't match."));
return FALSE;
}
}
return TRUE;
}
示例14: act_stage1_prepare
static NMActStageReturn
act_stage1_prepare (NMDevice *dev, NMDeviceStateReason *reason)
{
NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS;
NMConnection *connection;
NMSettingBridge *s_bridge;
const char *iface;
g_return_val_if_fail (reason != NULL, NM_ACT_STAGE_RETURN_FAILURE);
ret = NM_DEVICE_CLASS (nm_device_bridge_parent_class)->act_stage1_prepare (dev, reason);
if (ret == NM_ACT_STAGE_RETURN_SUCCESS) {
connection = nm_device_get_connection (dev);
g_assert (connection);
s_bridge = nm_connection_get_setting_bridge (connection);
g_assert (s_bridge);
iface = nm_device_get_ip_iface (dev);
g_assert (iface);
set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_STP, "bridge", "stp_state", FALSE, FALSE);
set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_PRIORITY, "bridge", "priority", TRUE, FALSE);
set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY, "bridge", "forward_delay", TRUE, TRUE);
set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_HELLO_TIME, "bridge", "hello_time", TRUE, TRUE);
set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_MAX_AGE, "bridge", "max_age", TRUE, TRUE);
set_sysfs_uint (iface, G_OBJECT (s_bridge), NM_SETTING_BRIDGE_AGEING_TIME, "bridge", "ageing_time", TRUE, TRUE);
}
return ret;
}
示例15: check_connection_compatible
static gboolean
check_connection_compatible (NMDevice *device,
NMConnection *connection,
GError **error)
{
const char *iface;
NMSettingBridge *s_bridge;
if (!NM_DEVICE_CLASS (nm_device_bridge_parent_class)->check_connection_compatible (device, connection, error))
return FALSE;
s_bridge = nm_connection_get_setting_bridge (connection);
if (!s_bridge || !nm_connection_is_type (connection, NM_SETTING_BRIDGE_SETTING_NAME)) {
g_set_error (error, NM_BRIDGE_ERROR, NM_BRIDGE_ERROR_CONNECTION_NOT_BRIDGE,
"The connection was not a bridge connection.");
return FALSE;
}
/* Bridge connections must specify the virtual interface name */
iface = nm_connection_get_virtual_iface_name (connection);
if (!iface || strcmp (nm_device_get_iface (device), iface)) {
g_set_error (error, NM_BRIDGE_ERROR, NM_BRIDGE_ERROR_CONNECTION_INVALID,
"The bridge connection virtual interface name did not match.");
return FALSE;
}
return TRUE;
}