Commit 77e50740 authored by Dan Williams's avatar Dan Williams

libnm-util: add Data Center Bridging (DCB) setting

Includes various fixes & cleanups from Thomas Haller.
parent 229e3fbe
......@@ -176,6 +176,7 @@ valgrind-*.log
/libnm-util/tests/test-need-secrets
/libnm-util/tests/test-secrets
/libnm-util/tests/test-setting-8021x
/libnm-util/tests/test-setting-dcb
/libnm-glib/tests/test-remote-settings-client
/src/tests/test-dhcp-options
/src/tests/test-ip4-config
......
......@@ -62,6 +62,7 @@
<xi:include href="xml/nm-setting-vlan.xml"/>
<xi:include href="xml/nm-setting-olpc-mesh.xml"/>
<xi:include href="xml/nm-setting-adsl.xml"/>
<xi:include href="xml/nm-setting-dcb.xml"/>
<xi:include href="xml/nm-setting-8021x.xml"/>
<xi:include href="xml/nm-setting-ip4-config.xml"/>
<xi:include href="xml/nm-setting-ip6-config.xml"/>
......
......@@ -32,6 +32,7 @@ libnm_util_include_HEADERS = \
nm-setting-bridge.h \
nm-setting-bridge-port.h \
nm-setting-connection.h \
nm-setting-dcb.h \
nm-setting-infiniband.h \
nm-setting-ip4-config.h \
nm-setting-vlan.h \
......@@ -71,6 +72,7 @@ libnm_util_la_csources = \
nm-setting-bridge.c \
nm-setting-bridge-port.c \
nm-setting-connection.c \
nm-setting-dcb.c \
nm-setting-infiniband.c \
nm-setting-ip4-config.c \
nm-setting-vlan.c \
......
......@@ -23,6 +23,7 @@ global:
nm_connection_get_setting_by_name;
nm_connection_get_setting_cdma;
nm_connection_get_setting_connection;
nm_connection_get_setting_dcb;
nm_connection_get_setting_generic;
nm_connection_get_setting_gsm;
nm_connection_get_setting_infiniband;
......@@ -263,6 +264,32 @@ global:
nm_setting_connection_permissions_user_allowed;
nm_setting_connection_remove_permission;
nm_setting_connection_remove_secondary;
nm_setting_dcb_error_get_type;
nm_setting_dcb_error_quark;
nm_setting_dcb_flags_get_type;
nm_setting_dcb_get_app_fcoe_flags;
nm_setting_dcb_get_app_fcoe_mode;
nm_setting_dcb_get_app_fcoe_priority;
nm_setting_dcb_get_app_fip_flags;
nm_setting_dcb_get_app_fip_priority;
nm_setting_dcb_get_app_iscsi_flags;
nm_setting_dcb_get_app_iscsi_priority;
nm_setting_dcb_get_priority_bandwidth;
nm_setting_dcb_get_priority_flow_control;
nm_setting_dcb_get_priority_flow_control_flags;
nm_setting_dcb_get_priority_group_bandwidth;
nm_setting_dcb_get_priority_group_flags;
nm_setting_dcb_get_priority_group_id;
nm_setting_dcb_get_priority_strict_bandwidth;
nm_setting_dcb_get_priority_traffic_class;
nm_setting_dcb_get_type;
nm_setting_dcb_new;
nm_setting_dcb_set_priority_bandwidth;
nm_setting_dcb_set_priority_flow_control;
nm_setting_dcb_set_priority_group_bandwidth;
nm_setting_dcb_set_priority_group_id;
nm_setting_dcb_set_priority_strict_bandwidth;
nm_setting_dcb_set_priority_traffic_class;
nm_setting_diff;
nm_setting_diff_result_get_type;
nm_setting_duplicate;
......
......@@ -1326,6 +1326,22 @@ nm_connection_get_setting_connection (NMConnection *connection)
return (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
}
/**
* nm_connection_get_setting_dcb:
* @connection: the #NMConnection
*
* A shortcut to return any #NMSettingDcb the connection might contain.
*
* Returns: (transfer none): an #NMSettingDcb if the connection contains one, otherwise NULL
**/
NMSettingDcb *
nm_connection_get_setting_dcb (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
return (NMSettingDcb *) nm_connection_get_setting (connection, NM_TYPE_SETTING_DCB);
}
/**
* nm_connection_get_setting_generic:
* @connection: the #NMConnection
......
......@@ -39,6 +39,7 @@
#include <nm-setting-bridge-port.h>
#include <nm-setting-cdma.h>
#include <nm-setting-connection.h>
#include <nm-setting-dcb.h>
#include <nm-setting-generic.h>
#include <nm-setting-gsm.h>
#include <nm-setting-infiniband.h>
......@@ -208,6 +209,7 @@ NMSettingBridge * nm_connection_get_setting_bridge (NMConnec
NMSettingBridgePort * nm_connection_get_setting_bridge_port (NMConnection *connection);
NMSettingCdma * nm_connection_get_setting_cdma (NMConnection *connection);
NMSettingConnection * nm_connection_get_setting_connection (NMConnection *connection);
NMSettingDcb * nm_connection_get_setting_dcb (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);
......
This diff is collapsed.
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
/*
* Dan Williams <dcbw@redhat.com>
*
* 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.
*
* (C) Copyright 2013 Red Hat, Inc.
*/
#ifndef NM_SETTING_DCB_H
#define NM_SETTING_DCB_H
#include <nm-setting.h>
G_BEGIN_DECLS
#define NM_TYPE_SETTING_DCB (nm_setting_dcb_get_type ())
#define NM_SETTING_DCB(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_DCB, NMSettingDcb))
#define NM_SETTING_DCB_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
#define NM_IS_SETTING_DCB(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_DCB))
#define NM_IS_SETTING_DCB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_DCB))
#define NM_SETTING_DCB_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
#define NM_SETTING_DCB_SETTING_NAME "dcb"
/**
* NMSettingDcbError:
* @NM_SETTING_DCB_ERROR_UNKNOWN: unknown or unclassified error
* @NM_SETTING_DCB_ERROR_INVALID_PROPERTY: the property was invalid
* @NM_SETTING_DCB_ERROR_MISSING_PROPERTY: the property was missing and is
* required
*/
typedef enum {
NM_SETTING_DCB_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
NM_SETTING_DCB_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
NM_SETTING_DCB_ERROR_MISSING_PROPERTY /*< nick=MissingProperty >*/
} NMSettingDcbError;
#define NM_SETTING_DCB_ERROR nm_setting_dcb_error_quark ()
GQuark nm_setting_dcb_error_quark (void);
/**
* NMSettingDcbFlags:
* @NM_SETTING_DCB_FLAG_NONE: no flag
* @NM_SETTING_DCB_FLAG_ENABLE: the feature is enabled
* @NM_SETTING_DCB_FLAG_ADVERTISE: the feature is advertised
* @NM_SETTING_DCB_FLAG_WILLING: the feature is willing to change based on
* peer configuration advertisements
*
* DCB feature flags.
*
* Since: 0.9.10
**/
typedef enum {
NM_SETTING_DCB_FLAG_NONE = 0x00000000,
NM_SETTING_DCB_FLAG_ENABLE = 0x00000001,
NM_SETTING_DCB_FLAG_ADVERTISE = 0x00000002,
NM_SETTING_DCB_FLAG_WILLING = 0x00000004
} NMSettingDcbFlags;
/**
* NM_SETTING_DCB_FCOE_MODE_FABRIC:
*
* Indicates that the FCoE controller should use "fabric" mode (default)
*
* Since: 0.9.10
*/
#define NM_SETTING_DCB_FCOE_MODE_FABRIC "fabric"
/**
* NM_SETTING_DCB_FCOE_MODE_VN2VN:
*
* Indicates that the FCoE controller should use "VN2VN" mode.
*
* Since: 0.9.10
*/
#define NM_SETTING_DCB_FCOE_MODE_VN2VN "vn2vn"
/* Properties */
#define NM_SETTING_DCB_APP_FCOE_FLAGS "app-fcoe-flags"
#define NM_SETTING_DCB_APP_FCOE_PRIORITY "app-fcoe-priority"
#define NM_SETTING_DCB_APP_FCOE_MODE "app-fcoe-mode"
#define NM_SETTING_DCB_APP_ISCSI_FLAGS "app-iscsi-flags"
#define NM_SETTING_DCB_APP_ISCSI_PRIORITY "app-iscsi-priority"
#define NM_SETTING_DCB_APP_FIP_FLAGS "app-fip-flags"
#define NM_SETTING_DCB_APP_FIP_PRIORITY "app-fip-priority"
#define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS "priority-flow-control-flags"
#define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL "priority-flow-control"
#define NM_SETTING_DCB_PRIORITY_GROUP_FLAGS "priority-group-flags"
#define NM_SETTING_DCB_PRIORITY_GROUP_ID "priority-group-id"
#define NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH "priority-group-bandwidth"
#define NM_SETTING_DCB_PRIORITY_BANDWIDTH "priority-bandwidth"
#define NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH "priority-strict-bandwidth"
#define NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS "priority-traffic-class"
typedef struct {
NMSetting parent;
} NMSettingDcb;
typedef struct {
NMSettingClass parent;
/* Padding for future expansion */
void (*_reserved1) (void);
void (*_reserved2) (void);
void (*_reserved3) (void);
void (*_reserved4) (void);
} NMSettingDcbClass;
GType nm_setting_dcb_get_type (void);
NMSetting * nm_setting_dcb_new (void);
NMSettingDcbFlags nm_setting_dcb_get_app_fcoe_flags (NMSettingDcb *setting);
gint nm_setting_dcb_get_app_fcoe_priority (NMSettingDcb *setting);
const char * nm_setting_dcb_get_app_fcoe_mode (NMSettingDcb *setting);
NMSettingDcbFlags nm_setting_dcb_get_app_iscsi_flags (NMSettingDcb *setting);
gint nm_setting_dcb_get_app_iscsi_priority (NMSettingDcb *setting);
NMSettingDcbFlags nm_setting_dcb_get_app_fip_flags (NMSettingDcb *setting);
gint nm_setting_dcb_get_app_fip_priority (NMSettingDcb *setting);
/* Priority Flow Control */
NMSettingDcbFlags nm_setting_dcb_get_priority_flow_control_flags (NMSettingDcb *setting);
gboolean nm_setting_dcb_get_priority_flow_control (NMSettingDcb *setting,
guint user_priority);
void nm_setting_dcb_set_priority_flow_control (NMSettingDcb *setting,
guint user_priority,
gboolean enabled);
/* Priority Groups */
NMSettingDcbFlags nm_setting_dcb_get_priority_group_flags (NMSettingDcb *setting);
guint nm_setting_dcb_get_priority_group_id (NMSettingDcb *setting,
guint user_priority);
void nm_setting_dcb_set_priority_group_id (NMSettingDcb *setting,
guint user_priority,
guint group_id);
guint nm_setting_dcb_get_priority_group_bandwidth (NMSettingDcb *setting,
guint group_id);
void nm_setting_dcb_set_priority_group_bandwidth (NMSettingDcb *setting,
guint group_id,
guint bandwidth_percent);
guint nm_setting_dcb_get_priority_bandwidth (NMSettingDcb *setting,
guint user_priority);
void nm_setting_dcb_set_priority_bandwidth (NMSettingDcb *setting,
guint user_priority,
guint bandwidth_percent);
gboolean nm_setting_dcb_get_priority_strict_bandwidth (NMSettingDcb *setting,
guint user_priority);
void nm_setting_dcb_set_priority_strict_bandwidth (NMSettingDcb *setting,
guint user_priority,
gboolean strict);
guint nm_setting_dcb_get_priority_traffic_class (NMSettingDcb *setting,
guint user_priority);
void nm_setting_dcb_set_priority_traffic_class (NMSettingDcb *setting,
guint user_priority,
guint traffic_class);
G_END_DECLS
#endif /* NM_SETTING_DCB_H */
......@@ -16,7 +16,8 @@ noinst_PROGRAMS = \
test-crypto \
test-secrets \
test-general \
test-setting-8021x
test-setting-8021x \
test-setting-dcb
test_settings_defaults_SOURCES = \
test-settings-defaults.c
......@@ -58,10 +59,19 @@ test_setting_8021x_LDADD = \
$(GLIB_LIBS) \
$(DBUS_LIBS)
check-local: test-settings-defaults test-crypto test-secrets
test_setting_dcb_SOURCES = \
test-setting-dcb.c
test_setting_dcb_LDADD = \
$(top_builddir)/libnm-util/libnm-util.la \
$(GLIB_LIBS) \
$(DBUS_LIBS)
check-local: test-settings-defaults test-crypto test-secrets test-setting-8021x test-setting-dcb
$(abs_builddir)/test-settings-defaults
$(abs_builddir)/test-secrets
$(abs_builddir)/test-general
$(abs_builddir)/test-setting-dcb
# Private key and CA certificate in the same file (PEM)
$(abs_builddir)/test-setting-8021x $(srcdir)/certs/test_key_and_cert.pem "test"
......
This diff is collapsed.
......@@ -19,6 +19,7 @@ libnm-util/nm-setting-bridge-port.c
libnm-util/nm-setting-bridge.c
libnm-util/nm-setting-cdma.c
libnm-util/nm-setting-connection.c
libnm-util/nm-setting-dcb.c
libnm-util/nm-setting-gsm.c
libnm-util/nm-setting-infiniband.c
libnm-util/nm-setting-ip4-config.c
......
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