1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301 USA.
19 * Copyright 2011 - 2014 Red Hat, Inc.
22 #ifndef NM_SETTING_VLAN_H
23 #define NM_SETTING_VLAN_H
25 #include "nm-setting.h"
26 #include <linux/if_vlan.h>
30 #define NM_TYPE_SETTING_VLAN (nm_setting_vlan_get_type ())
31 #define NM_SETTING_VLAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_VLAN, NMSettingVlan))
32 #define NM_SETTING_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_VLANCONFIG, NMSettingVlanClass))
33 #define NM_IS_SETTING_VLAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_VLAN))
34 #define NM_IS_SETTING_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_VLAN))
35 #define NM_SETTING_VLAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_VLAN, NMSettingVlanClass))
37 #define NM_SETTING_VLAN_SETTING_NAME "vlan"
41 * @NM_SETTING_VLAN_ERROR_UNKNOWN: unknown or unclassified error
42 * @NM_SETTING_VLAN_ERROR_INVALID_PROPERTY: the property was invalid
43 * @NM_SETTING_VLAN_ERROR_MISSING_PROPERTY: the property was missing and is
45 * @NM_SETTING_VLAN_ERROR_INVALID_PARENT: the VLAN parent was specified
49 NM_SETTING_VLAN_ERROR_UNKNOWN = 0, /*< nick=Unknown >*/
50 NM_SETTING_VLAN_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
51 NM_SETTING_VLAN_ERROR_MISSING_PROPERTY, /*< nick=MissingProperty >*/
52 NM_SETTING_VLAN_ERROR_INVALID_PARENT /*< nick=InvalidParent >*/
55 #define NM_SETTING_VLAN_ERROR nm_setting_vlan_error_quark ()
56 GQuark nm_setting_vlan_error_quark (void);
58 #define NM_SETTING_VLAN_INTERFACE_NAME "interface-name"
59 #define NM_SETTING_VLAN_PARENT "parent"
60 #define NM_SETTING_VLAN_ID "id"
61 #define NM_SETTING_VLAN_FLAGS "flags"
62 #define NM_SETTING_VLAN_INGRESS_PRIORITY_MAP "ingress-priority-map"
63 #define NM_SETTING_VLAN_EGRESS_PRIORITY_MAP "egress-priority-map"
70 NMSettingClass parent;
72 /* Padding for future expansion */
73 void (*_reserved1) (void);
74 void (*_reserved2) (void);
75 void (*_reserved3) (void);
76 void (*_reserved4) (void);
81 * @NM_VLAN_INGRESS_MAP: map for incoming data
82 * @NM_VLAN_EGRESS_MAP: map for outgoing data
84 * A selector for traffic priority maps; these map Linux SKB priorities
85 * to 802.1p priorities used in VLANs.
94 * @NM_VLAN_FLAG_REORDER_HEADERS: indicates that this interface should reorder
95 * outgoing packet headers to look more like a non-VLAN Ethernet interface
96 * @NM_VLAN_FLAG_GVRP: indicates that this interface should use GVRP to register
97 * itself with it's switch
98 * @NM_VLAN_FLAG_LOOSE_BINDING: indicates that this interface's operating
99 * state is tied to the underlying network interface but other details
100 * (like routing) are not.
101 * @NM_VLAN_FLAG_MVRP: indicates that this interface should use MVRP to register
102 * itself with it's switch
104 * #NMVlanFlags values control the behavior of the VLAN interface.
107 NM_VLAN_FLAG_REORDER_HEADERS = 0x1,
108 NM_VLAN_FLAG_GVRP = 0x2,
109 NM_VLAN_FLAG_LOOSE_BINDING = 0x4,
110 NM_VLAN_FLAG_MVRP = 0x8,
112 /* NOTE: if adding flags update nm-setting-vlan.c::verify() */
115 #define NM_VLAN_FLAGS_ALL (NM_VLAN_FLAG_REORDER_HEADERS | \
116 NM_VLAN_FLAG_GVRP | \
117 NM_VLAN_FLAG_LOOSE_BINDING | \
120 GType nm_setting_vlan_get_type (void);
121 NMSetting *nm_setting_vlan_new (void);
123 const char *nm_setting_vlan_get_interface_name (NMSettingVlan *setting);
124 const char *nm_setting_vlan_get_parent (NMSettingVlan *setting);
125 guint32 nm_setting_vlan_get_id (NMSettingVlan *setting);
126 guint32 nm_setting_vlan_get_flags (NMSettingVlan *setting);
128 gint32 nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap map);
130 gboolean nm_setting_vlan_get_priority (NMSettingVlan *setting,
131 NMVlanPriorityMap map,
136 gboolean nm_setting_vlan_add_priority (NMSettingVlan *setting,
137 NMVlanPriorityMap map,
141 void nm_setting_vlan_remove_priority (NMSettingVlan *setting,
142 NMVlanPriorityMap map,
145 NM_AVAILABLE_IN_0_9_10
146 gboolean nm_setting_vlan_remove_priority_by_value (NMSettingVlan *setting,
147 NMVlanPriorityMap map,
151 NM_AVAILABLE_IN_0_9_10
152 gboolean nm_setting_vlan_remove_priority_str_by_value (NMSettingVlan *setting,
153 NMVlanPriorityMap map,
156 void nm_setting_vlan_clear_priorities (NMSettingVlan *setting, NMVlanPriorityMap map);
158 gboolean nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
159 NMVlanPriorityMap map,
164 #endif /* NM_SETTING_VLAN_H */