device: renew dhcp leases on awake for software devices
[NetworkManager.git] / libnm-core / nm-setting-wired.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 2007 - 2014 Red Hat, Inc.
20  * Copyright 2007 - 2008 Novell, Inc.
21  */
22
23 #ifndef __NM_SETTING_WIRED_H__
24 #define __NM_SETTING_WIRED_H__
25
26 #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION)
27 #error "Only <NetworkManager.h> can be included directly."
28 #endif
29
30 #include <nm-setting.h>
31
32 G_BEGIN_DECLS
33
34 #define NM_TYPE_SETTING_WIRED            (nm_setting_wired_get_type ())
35 #define NM_SETTING_WIRED(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_WIRED, NMSettingWired))
36 #define NM_SETTING_WIRED_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_WIRED, NMSettingWiredClass))
37 #define NM_IS_SETTING_WIRED(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_WIRED))
38 #define NM_IS_SETTING_WIRED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_WIRED))
39 #define NM_SETTING_WIRED_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_WIRED, NMSettingWiredClass))
40
41 #define NM_SETTING_WIRED_SETTING_NAME "802-3-ethernet"
42
43 /**
44  * NMSettingWiredWakeOnLan:
45  * @NM_SETTING_WIRED_WAKE_ON_LAN_NONE: Wake-on-LAN disabled
46  * @NM_SETTING_WIRED_WAKE_ON_LAN_PHY: Wake on PHY activity
47  * @NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST: Wake on unicast messages
48  * @NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST: Wake on multicast messages
49  * @NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST: Wake on broadcast messages
50  * @NM_SETTING_WIRED_WAKE_ON_LAN_ARP: Wake on ARP
51  * @NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC: Wake on magic packet
52  * @NM_SETTING_WIRED_WAKE_ON_LAN_ALL: Wake on all events. This does not
53  *   include the exclusive flags @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT or
54  *   @NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE.
55  * @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT: Use the default value
56  * @NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE: Don't change configured settings
57  * @NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS: Mask of flags that are
58  *   incompatible with other flags
59  *
60  * Options for #NMSettingWired:wake-on-lan. Note that not all options
61  * are supported by all devices.
62  *
63  * Since: 1.2
64  */
65 typedef enum { /*< flags >*/
66         NM_SETTING_WIRED_WAKE_ON_LAN_NONE      = 0, /*< skip >*/
67         NM_SETTING_WIRED_WAKE_ON_LAN_PHY       = (1 << 1),
68         NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST   = (1 << 2),
69         NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST = (1 << 3),
70         NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST = (1 << 4),
71         NM_SETTING_WIRED_WAKE_ON_LAN_ARP       = (1 << 5),
72         NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC     = (1 << 6),
73
74         _NM_SETTING_WIRED_WAKE_ON_LAN_LAST_OPT, /*< skip >*/
75         NM_SETTING_WIRED_WAKE_ON_LAN_ALL       = (((_NM_SETTING_WIRED_WAKE_ON_LAN_LAST_OPT - 1) << 1) - 1) - (1 << 0 /*DEFAULT*/), /*< skip >*/
76
77         NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT   = (1 << 0),
78         NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE    = (1 << 15),
79         NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS = NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT | NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE, /*< skip >*/
80 } NMSettingWiredWakeOnLan;
81
82 #define NM_SETTING_WIRED_PORT "port"
83 #define NM_SETTING_WIRED_SPEED "speed"
84 #define NM_SETTING_WIRED_DUPLEX "duplex"
85 #define NM_SETTING_WIRED_AUTO_NEGOTIATE "auto-negotiate"
86 #define NM_SETTING_WIRED_MAC_ADDRESS "mac-address"
87 #define NM_SETTING_WIRED_CLONED_MAC_ADDRESS "cloned-mac-address"
88 #define NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST "mac-address-blacklist"
89 #define NM_SETTING_WIRED_MTU "mtu"
90 #define NM_SETTING_WIRED_S390_SUBCHANNELS "s390-subchannels"
91 #define NM_SETTING_WIRED_S390_NETTYPE "s390-nettype"
92 #define NM_SETTING_WIRED_S390_OPTIONS "s390-options"
93 #define NM_SETTING_WIRED_WAKE_ON_LAN "wake-on-lan"
94 #define NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD "wake-on-lan-password"
95
96 struct _NMSettingWired {
97         NMSetting parent;
98 };
99
100 typedef struct {
101         NMSettingClass parent;
102
103         /*< private >*/
104         gpointer padding[4];
105 } NMSettingWiredClass;
106
107 GType nm_setting_wired_get_type (void);
108
109 NMSetting *       nm_setting_wired_new                  (void);
110 const char *      nm_setting_wired_get_port             (NMSettingWired *setting);
111 guint32           nm_setting_wired_get_speed            (NMSettingWired *setting);
112 const char *      nm_setting_wired_get_duplex           (NMSettingWired *setting);
113 gboolean          nm_setting_wired_get_auto_negotiate   (NMSettingWired *setting);
114 const char *      nm_setting_wired_get_mac_address      (NMSettingWired *setting);
115 const char *      nm_setting_wired_get_cloned_mac_address (NMSettingWired *setting);
116
117 const char * const *nm_setting_wired_get_mac_address_blacklist   (NMSettingWired *setting);
118 guint32           nm_setting_wired_get_num_mac_blacklist_items (NMSettingWired *setting);
119 const char *      nm_setting_wired_get_mac_blacklist_item      (NMSettingWired *setting,
120                                                                 guint32 idx);
121 gboolean          nm_setting_wired_add_mac_blacklist_item      (NMSettingWired *setting,
122                                                                 const char *mac);
123 void              nm_setting_wired_remove_mac_blacklist_item   (NMSettingWired *setting,
124                                                                 guint32 idx);
125 gboolean          nm_setting_wired_remove_mac_blacklist_item_by_value (NMSettingWired *setting,
126                                                                        const char *mac);
127 void              nm_setting_wired_clear_mac_blacklist_items   (NMSettingWired *setting);
128
129 guint32           nm_setting_wired_get_mtu              (NMSettingWired *setting);
130
131 const char * const *nm_setting_wired_get_s390_subchannels (NMSettingWired *setting);
132 const char *      nm_setting_wired_get_s390_nettype     (NMSettingWired *setting);
133
134 guint32           nm_setting_wired_get_num_s390_options (NMSettingWired *setting);
135 gboolean          nm_setting_wired_get_s390_option      (NMSettingWired *setting,
136                                                          guint32 idx,
137                                                          const char **out_key,
138                                                          const char **out_value);
139 const char *      nm_setting_wired_get_s390_option_by_key (NMSettingWired *setting,
140                                                            const char *key);
141 gboolean          nm_setting_wired_add_s390_option      (NMSettingWired *setting,
142                                                          const char *key,
143                                                          const char *value);
144 gboolean          nm_setting_wired_remove_s390_option   (NMSettingWired *setting,
145                                                          const char *key);
146 const char **     nm_setting_wired_get_valid_s390_options (NMSettingWired *setting);
147
148 NMSettingWiredWakeOnLan  nm_setting_wired_get_wake_on_lan          (NMSettingWired *setting);
149 const char *             nm_setting_wired_get_wake_on_lan_password (NMSettingWired *setting);
150
151 G_END_DECLS
152
153 #endif /* __NM_SETTING_WIRED_H__ */