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_SLAVE_TYPE "slave-type"
51#define NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES "autoconnect-slaves"
52#define NM_SETTING_CONNECTION_SECONDARIES "secondaries"
53#define NM_SETTING_CONNECTION_GATEWAY_PING_TIMEOUT "gateway-ping-timeout"
54#define NM_SETTING_CONNECTION_METERED "metered"
55#define NM_SETTING_CONNECTION_LLDP "lldp"
56#define NM_SETTING_CONNECTION_AUTH_RETRIES "auth-retries"
57#define NM_SETTING_CONNECTION_MDNS "mdns"
58#define NM_SETTING_CONNECTION_LLMNR "llmnr"
59#define NM_SETTING_CONNECTION_DNS_OVER_TLS "dns-over-tls"
60#define NM_SETTING_CONNECTION_WAIT_DEVICE_TIMEOUT "wait-device-timeout"
61#define NM_SETTING_CONNECTION_MUD_URL "mud-url"
62
63/* Types for property values */
64/**
65 * NMSettingConnectionAutoconnectSlaves:
66 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT: default value
67 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO: slaves are not brought up when
68 * master is activated
69 * @NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES: slaves are brought up when
70 * master is activated
71 *
72 * #NMSettingConnectionAutoconnectSlaves values indicate whether slave connections
73 * should be activated when master is activated.
74 */
75typedef enum {
76 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_DEFAULT = -1,
77 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO = 0,
78 NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES = 1,
79} NMSettingConnectionAutoconnectSlaves;
80
81/**
82 * NMSettingConnectionLldp:
83 * @NM_SETTING_CONNECTION_LLDP_DEFAULT: default value
84 * @NM_SETTING_CONNECTION_LLDP_DISABLE: disable LLDP
85 * @NM_SETTING_CONNECTION_LLDP_ENABLE_RX: enable reception of LLDP frames
86 *
87 * #NMSettingConnectionLldp values indicate whether LLDP should be enabled.
88 */
89typedef enum {
90 NM_SETTING_CONNECTION_LLDP_DEFAULT = -1,
91 NM_SETTING_CONNECTION_LLDP_DISABLE = 0,
92 NM_SETTING_CONNECTION_LLDP_ENABLE_RX = 1,
93} NMSettingConnectionLldp;
94
95/**
96 * NMSettingConnectionMdns:
97 * @NM_SETTING_CONNECTION_MDNS_DEFAULT: default value
98 * @NM_SETTING_CONNECTION_MDNS_NO: disable mDNS
99 * @NM_SETTING_CONNECTION_MDNS_RESOLVE: support only resolving, do not register hostname
100 * @NM_SETTING_CONNECTION_MDNS_YES: enable mDNS
101 *
102 * #NMSettingConnectionMdns values indicate whether mDNS should be enabled.
103 *
104 * Since: 1.12
105 */
106typedef enum {
107 NM_SETTING_CONNECTION_MDNS_DEFAULT = -1,
108 NM_SETTING_CONNECTION_MDNS_NO = 0,
109 NM_SETTING_CONNECTION_MDNS_RESOLVE = 1,
110 NM_SETTING_CONNECTION_MDNS_YES = 2,
111} NMSettingConnectionMdns;
112
113/**
114 * NMSettingConnectionLlmnr:
115 * @NM_SETTING_CONNECTION_LLMNR_DEFAULT: default value
116 * @NM_SETTING_CONNECTION_LLMNR_NO: disable LLMNR
117 * @NM_SETTING_CONNECTION_LLMNR_RESOLVE: support only resolving, do not register hostname
118 * @NM_SETTING_CONNECTION_LLMNR_YES: enable LLMNR
119 *
120 * #NMSettingConnectionLlmnr values indicate whether LLMNR should be enabled.
121 *
122 * Since: 1.14
123 */
124typedef enum {
125 NM_SETTING_CONNECTION_LLMNR_DEFAULT = -1,
126 NM_SETTING_CONNECTION_LLMNR_NO = 0,
127 NM_SETTING_CONNECTION_LLMNR_RESOLVE = 1,
128 NM_SETTING_CONNECTION_LLMNR_YES = 2,
129} NMSettingConnectionLlmnr;
130
131/**
132 * NMSettingConnectionDnsOverTls:
133 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_DEFAULT: default value
134 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_NO: disable DNSOverTls
135 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_OPPORTUNISTIC: enable opportunistic mode
136 * @NM_SETTING_CONNECTION_DNS_OVER_TLS_YES: enable strict mode
137 *
138 * #NMSettingConnectionDnsOverTls values indicate whether DNSOverTls should be enabled.
139 *
140 * Since: 1.34
141 */
142typedef enum {
143 NM_SETTING_CONNECTION_DNS_OVER_TLS_DEFAULT = -1,
144 NM_SETTING_CONNECTION_DNS_OVER_TLS_NO = 0,
145 NM_SETTING_CONNECTION_DNS_OVER_TLS_OPPORTUNISTIC = 1,
146 NM_SETTING_CONNECTION_DNS_OVER_TLS_YES = 2,
147} NMSettingConnectionDnsOverTls;
148
149typedef struct _NMSettingConnectionClass NMSettingConnectionClass;
150
151GType nm_setting_connection_get_type(void);
152
153NMSetting *nm_setting_connection_new(void);
154const char *nm_setting_connection_get_id(NMSettingConnection *setting);
155const char *nm_setting_connection_get_uuid(NMSettingConnection *setting);
156NM_AVAILABLE_IN_1_4
157const char *nm_setting_connection_get_stable_id(NMSettingConnection *setting);
158const char *nm_setting_connection_get_interface_name(NMSettingConnection *setting);
159const char *nm_setting_connection_get_connection_type(NMSettingConnection *setting);
160gboolean nm_setting_connection_get_autoconnect(NMSettingConnection *setting);
161int nm_setting_connection_get_autoconnect_priority(NMSettingConnection *setting);
162NM_AVAILABLE_IN_1_6
163int nm_setting_connection_get_autoconnect_retries(NMSettingConnection *setting);
164NM_AVAILABLE_IN_1_14
165NMConnectionMultiConnect nm_setting_connection_get_multi_connect(NMSettingConnection *setting);
166guint64 nm_setting_connection_get_timestamp(NMSettingConnection *setting);
167gboolean nm_setting_connection_get_read_only(NMSettingConnection *setting);
168
169guint32 nm_setting_connection_get_num_permissions(NMSettingConnection *setting);
170gboolean nm_setting_connection_get_permission(NMSettingConnection *setting,
171 guint32 idx,
172 const char **out_ptype,
173 const char **out_pitem,
174 const char **out_detail);
175const char *nm_setting_connection_get_zone(NMSettingConnection *setting);
176gboolean nm_setting_connection_permissions_user_allowed(NMSettingConnection *setting,
177 const char *uname);
178gboolean nm_setting_connection_add_permission(NMSettingConnection *setting,
179 const char *ptype,
180 const char *pitem,
181 const char *detail);
182void nm_setting_connection_remove_permission(NMSettingConnection *setting, guint32 idx);
183gboolean nm_setting_connection_remove_permission_by_value(NMSettingConnection *setting,
184 const char *ptype,
185 const char *pitem,
186 const char *detail);
187
188const char *nm_setting_connection_get_master(NMSettingConnection *setting);
189gboolean nm_setting_connection_is_slave_type(NMSettingConnection *setting, const char *type);
190const char *nm_setting_connection_get_slave_type(NMSettingConnection *setting);
191NM_AVAILABLE_IN_1_2
192NMSettingConnectionAutoconnectSlaves
193nm_setting_connection_get_autoconnect_slaves(NMSettingConnection *setting);
194
195guint32 nm_setting_connection_get_num_secondaries(NMSettingConnection *setting);
196const char *nm_setting_connection_get_secondary(NMSettingConnection *setting, guint32 idx);
197gboolean nm_setting_connection_add_secondary(NMSettingConnection *setting, const char *sec_uuid);
198void nm_setting_connection_remove_secondary(NMSettingConnection *setting, guint32 idx);
199gboolean nm_setting_connection_remove_secondary_by_value(NMSettingConnection *setting,
200 const char *sec_uuid);
201
202guint32 nm_setting_connection_get_gateway_ping_timeout(NMSettingConnection *setting);
203NM_AVAILABLE_IN_1_2
204NMMetered nm_setting_connection_get_metered(NMSettingConnection *setting);
205NM_AVAILABLE_IN_1_2
206NMSettingConnectionLldp nm_setting_connection_get_lldp(NMSettingConnection *setting);
207
208NM_AVAILABLE_IN_1_10
209int nm_setting_connection_get_auth_retries(NMSettingConnection *setting);
210
211NM_AVAILABLE_IN_1_12
212NMSettingConnectionMdns nm_setting_connection_get_mdns(NMSettingConnection *setting);
213NM_AVAILABLE_IN_1_14
214NMSettingConnectionLlmnr nm_setting_connection_get_llmnr(NMSettingConnection *setting);
215NM_AVAILABLE_IN_1_34
216NMSettingConnectionDnsOverTls nm_setting_connection_get_dns_over_tls(NMSettingConnection *setting);
217
218NM_AVAILABLE_IN_1_20
219gint32 nm_setting_connection_get_wait_device_timeout(NMSettingConnection *setting);
220
221NM_AVAILABLE_IN_1_26
222const char *nm_setting_connection_get_mud_url(NMSettingConnection *setting);
223
224G_END_DECLS
225
226#endif /* __NM_SETTING_CONNECTION_H__ */
227

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