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_CONNECTION_H__
8#define __NM_SETTING_CONNECTION_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_CONNECTION (nm_setting_connection_get_type())
19#define NM_SETTING_CONNECTION(obj) \
20 (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_CONNECTION, NMSettingConnection))
21#define NM_SETTING_CONNECTION_CLASS(klass) \
22 (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionClass))
23#define NM_IS_SETTING_CONNECTION(obj) \
24 (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_CONNECTION))
25#define NM_IS_SETTING_CONNECTION_CLASS(klass) \
26 (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_CONNECTION))
27#define NM_SETTING_CONNECTION_GET_CLASS(obj) \
28 (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_CONNECTION, NMSettingConnectionClass))
29
30#define NM_SETTING_CONNECTION_SETTING_NAME "connection"
31
32#define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MIN -999
33#define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_MAX 999
34#define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT 0
35
36#define NM_SETTING_CONNECTION_ID "id"
37#define NM_SETTING_CONNECTION_UUID "uuid"
38#define NM_SETTING_CONNECTION_STABLE_ID "stable-id"
39#define NM_SETTING_CONNECTION_INTERFACE_NAME "interface-name"
40#define NM_SETTING_CONNECTION_TYPE "type"
41#define NM_SETTING_CONNECTION_AUTOCONNECT "autoconnect"
42#define NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY "autoconnect-priority"
43#define NM_SETTING_CONNECTION_AUTOCONNECT_RETRIES "autoconnect-retries"
44#define NM_SETTING_CONNECTION_MULTI_CONNECT "multi-connect"
45#define NM_SETTING_CONNECTION_TIMESTAMP "timestamp"
46#define NM_SETTING_CONNECTION_READ_ONLY "read-only"
47#define NM_SETTING_CONNECTION_PERMISSIONS "permissions"
48#define NM_SETTING_CONNECTION_ZONE "zone"
49#define NM_SETTING_CONNECTION_MASTER "master"
50#define NM_SETTING_CONNECTION_CONTROLLER "controller"
51#define NM_SETTING_CONNECTION_SLAVE_TYPE "slave-type"
52#define NM_SETTING_CONNECTION_PORT_TYPE "port-type"
53#define NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES "autoconnect-slaves"
54#define NM_SETTING_CONNECTION_AUTOCONNECT_PORTS "autoconnect-ports"
55#define NM_SETTING_CONNECTION_SECONDARIES "secondaries"
56#define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
57#define NM_SETTING_CONNECTION_METERED "metered"
58#define NM_SETTING_CONNECTION_LLDP "lldp"
59#define NM_SETTING_CONNECTION_AUTH_RETRIES "auth-retries"
60#define NM_SETTING_CONNECTION_MDNS "mdns"
61#define NM_SETTING_CONNECTION_LLMNR "llmnr"
62#define NM_SETTING_CONNECTION_DNS_OVER_TLS "dns-over-tls"
63#define NM_SETTING_CONNECTION_MPTCP_FLAGS "mptcp-flags"
64#define NM_SETTING_CONNECTION_WAIT_DEVICE_TIMEOUT "wait-device-timeout"
65#define NM_SETTING_CONNECTION_MUD_URL "mud-url"
66#define NM_SETTING_CONNECTION_WAIT_ACTIVATION_DELAY "wait-activation-delay"
67
68/* Types for property values */
69/**
70 * NMSettingConnectionAutoconnectSlaves:
71 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT: default value
72 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO: slaves are not brought up when
73 * master is activated
74 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES: slaves are brought up when
75 * master is activated
76 *
77 * #NMSettingConnectionAutoconnectSlaves values indicate whether slave connections
78 * should be activated when master is activated.
79 *
80 * Since: 1.2
81 *
82 * Deprecated: 1.46
83 */
84NM_DEPRECATED_IN_1_46
85typedef enum {
86 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT = -1,
87 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO = 0,
88 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES = 1,
89} NMSettingConnectionAutoconnectSlaves;
90
91/**
92 * NMSettingConnectionLldp:
93 * @NM_SETTING_CONNECTION_LLDP_DEFAULT: default value
94 * @NM_SETTING_CONNECTION_LLDP_DISABLE: disable LLDP
95 * @NM_SETTING_CONNECTION_LLDP_ENABLE_RX: enable reception of LLDP frames
96 *
97 * #NMSettingConnectionLldp values indicate whether LLDP should be enabled.
98 *
99 * Since: 1.2
100 */
101typedef enum {
102 NM_SETTING_CONNECTION_LLDP_DEFAULT = -1,
103 NM_SETTING_CONNECTION_LLDP_DISABLE = 0,
104 NM_SETTING_CONNECTION_LLDP_ENABLE_RX = 1,
105} NMSettingConnectionLldp;
106
107/**
108 * NMSettingConnectionMdns:
109 * @NM_SETTING_CONNECTION_MDNS_DEFAULT: default value
110 * @NM_SETTING_CONNECTION_MDNS_NO: disable mDNS
111 * @NM_SETTING_CONNECTION_MDNS_RESOLVE: support only resolving, do not register hostname
112 * @NM_SETTING_CONNECTION_MDNS_YES: enable mDNS
113 *
114 * #NMSettingConnectionMdns values indicate whether mDNS should be enabled.
115 *
116 * Since: 1.12
117 */
118typedef enum {
119 NM_SETTING_CONNECTION_MDNS_DEFAULT = -1,
120 NM_SETTING_CONNECTION_MDNS_NO = 0,
121 NM_SETTING_CONNECTION_MDNS_RESOLVE = 1,
122 NM_SETTING_CONNECTION_MDNS_YES = 2,
123} NMSettingConnectionMdns;
124
125/**
126 * NMSettingConnectionLlmnr:
127 * @NM_SETTING_CONNECTION_LLMNR_DEFAULT: default value
128 * @NM_SETTING_CONNECTION_LLMNR_NO: disable LLMNR
129 * @NM_SETTING_CONNECTION_LLMNR_RESOLVE: support only resolving, do not register hostname
130 * @NM_SETTING_CONNECTION_LLMNR_YES: enable LLMNR
131 *
132 * #NMSettingConnectionLlmnr values indicate whether LLMNR should be enabled.
133 *
134 * Since: 1.14
135 */
136typedef enum {
137 NM_SETTING_CONNECTION_LLMNR_DEFAULT = -1,
138 NM_SETTING_CONNECTION_LLMNR_NO = 0,
139 NM_SETTING_CONNECTION_LLMNR_RESOLVE = 1,
140 NM_SETTING_CONNECTION_LLMNR_YES = 2,
141} NMSettingConnectionLlmnr;
142
143/**
144 * NMSettingConnectionDnsOverTls:
145 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_DEFAULT: default value
146 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_NO: disable DNSOverTls
147 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_OPPORTUNISTIC: enable opportunistic mode
148 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_YES: enable strict mode
149 *
150 * #NMSettingConnectionDnsOverTls values indicate whether DNSOverTls should be enabled.
151 *
152 * Since: 1.34
153 */
154typedef enum {
155 NM_SETTING_CONNECTION_DNS_OVER_TLS_DEFAULT = -1,
156 NM_SETTING_CONNECTION_DNS_OVER_TLS_NO = 0,
157 NM_SETTING_CONNECTION_DNS_OVER_TLS_OPPORTUNISTIC = 1,
158 NM_SETTING_CONNECTION_DNS_OVER_TLS_YES = 2,
159} NMSettingConnectionDnsOverTls;
160
161typedef struct _NMSettingConnectionClass NMSettingConnectionClass;
162
163GType nm_setting_connection_get_type(void);
164
165NMSetting *nm_setting_connection_new(void);
166const char *nm_setting_connection_get_id(NMSettingConnection *setting);
167const char *nm_setting_connection_get_uuid(NMSettingConnection *setting);
168NM_AVAILABLE_IN_1_4
169const char *nm_setting_connection_get_stable_id(NMSettingConnection *setting);
170const char *nm_setting_connection_get_interface_name(NMSettingConnection *setting);
171const char *nm_setting_connection_get_connection_type(NMSettingConnection *setting);
172gboolean nm_setting_connection_get_autoconnect(NMSettingConnection *setting);
173int nm_setting_connection_get_autoconnect_priority(NMSettingConnection *setting);
174NM_AVAILABLE_IN_1_6
175int nm_setting_connection_get_autoconnect_retries(NMSettingConnection *setting);
176NM_AVAILABLE_IN_1_14
177NMConnectionMultiConnect nm_setting_connection_get_multi_connect(NMSettingConnection *setting);
178guint64 nm_setting_connection_get_timestamp(NMSettingConnection *setting);
179
180NM_DEPRECATED_IN_1_44
181gboolean nm_setting_connection_get_read_only(NMSettingConnection *setting);
182
183guint32 nm_setting_connection_get_num_permissions(NMSettingConnection *setting);
184gboolean nm_setting_connection_get_permission(NMSettingConnection *setting,
185 guint32 idx,
186 const char **out_ptype,
187 const char **out_pitem,
188 const char **out_detail);
189const char *nm_setting_connection_get_zone(NMSettingConnection *setting);
190gboolean nm_setting_connection_permissions_user_allowed(NMSettingConnection *setting,
191 const char *uname);
192gboolean nm_setting_connection_add_permission(NMSettingConnection *setting,
193 const char *ptype,
194 const char *pitem,
195 const char *detail);
196void nm_setting_connection_remove_permission(NMSettingConnection *setting, guint32 idx);
197gboolean nm_setting_connection_remove_permission_by_value(NMSettingConnection *setting,
198 const char *ptype,
199 const char *pitem,
200 const char *detail);
201
202NM_DEPRECATED_IN_1_46
203const char *nm_setting_connection_get_master(NMSettingConnection *setting);
204
205NM_AVAILABLE_IN_1_46
206const char *nm_setting_connection_get_controller(NMSettingConnection *setting);
207
208NM_DEPRECATED_IN_1_46
209gboolean nm_setting_connection_is_slave_type(NMSettingConnection *setting, const char *type);
210
211NM_DEPRECATED_IN_1_46
212const char *nm_setting_connection_get_slave_type(NMSettingConnection *setting);
213
214NM_AVAILABLE_IN_1_46
215const char *nm_setting_connection_get_port_type(NMSettingConnection *setting);
216
217NM_AVAILABLE_IN_1_2
218NM_DEPRECATED_IN_1_46
219NMSettingConnectionAutoconnectSlaves
220nm_setting_connection_get_autoconnect_slaves(NMSettingConnection *setting);
221
222NM_AVAILABLE_IN_1_46
223NMTernary nm_setting_connection_get_autoconnect_ports(NMSettingConnection *setting);
224
225guint32 nm_setting_connection_get_num_secondaries(NMSettingConnection *setting);
226const char *nm_setting_connection_get_secondary(NMSettingConnection *setting, guint32 idx);
227gboolean nm_setting_connection_add_secondary(NMSettingConnection *setting, const char *sec_uuid);
228void nm_setting_connection_remove_secondary(NMSettingConnection *setting, guint32 idx);
229gboolean nm_setting_connection_remove_secondary_by_value(NMSettingConnection *setting,
230 const char *sec_uuid);
231
232guint32 nm_setting_connection_get_gateway_ping_timeout(NMSettingConnection *setting);
233NM_AVAILABLE_IN_1_2
234NMMetered nm_setting_connection_get_metered(NMSettingConnection *setting);
235NM_AVAILABLE_IN_1_2
236NMSettingConnectionLldp nm_setting_connection_get_lldp(NMSettingConnection *setting);
237
238NM_AVAILABLE_IN_1_10
239int nm_setting_connection_get_auth_retries(NMSettingConnection *setting);
240
241NM_AVAILABLE_IN_1_12
242NMSettingConnectionMdns nm_setting_connection_get_mdns(NMSettingConnection *setting);
243NM_AVAILABLE_IN_1_14
244NMSettingConnectionLlmnr nm_setting_connection_get_llmnr(NMSettingConnection *setting);
245NM_AVAILABLE_IN_1_34
246NMSettingConnectionDnsOverTls nm_setting_connection_get_dns_over_tls(NMSettingConnection *setting);
247
248NM_AVAILABLE_IN_1_42
249NMMptcpFlags nm_setting_connection_get_mptcp_flags(NMSettingConnection *setting);
250
251NM_AVAILABLE_IN_1_20
252gint32 nm_setting_connection_get_wait_device_timeout(NMSettingConnection *setting);
253
254NM_AVAILABLE_IN_1_40
255gint32 nm_setting_connection_get_wait_activation_delay(NMSettingConnection *setting);
256
257NM_AVAILABLE_IN_1_26
258const char *nm_setting_connection_get_mud_url(NMSettingConnection *setting);
259
260G_END_DECLS
261
262#endif /* __NM_SETTING_CONNECTION_H__ */
263

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