1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2007 - 2014 Red Hat, Inc.
4 * Copyright (C) 2007 - 2008 Novell, Inc.
5 */
6
7#ifndef __NM_SETTING_WIRED_H__
8#define __NM_SETTING_WIRED_H__
9
10#if !defined(__NETWORKMANAGER_H_INSIDE__) && !defined(NETWORKMANAGER_COMPILATION)
11#error "Only <NetworkManager.h> can be included directly."
12#endif
13
14#include "nm-setting.h"
15
16G_BEGIN_DECLS
17
18#define NM_TYPE_SETTING_WIRED (nm_setting_wired_get_type())
19#define NM_SETTING_WIRED(obj) \
20 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_WIRED, NMSettingWired))
21#define NM_SETTING_WIRED_CLASS(klass) \
22 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_WIRED, NMSettingWiredClass))
23#define NM_IS_SETTING_WIRED(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_WIRED))
24#define NM_IS_SETTING_WIRED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_WIRED))
25#define NM_SETTING_WIRED_GET_CLASS(obj) \
26 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_WIRED, NMSettingWiredClass))
27
28#define NM_SETTING_WIRED_SETTING_NAME "802-3-ethernet"
29
30/**
31 * NMSettingWiredWakeOnLan:
32 * @NM_SETTING_WIRED_WAKE_ON_LAN_NONE: Wake-on-LAN disabled
33 * @NM_SETTING_WIRED_WAKE_ON_LAN_PHY: Wake on PHY activity
34 * @NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST: Wake on unicast messages
35 * @NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST: Wake on multicast messages
36 * @NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST: Wake on broadcast messages
37 * @NM_SETTING_WIRED_WAKE_ON_LAN_ARP: Wake on ARP
38 * @NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC: Wake on magic packet
39 * @NM_SETTING_WIRED_WAKE_ON_LAN_ALL: Wake on all events. This does not
40 * include the exclusive flags @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT or
41 * @NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE.
42 * @NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT: Use the default value
43 * @NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE: Don't change configured settings
44 * @NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS: Mask of flags that are
45 * incompatible with other flags
46 *
47 * Options for #NMSettingWired:wake-on-lan. Note that not all options
48 * are supported by all devices.
49 *
50 * Since: 1.2
51 */
52typedef enum { /*< flags >*/
53 NM_SETTING_WIRED_WAKE_ON_LAN_NONE = 0, /*< skip >*/
54 NM_SETTING_WIRED_WAKE_ON_LAN_PHY = 0x2,
55 NM_SETTING_WIRED_WAKE_ON_LAN_UNICAST = 0x4,
56 NM_SETTING_WIRED_WAKE_ON_LAN_MULTICAST = 0x8,
57 NM_SETTING_WIRED_WAKE_ON_LAN_BROADCAST = 0x10,
58 NM_SETTING_WIRED_WAKE_ON_LAN_ARP = 0x20,
59 NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC = 0x40,
60
61 NM_SETTING_WIRED_WAKE_ON_LAN_ALL = 0x7E, /*< skip >*/
62
63 NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT = 0x1,
64 NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE = 0x8000,
65 NM_SETTING_WIRED_WAKE_ON_LAN_EXCLUSIVE_FLAGS = 0x8001, /*< skip >*/
66} NMSettingWiredWakeOnLan;
67
68#define NM_SETTING_WIRED_PORT "port"
69#define NM_SETTING_WIRED_SPEED "speed"
70#define NM_SETTING_WIRED_DUPLEX "duplex"
71#define NM_SETTING_WIRED_AUTO_NEGOTIATE "auto-negotiate"
72#define NM_SETTING_WIRED_MAC_ADDRESS "mac-address"
73#define NM_SETTING_WIRED_CLONED_MAC_ADDRESS "cloned-mac-address"
74#define NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK "generate-mac-address-mask"
75#define NM_SETTING_WIRED_MAC_ADDRESS_BLACKLIST "mac-address-blacklist"
76#define NM_SETTING_WIRED_MTU "mtu"
77#define NM_SETTING_WIRED_S390_SUBCHANNELS "s390-subchannels"
78#define NM_SETTING_WIRED_S390_NETTYPE "s390-nettype"
79#define NM_SETTING_WIRED_S390_OPTIONS "s390-options"
80#define NM_SETTING_WIRED_WAKE_ON_LAN "wake-on-lan"
81#define NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD "wake-on-lan-password"
82#define NM_SETTING_WIRED_ACCEPT_ALL_MAC_ADDRESSES "accept-all-mac-addresses"
83
84typedef struct _NMSettingWiredClass NMSettingWiredClass;
85
86GType nm_setting_wired_get_type(void);
87
88NMSetting *nm_setting_wired_new(void);
89const char *nm_setting_wired_get_port(NMSettingWired *setting);
90guint32 nm_setting_wired_get_speed(NMSettingWired *setting);
91const char *nm_setting_wired_get_duplex(NMSettingWired *setting);
92gboolean nm_setting_wired_get_auto_negotiate(NMSettingWired *setting);
93const char *nm_setting_wired_get_mac_address(NMSettingWired *setting);
94const char *nm_setting_wired_get_cloned_mac_address(NMSettingWired *setting);
95
96NM_AVAILABLE_IN_1_32
97NMTernary nm_setting_wired_get_accept_all_mac_addresses(NMSettingWired *setting);
98
99NM_AVAILABLE_IN_1_4
100const char *nm_setting_wired_get_generate_mac_address_mask(NMSettingWired *setting);
101
102const char *const *nm_setting_wired_get_mac_address_blacklist(NMSettingWired *setting);
103guint32 nm_setting_wired_get_num_mac_blacklist_items(NMSettingWired *setting);
104const char *nm_setting_wired_get_mac_blacklist_item(NMSettingWired *setting, guint32 idx);
105gboolean nm_setting_wired_add_mac_blacklist_item(NMSettingWired *setting, const char *mac);
106void nm_setting_wired_remove_mac_blacklist_item(NMSettingWired *setting, guint32 idx);
107gboolean nm_setting_wired_remove_mac_blacklist_item_by_value(NMSettingWired *setting,
108 const char *mac);
109void nm_setting_wired_clear_mac_blacklist_items(NMSettingWired *setting);
110
111guint32 nm_setting_wired_get_mtu(NMSettingWired *setting);
112
113const char *const *nm_setting_wired_get_s390_subchannels(NMSettingWired *setting);
114const char *nm_setting_wired_get_s390_nettype(NMSettingWired *setting);
115
116guint32 nm_setting_wired_get_num_s390_options(NMSettingWired *setting);
117gboolean nm_setting_wired_get_s390_option(NMSettingWired *setting,
118 guint32 idx,
119 const char **out_key,
120 const char **out_value);
121const char *nm_setting_wired_get_s390_option_by_key(NMSettingWired *setting, const char *key);
122gboolean
123nm_setting_wired_add_s390_option(NMSettingWired *setting, const char *key, const char *value);
124gboolean nm_setting_wired_remove_s390_option(NMSettingWired *setting, const char *key);
125const char **nm_setting_wired_get_valid_s390_options(NMSettingWired *setting);
126
127NMSettingWiredWakeOnLan nm_setting_wired_get_wake_on_lan(NMSettingWired *setting);
128const char *nm_setting_wired_get_wake_on_lan_password(NMSettingWired *setting);
129
130G_END_DECLS
131
132#endif /* __NM_SETTING_WIRED_H__ */
133

source code of include/libnm/nm-setting-wired.h