device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-util / 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 #include <nm-setting.h>
26
27 G_BEGIN_DECLS
28
29 #define NM_TYPE_SETTING_DCB            (nm_setting_dcb_get_type ())
30 #define NM_SETTING_DCB(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_DCB, NMSettingDcb))
31 #define NM_SETTING_DCB_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
32 #define NM_IS_SETTING_DCB(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_DCB))
33 #define NM_IS_SETTING_DCB_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_DCB))
34 #define NM_SETTING_DCB_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_DCB, NMSettingDcbClass))
35
36 #define NM_SETTING_DCB_SETTING_NAME "dcb"
37
38 /**
39  * NMSettingDcbError:
40  * @NM_SETTING_DCB_ERROR_UNKNOWN: unknown or unclassified error
41  * @NM_SETTING_DCB_ERROR_INVALID_PROPERTY: the property was invalid
42  * @NM_SETTING_DCB_ERROR_MISSING_PROPERTY: the property was missing and is
43  * required
44  */
45 typedef enum {
46         NM_SETTING_DCB_ERROR_UNKNOWN = 0,      /*< nick=UnknownError >*/
47         NM_SETTING_DCB_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
48         NM_SETTING_DCB_ERROR_MISSING_PROPERTY  /*< nick=MissingProperty >*/
49 } NMSettingDcbError;
50
51 #define NM_SETTING_DCB_ERROR nm_setting_dcb_error_quark ()
52 GQuark nm_setting_dcb_error_quark (void);
53
54 /**
55  * NMSettingDcbFlags:
56  * @NM_SETTING_DCB_FLAG_NONE: no flag
57  * @NM_SETTING_DCB_FLAG_ENABLE: the feature is enabled
58  * @NM_SETTING_DCB_FLAG_ADVERTISE: the feature is advertised
59  * @NM_SETTING_DCB_FLAG_WILLING: the feature is willing to change based on
60  * peer configuration advertisements
61  *
62  * DCB feature flags.
63  *
64  * Since: 0.9.10
65  **/
66 typedef enum {
67         NM_SETTING_DCB_FLAG_NONE      = 0x00000000,
68         NM_SETTING_DCB_FLAG_ENABLE    = 0x00000001,
69         NM_SETTING_DCB_FLAG_ADVERTISE = 0x00000002,
70         NM_SETTING_DCB_FLAG_WILLING   = 0x00000004
71 } NMSettingDcbFlags;
72
73 /**
74  * NM_SETTING_DCB_FCOE_MODE_FABRIC:
75  *
76  * Indicates that the FCoE controller should use "fabric" mode (default)
77  *
78  * Since: 0.9.10
79  */
80 #define NM_SETTING_DCB_FCOE_MODE_FABRIC  "fabric"
81
82 /**
83  * NM_SETTING_DCB_FCOE_MODE_VN2VN:
84  *
85  * Indicates that the FCoE controller should use "VN2VN" mode.
86  *
87  * Since: 0.9.10
88  */
89 #define NM_SETTING_DCB_FCOE_MODE_VN2VN   "vn2vn"
90
91
92 /* Properties */
93 #define NM_SETTING_DCB_APP_FCOE_FLAGS         "app-fcoe-flags"
94 #define NM_SETTING_DCB_APP_FCOE_PRIORITY      "app-fcoe-priority"
95 #define NM_SETTING_DCB_APP_FCOE_MODE          "app-fcoe-mode"
96
97 #define NM_SETTING_DCB_APP_ISCSI_FLAGS        "app-iscsi-flags"
98 #define NM_SETTING_DCB_APP_ISCSI_PRIORITY     "app-iscsi-priority"
99
100 #define NM_SETTING_DCB_APP_FIP_FLAGS          "app-fip-flags"
101 #define NM_SETTING_DCB_APP_FIP_PRIORITY       "app-fip-priority"
102
103 #define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL_FLAGS  "priority-flow-control-flags"
104 #define NM_SETTING_DCB_PRIORITY_FLOW_CONTROL        "priority-flow-control"
105
106 #define NM_SETTING_DCB_PRIORITY_GROUP_FLAGS      "priority-group-flags"
107 #define NM_SETTING_DCB_PRIORITY_GROUP_ID         "priority-group-id"
108 #define NM_SETTING_DCB_PRIORITY_GROUP_BANDWIDTH  "priority-group-bandwidth"
109 #define NM_SETTING_DCB_PRIORITY_BANDWIDTH        "priority-bandwidth"
110 #define NM_SETTING_DCB_PRIORITY_STRICT_BANDWIDTH "priority-strict-bandwidth"
111 #define NM_SETTING_DCB_PRIORITY_TRAFFIC_CLASS    "priority-traffic-class"
112
113
114 typedef struct {
115         NMSetting parent;
116 } NMSettingDcb;
117
118 typedef struct {
119         NMSettingClass parent;
120
121         /* Padding for future expansion */
122         void (*_reserved1) (void);
123         void (*_reserved2) (void);
124         void (*_reserved3) (void);
125         void (*_reserved4) (void);
126 } NMSettingDcbClass;
127
128 NM_AVAILABLE_IN_0_9_10
129 GType nm_setting_dcb_get_type (void);
130
131 NM_AVAILABLE_IN_0_9_10
132 NMSetting *       nm_setting_dcb_new                      (void);
133
134 NMSettingDcbFlags nm_setting_dcb_get_app_fcoe_flags     (NMSettingDcb *setting);
135 gint              nm_setting_dcb_get_app_fcoe_priority  (NMSettingDcb *setting);
136 const char *      nm_setting_dcb_get_app_fcoe_mode      (NMSettingDcb *setting);
137
138 NMSettingDcbFlags nm_setting_dcb_get_app_iscsi_flags    (NMSettingDcb *setting);
139 gint              nm_setting_dcb_get_app_iscsi_priority (NMSettingDcb *setting);
140
141 NMSettingDcbFlags nm_setting_dcb_get_app_fip_flags      (NMSettingDcb *setting);
142 gint              nm_setting_dcb_get_app_fip_priority   (NMSettingDcb *setting);
143
144 /* Priority Flow Control */
145 NMSettingDcbFlags nm_setting_dcb_get_priority_flow_control_flags    (NMSettingDcb *setting);
146 gboolean          nm_setting_dcb_get_priority_flow_control          (NMSettingDcb *setting,
147                                                                      guint user_priority);
148 void              nm_setting_dcb_set_priority_flow_control          (NMSettingDcb *setting,
149                                                                      guint user_priority,
150                                                                      gboolean enabled);
151
152 /* Priority Groups */
153 NMSettingDcbFlags nm_setting_dcb_get_priority_group_flags (NMSettingDcb *setting);
154
155 guint    nm_setting_dcb_get_priority_group_id         (NMSettingDcb *setting,
156                                                        guint user_priority);
157 void     nm_setting_dcb_set_priority_group_id         (NMSettingDcb *setting,
158                                                        guint user_priority,
159                                                        guint group_id);
160
161 guint    nm_setting_dcb_get_priority_group_bandwidth  (NMSettingDcb *setting,
162                                                        guint group_id);
163 void     nm_setting_dcb_set_priority_group_bandwidth  (NMSettingDcb *setting,
164                                                        guint group_id,
165                                                        guint bandwidth_percent);
166
167 guint    nm_setting_dcb_get_priority_bandwidth        (NMSettingDcb *setting,
168                                                        guint user_priority);
169 void     nm_setting_dcb_set_priority_bandwidth        (NMSettingDcb *setting,
170                                                        guint user_priority,
171                                                        guint bandwidth_percent);
172
173 gboolean nm_setting_dcb_get_priority_strict_bandwidth (NMSettingDcb *setting,
174                                                        guint user_priority);
175 void     nm_setting_dcb_set_priority_strict_bandwidth (NMSettingDcb *setting,
176                                                        guint user_priority,
177                                                        gboolean strict);
178
179 guint    nm_setting_dcb_get_priority_traffic_class    (NMSettingDcb *setting,
180                                                        guint user_priority);
181 void     nm_setting_dcb_set_priority_traffic_class    (NMSettingDcb *setting,
182                                                        guint user_priority,
183                                                        guint traffic_class);
184
185 G_END_DECLS
186
187 #endif /* NM_SETTING_DCB_H */