device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-core / nm-setting-dcb.h
1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
2
3 /*
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.
8  *
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.
13  *
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.
18  *
19  * Copyright 2013 Red Hat, Inc.
20  */
21
22 #ifndef __NM_SETTING_DCB_H__
23 #define __NM_SETTING_DCB_H__
24
25 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
26 #error "Only <NetworkManager.h> can be included directly."
27 #endif
28
29 #include <nm-setting.h>
30
31 G_BEGIN_DECLS
32
33 #define NM_TYPE_SETTING_DCB            (nm_setting_dcb_get_type ())
34 #define NM_SETTING_DCB(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_DCB, NMSettingDcb))
35 #define NM_SETTING_DCB_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
36 #define NM_IS_SETTING_DCB(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_DCB))
37 #define NM_IS_SETTING_DCB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_DCB))
38 #define NM_SETTING_DCB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
39
40 #define NM_SETTING_DCB_SETTING_NAME "dcb"
41
42 /**
43  * NMSettingDcbFlags:
44  * @NM_SETTING_DCB_FLAG_NONE: no flag
45  * @NM_SETTING_DCB_FLAG_ENABLE: the feature is enabled
46  * @NM_SETTING_DCB_FLAG_ADVERTISE: the feature is advertised
47  * @NM_SETTING_DCB_FLAG_WILLING: the feature is willing to change based on
48  * peer configuration advertisements
49  *
50  * DCB feature flags.
51  **/
52 typedef enum { /*< flags >*/
53         NM_SETTING_DCB_FLAG_NONE      = 0x00000000,
54         NM_SETTING_DCB_FLAG_ENABLE    = 0x00000001,
55         NM_SETTING_DCB_FLAG_ADVERTISE = 0x00000002,
56         NM_SETTING_DCB_FLAG_WILLING   = 0x00000004
57 } NMSettingDcbFlags;
58
59 /**
60  * NM_SETTING_DCB_FCOE_MODE_FABRIC:
61  *
62  * Indicates that the FCoE controller should use "fabric" mode (default)
63  */
64 #define NM_SETTING_DCB_FCOE_MODE_FABRIC  "fabric"
65
66 /**
67  * NM_SETTING_DCB_FCOE_MODE_VN2VN:
68  *
69  * Indicates that the FCoE controller should use "VN2VN" mode.
70  */
71 #define NM_SETTING_DCB_FCOE_MODE_VN2VN   "vn2vn"
72
73
74 /* Properties */
75 #define NM_SETTING_DCB_APP_FCOE_FLAGS         "app-fcoe-flags"
76 #define NM_SETTING_DCB_APP_FCOE_PRIORITY      "app-fcoe-priority"
77 #define NM_SETTING_DCB_APP_FCOE_MODE          "app-fcoe-mode"
78
79 #define NM_SETTING_DCB_APP_ISCSI_FLAGS        "app-iscsi-flags"
80 #define NM_SETTING_DCB_APP_ISCSI_PRIORITY     "app-iscsi-priority"
81
82 #define NM_SETTING_DCB_APP_FIP_FLAGS          "app-fip-flags"
83 #define NM_SETTING_DCB_APP_FIP_PRIORITY       "app-fip-priority"
84
85 #define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS  "priority-flow-control-flags"
86 #define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL        "priority-flow-control"
87
88 #define NM_SETTING_DCB_PRIORITY_GROUP_FLAGS      "priority-group-flags"
89 #define NM_SETTING_DCB_PRIORITY_GROUP_ID         "priority-group-id"
90 #define NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH  "priority-group-bandwidth"
91 #define NM_SETTING_DCB_PRIORITY_BANDWIDTH        "priority-bandwidth"
92 #define NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH "priority-strict-bandwidth"
93 #define NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS    "priority-traffic-class"
94
95
96 struct _NMSettingDcb {
97         NMSetting parent;
98 };
99
100 typedef struct {
101         NMSettingClass parent;
102
103         /*< private >*/
104         gpointer padding[4];
105 } NMSettingDcbClass;
106
107 GType nm_setting_dcb_get_type (void);
108
109 NMSetting *       nm_setting_dcb_new                      (void);
110
111 NMSettingDcbFlags nm_setting_dcb_get_app_fcoe_flags     (NMSettingDcb *setting);
112 gint              nm_setting_dcb_get_app_fcoe_priority  (NMSettingDcb *setting);
113 const char *      nm_setting_dcb_get_app_fcoe_mode      (NMSettingDcb *setting);
114
115 NMSettingDcbFlags nm_setting_dcb_get_app_iscsi_flags    (NMSettingDcb *setting);
116 gint              nm_setting_dcb_get_app_iscsi_priority (NMSettingDcb *setting);
117
118 NMSettingDcbFlags nm_setting_dcb_get_app_fip_flags      (NMSettingDcb *setting);
119 gint              nm_setting_dcb_get_app_fip_priority   (NMSettingDcb *setting);
120
121 /* Priority Flow Control */
122 NMSettingDcbFlags nm_setting_dcb_get_priority_flow_control_flags    (NMSettingDcb *setting);
123 gboolean          nm_setting_dcb_get_priority_flow_control          (NMSettingDcb *setting,
124                                                                      guint user_priority);
125 void              nm_setting_dcb_set_priority_flow_control          (NMSettingDcb *setting,
126                                                                      guint user_priority,
127                                                                      gboolean enabled);
128
129 /* Priority Groups */
130 NMSettingDcbFlags nm_setting_dcb_get_priority_group_flags (NMSettingDcb *setting);
131
132 guint    nm_setting_dcb_get_priority_group_id         (NMSettingDcb *setting,
133                                                        guint user_priority);
134 void     nm_setting_dcb_set_priority_group_id         (NMSettingDcb *setting,
135                                                        guint user_priority,
136                                                        guint group_id);
137
138 guint    nm_setting_dcb_get_priority_group_bandwidth  (NMSettingDcb *setting,
139                                                        guint group_id);
140 void     nm_setting_dcb_set_priority_group_bandwidth  (NMSettingDcb *setting,
141                                                        guint group_id,
142                                                        guint bandwidth_percent);
143
144 guint    nm_setting_dcb_get_priority_bandwidth        (NMSettingDcb *setting,
145                                                        guint user_priority);
146 void     nm_setting_dcb_set_priority_bandwidth        (NMSettingDcb *setting,
147                                                        guint user_priority,
148                                                        guint bandwidth_percent);
149
150 gboolean nm_setting_dcb_get_priority_strict_bandwidth (NMSettingDcb *setting,
151                                                        guint user_priority);
152 void     nm_setting_dcb_set_priority_strict_bandwidth (NMSettingDcb *setting,
153                                                        guint user_priority,
154                                                        gboolean strict);
155
156 guint    nm_setting_dcb_get_priority_traffic_class    (NMSettingDcb *setting,
157                                                        guint user_priority);
158 void     nm_setting_dcb_set_priority_traffic_class    (NMSettingDcb *setting,
159                                                        guint user_priority,
160                                                        guint traffic_class);
161
162 G_END_DECLS
163
164 #endif /* __NM_SETTING_DCB_H__ */