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 | |
16 | G_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 | */ |
75 | typedef 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 | */ |
89 | typedef 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 | */ |
106 | typedef 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 | */ |
124 | typedef 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 | */ |
142 | typedef 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 | |
149 | typedef struct _NMSettingConnectionClass NMSettingConnectionClass; |
150 | |
151 | GType nm_setting_connection_get_type(void); |
152 | |
153 | NMSetting *nm_setting_connection_new(void); |
154 | const char *nm_setting_connection_get_id(NMSettingConnection *setting); |
155 | const char *nm_setting_connection_get_uuid(NMSettingConnection *setting); |
156 | NM_AVAILABLE_IN_1_4 |
157 | const char *nm_setting_connection_get_stable_id(NMSettingConnection *setting); |
158 | const char *nm_setting_connection_get_interface_name(NMSettingConnection *setting); |
159 | const char *nm_setting_connection_get_connection_type(NMSettingConnection *setting); |
160 | gboolean nm_setting_connection_get_autoconnect(NMSettingConnection *setting); |
161 | int nm_setting_connection_get_autoconnect_priority(NMSettingConnection *setting); |
162 | NM_AVAILABLE_IN_1_6 |
163 | int nm_setting_connection_get_autoconnect_retries(NMSettingConnection *setting); |
164 | NM_AVAILABLE_IN_1_14 |
165 | NMConnectionMultiConnect nm_setting_connection_get_multi_connect(NMSettingConnection *setting); |
166 | guint64 nm_setting_connection_get_timestamp(NMSettingConnection *setting); |
167 | gboolean nm_setting_connection_get_read_only(NMSettingConnection *setting); |
168 | |
169 | guint32 nm_setting_connection_get_num_permissions(NMSettingConnection *setting); |
170 | gboolean 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); |
175 | const char *nm_setting_connection_get_zone(NMSettingConnection *setting); |
176 | gboolean nm_setting_connection_permissions_user_allowed(NMSettingConnection *setting, |
177 | const char *uname); |
178 | gboolean nm_setting_connection_add_permission(NMSettingConnection *setting, |
179 | const char *ptype, |
180 | const char *pitem, |
181 | const char *detail); |
182 | void nm_setting_connection_remove_permission(NMSettingConnection *setting, guint32 idx); |
183 | gboolean nm_setting_connection_remove_permission_by_value(NMSettingConnection *setting, |
184 | const char *ptype, |
185 | const char *pitem, |
186 | const char *detail); |
187 | |
188 | const char *nm_setting_connection_get_master(NMSettingConnection *setting); |
189 | gboolean nm_setting_connection_is_slave_type(NMSettingConnection *setting, const char *type); |
190 | const char *nm_setting_connection_get_slave_type(NMSettingConnection *setting); |
191 | NM_AVAILABLE_IN_1_2 |
192 | NMSettingConnectionAutoconnectSlaves |
193 | nm_setting_connection_get_autoconnect_slaves(NMSettingConnection *setting); |
194 | |
195 | guint32 nm_setting_connection_get_num_secondaries(NMSettingConnection *setting); |
196 | const char *nm_setting_connection_get_secondary(NMSettingConnection *setting, guint32 idx); |
197 | gboolean nm_setting_connection_add_secondary(NMSettingConnection *setting, const char *sec_uuid); |
198 | void nm_setting_connection_remove_secondary(NMSettingConnection *setting, guint32 idx); |
199 | gboolean nm_setting_connection_remove_secondary_by_value(NMSettingConnection *setting, |
200 | const char *sec_uuid); |
201 | |
202 | guint32 nm_setting_connection_get_gateway_ping_timeout(NMSettingConnection *setting); |
203 | NM_AVAILABLE_IN_1_2 |
204 | NMMetered nm_setting_connection_get_metered(NMSettingConnection *setting); |
205 | NM_AVAILABLE_IN_1_2 |
206 | NMSettingConnectionLldp nm_setting_connection_get_lldp(NMSettingConnection *setting); |
207 | |
208 | NM_AVAILABLE_IN_1_10 |
209 | int nm_setting_connection_get_auth_retries(NMSettingConnection *setting); |
210 | |
211 | NM_AVAILABLE_IN_1_12 |
212 | NMSettingConnectionMdns nm_setting_connection_get_mdns(NMSettingConnection *setting); |
213 | NM_AVAILABLE_IN_1_14 |
214 | NMSettingConnectionLlmnr nm_setting_connection_get_llmnr(NMSettingConnection *setting); |
215 | NM_AVAILABLE_IN_1_34 |
216 | NMSettingConnectionDnsOverTls nm_setting_connection_get_dns_over_tls(NMSettingConnection *setting); |
217 | |
218 | NM_AVAILABLE_IN_1_20 |
219 | gint32 nm_setting_connection_get_wait_device_timeout(NMSettingConnection *setting); |
220 | |
221 | NM_AVAILABLE_IN_1_26 |
222 | const char *nm_setting_connection_get_mud_url(NMSettingConnection *setting); |
223 | |
224 | G_END_DECLS |
225 | |
226 | #endif /* __NM_SETTING_CONNECTION_H__ */ |
227 | |