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 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
26 #error "Only <NetworkManager.h> can be included directly."
29 #include "nm-setting.h"
30 #include <linux/if_vlan.h>
34 #define NM_TYPE_SETTING_VLAN (nm_setting_vlan_get_type ())
35 #define NM_SETTING_VLAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_VLAN, NMSettingVlan))
36 #define NM_SETTING_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_VLANCONFIG, NMSettingVlanClass))
37 #define NM_IS_SETTING_VLAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_VLAN))
38 #define NM_IS_SETTING_VLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_VLAN))
39 #define NM_SETTING_VLAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_VLAN, NMSettingVlanClass))
41 #define NM_SETTING_VLAN_SETTING_NAME "vlan"
43 #define NM_SETTING_VLAN_PARENT "parent"
44 #define NM_SETTING_VLAN_ID "id"
45 #define NM_SETTING_VLAN_FLAGS "flags"
46 #define NM_SETTING_VLAN_INGRESS_PRIORITY_MAP "ingress-priority-map"
47 #define NM_SETTING_VLAN_EGRESS_PRIORITY_MAP "egress-priority-map"
49 struct _NMSettingVlan {
54 NMSettingClass parent;
62 * @NM_VLAN_INGRESS_MAP: map for incoming data
63 * @NM_VLAN_EGRESS_MAP: map for outgoing data
65 * A selector for traffic priority maps; these map Linux SKB priorities
66 * to 802.1p priorities used in VLANs.
75 * @NM_VLAN_FLAG_REORDER_HEADERS: indicates that this interface should reorder
76 * outgoing packet headers to look more like a non-VLAN Ethernet interface
77 * @NM_VLAN_FLAG_GVRP: indicates that this interface should use GVRP to register
78 * itself with it's switch
79 * @NM_VLAN_FLAG_LOOSE_BINDING: indicates that this interface's operating
80 * state is tied to the underlying network interface but other details
81 * (like routing) are not.
82 * @NM_VLAN_FLAG_MVRP: indicates that this interface should use MVRP to register
83 * itself with it's switch
85 * #NMVlanFlags values control the behavior of the VLAN interface.
87 typedef enum { /*< flags >*/
88 NM_VLAN_FLAG_REORDER_HEADERS = 0x1,
89 NM_VLAN_FLAG_GVRP = 0x2,
90 NM_VLAN_FLAG_LOOSE_BINDING = 0x4,
91 NM_VLAN_FLAG_MVRP = 0x8,
93 /* NOTE: if adding flags update nm-setting-vlan.c::verify() */
95 /* NOTE: these flags must correspond to the value from the kernel
99 #define NM_VLAN_FLAGS_ALL (NM_VLAN_FLAG_REORDER_HEADERS | \
100 NM_VLAN_FLAG_GVRP | \
101 NM_VLAN_FLAG_LOOSE_BINDING | \
104 GType nm_setting_vlan_get_type (void);
105 NMSetting *nm_setting_vlan_new (void);
107 const char *nm_setting_vlan_get_parent (NMSettingVlan *setting);
108 guint32 nm_setting_vlan_get_id (NMSettingVlan *setting);
109 guint32 nm_setting_vlan_get_flags (NMSettingVlan *setting);
111 gint32 nm_setting_vlan_get_num_priorities (NMSettingVlan *setting, NMVlanPriorityMap map);
113 gboolean nm_setting_vlan_get_priority (NMSettingVlan *setting,
114 NMVlanPriorityMap map,
119 gboolean nm_setting_vlan_add_priority (NMSettingVlan *setting,
120 NMVlanPriorityMap map,
124 void nm_setting_vlan_remove_priority (NMSettingVlan *setting,
125 NMVlanPriorityMap map,
128 gboolean nm_setting_vlan_remove_priority_by_value (NMSettingVlan *setting,
129 NMVlanPriorityMap map,
133 gboolean nm_setting_vlan_remove_priority_str_by_value (NMSettingVlan *setting,
134 NMVlanPriorityMap map,
137 void nm_setting_vlan_clear_priorities (NMSettingVlan *setting, NMVlanPriorityMap map);
139 gboolean nm_setting_vlan_add_priority_str (NMSettingVlan *setting,
140 NMVlanPriorityMap map,
145 #endif /* __NM_SETTING_VLAN_H__ */