1 /* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */
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.
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.
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.
19 * Copyright 2007 - 2014 Red Hat, Inc.
22 #ifndef NM_SETTING_IP6_CONFIG_H
23 #define NM_SETTING_IP6_CONFIG_H
25 #include <arpa/inet.h>
27 #include "nm-setting.h"
31 #define NM_TYPE_SETTING_IP6_CONFIG (nm_setting_ip6_config_get_type ())
32 #define NM_SETTING_IP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP6_CONFIG, NMSettingIP6Config))
33 #define NM_SETTING_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IP6CONFIG, NMSettingIP6ConfigClass))
34 #define NM_IS_SETTING_IP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP6_CONFIG))
35 #define NM_IS_SETTING_IP6_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP6_CONFIG))
36 #define NM_SETTING_IP6_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP6_CONFIG, NMSettingIP6ConfigClass))
38 #define NM_SETTING_IP6_CONFIG_SETTING_NAME "ipv6"
41 * NMSettingIP6ConfigError:
42 * @NM_SETTING_IP6_CONFIG_ERROR_UNKNOWN: unknown or unclassified error
43 * @NM_SETTING_IP6_CONFIG_ERROR_INVALID_PROPERTY: the property was invalid
44 * @NM_SETTING_IP6_CONFIG_ERROR_MISSING_PROPERTY: the property was missing and is
46 * @NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD: the property's value is
47 * not valid with the given IPv6 method
50 NM_SETTING_IP6_CONFIG_ERROR_UNKNOWN = 0, /*< nick=UnknownError >*/
51 NM_SETTING_IP6_CONFIG_ERROR_INVALID_PROPERTY, /*< nick=InvalidProperty >*/
52 NM_SETTING_IP6_CONFIG_ERROR_MISSING_PROPERTY, /*< nick=MissingProperty >*/
53 NM_SETTING_IP6_CONFIG_ERROR_NOT_ALLOWED_FOR_METHOD /*< nick=NotAllowedForMethod >*/
54 } NMSettingIP6ConfigError;
56 #define NM_SETTING_IP6_CONFIG_ERROR nm_setting_ip6_config_error_quark ()
57 GQuark nm_setting_ip6_config_error_quark (void);
59 #define NM_SETTING_IP6_CONFIG_METHOD "method"
60 #define NM_SETTING_IP6_CONFIG_DNS "dns"
61 #define NM_SETTING_IP6_CONFIG_DNS_SEARCH "dns-search"
62 #define NM_SETTING_IP6_CONFIG_ADDRESSES "addresses"
63 #define NM_SETTING_IP6_CONFIG_ROUTES "routes"
64 #define NM_SETTING_IP6_CONFIG_ROUTE_METRIC "route-metric"
65 #define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
66 #define NM_SETTING_IP6_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
67 #define NM_SETTING_IP6_CONFIG_NEVER_DEFAULT "never-default"
68 #define NM_SETTING_IP6_CONFIG_MAY_FAIL "may-fail"
69 #define NM_SETTING_IP6_CONFIG_IP6_PRIVACY "ip6-privacy"
70 #define NM_SETTING_IP6_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
74 * NM_SETTING_IP6_CONFIG_METHOD_IGNORE:
76 * IPv6 is not required or is handled by some other mechanism, and NetworkManager
77 * should not configure IPv6 for this connection.
79 #define NM_SETTING_IP6_CONFIG_METHOD_IGNORE "ignore"
82 * NM_SETTING_IP6_CONFIG_METHOD_AUTO:
84 * IPv6 configuration should be automatically determined via a method appropriate
85 * for the hardware interface, ie router advertisements, DHCP, or PPP or some
86 * other device-specific manner.
88 #define NM_SETTING_IP6_CONFIG_METHOD_AUTO "auto"
91 * NM_SETTING_IP6_CONFIG_METHOD_DHCP:
93 * IPv6 configuration should be automatically determined via DHCPv6 only and
94 * router advertisements should be ignored.
96 #define NM_SETTING_IP6_CONFIG_METHOD_DHCP "dhcp"
99 * NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL:
101 * IPv6 configuration should be automatically configured for link-local-only
104 #define NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL "link-local"
107 * NM_SETTING_IP6_CONFIG_METHOD_MANUAL:
109 * All necessary IPv6 configuration (addresses, prefix, DNS, etc) is specified
110 * in the setting's properties.
112 #define NM_SETTING_IP6_CONFIG_METHOD_MANUAL "manual"
115 * NM_SETTING_IP6_CONFIG_METHOD_SHARED:
117 * This connection specifies configuration that allows other computers to
118 * connect through it to the default network (usually the Internet). The
119 * connection's interface will be assigned a private address, and router
120 * advertisements, a caching DNS server, and Network Address Translation (NAT)
121 * functionality will be started on this connection's interface to allow other
122 * devices to connect through that interface to the default network. (not yet
123 * supported for IPv6)
125 #define NM_SETTING_IP6_CONFIG_METHOD_SHARED "shared"
128 * NMSettingIP6ConfigPrivacy:
129 * @NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN: unknown or no value specified
130 * @NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED: IPv6 Privacy Extensions are disabled
131 * @NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR: IPv6 Privacy Extensions
132 * are enabled, but public addresses are preferred over temporary addresses
133 * @NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR: IPv6 Privacy Extensions
134 * are enabled and temporary addresses are preferred over public addresses
136 * #NMSettingIP6ConfigPrivacy values indicate if and how IPv6 Privacy
137 * Extensions are used (RFC4941).
140 NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN = -1,
141 NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED = 0,
142 NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR = 1,
143 NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR = 2
144 } NMSettingIP6ConfigPrivacy;
147 typedef struct NMIP6Address NMIP6Address;
149 GType nm_ip6_address_get_type (void);
151 NMIP6Address * nm_ip6_address_new (void);
152 NMIP6Address * nm_ip6_address_dup (NMIP6Address *source);
153 void nm_ip6_address_ref (NMIP6Address *address);
154 void nm_ip6_address_unref (NMIP6Address *address);
155 /* Return TRUE if addresses are identical */
156 gboolean nm_ip6_address_compare (NMIP6Address *address, NMIP6Address *other);
158 const struct in6_addr *nm_ip6_address_get_address (NMIP6Address *address);
159 void nm_ip6_address_set_address (NMIP6Address *address,
160 const struct in6_addr *addr);
162 guint32 nm_ip6_address_get_prefix (NMIP6Address *address);
163 void nm_ip6_address_set_prefix (NMIP6Address *address,
166 const struct in6_addr *nm_ip6_address_get_gateway (NMIP6Address *address);
167 void nm_ip6_address_set_gateway (NMIP6Address *address,
168 const struct in6_addr *gateway);
170 typedef struct NMIP6Route NMIP6Route;
172 GType nm_ip6_route_get_type (void);
174 NMIP6Route * nm_ip6_route_new (void);
175 NMIP6Route * nm_ip6_route_dup (NMIP6Route *source);
176 void nm_ip6_route_ref (NMIP6Route *route);
177 void nm_ip6_route_unref (NMIP6Route *route);
178 /* Return TRUE if routes are identical */
179 gboolean nm_ip6_route_compare (NMIP6Route *route, NMIP6Route *other);
181 const struct in6_addr *nm_ip6_route_get_dest (NMIP6Route *route);
182 void nm_ip6_route_set_dest (NMIP6Route *route,
183 const struct in6_addr *dest);
185 guint32 nm_ip6_route_get_prefix (NMIP6Route *route);
186 void nm_ip6_route_set_prefix (NMIP6Route *route,
189 const struct in6_addr *nm_ip6_route_get_next_hop (NMIP6Route *route);
190 void nm_ip6_route_set_next_hop (NMIP6Route *route,
191 const struct in6_addr *next_hop);
193 guint32 nm_ip6_route_get_metric (NMIP6Route *route);
194 void nm_ip6_route_set_metric (NMIP6Route *route,
199 } NMSettingIP6Config;
202 NMSettingClass parent;
204 /* Padding for future expansion */
205 void (*_reserved1) (void);
206 void (*_reserved2) (void);
207 void (*_reserved3) (void);
208 void (*_reserved4) (void);
209 } NMSettingIP6ConfigClass;
211 GType nm_setting_ip6_config_get_type (void);
213 NMSetting * nm_setting_ip6_config_new (void);
214 const char * nm_setting_ip6_config_get_method (NMSettingIP6Config *setting);
216 guint32 nm_setting_ip6_config_get_num_dns (NMSettingIP6Config *setting);
217 const struct in6_addr *nm_setting_ip6_config_get_dns (NMSettingIP6Config *setting, guint32 i);
218 gboolean nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const struct in6_addr *dns);
219 void nm_setting_ip6_config_remove_dns (NMSettingIP6Config *setting, guint32 i);
220 NM_AVAILABLE_IN_0_9_10
221 gboolean nm_setting_ip6_config_remove_dns_by_value (NMSettingIP6Config *setting, const struct in6_addr *dns);
222 void nm_setting_ip6_config_clear_dns (NMSettingIP6Config *setting);
224 guint32 nm_setting_ip6_config_get_num_dns_searches (NMSettingIP6Config *setting);
225 const char * nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i);
226 gboolean nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting, const char *dns_search);
227 void nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i);
228 NM_AVAILABLE_IN_0_9_10
229 gboolean nm_setting_ip6_config_remove_dns_search_by_value (NMSettingIP6Config *setting, const char *dns_search);
230 void nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting);
232 guint32 nm_setting_ip6_config_get_num_addresses (NMSettingIP6Config *setting);
233 NMIP6Address * nm_setting_ip6_config_get_address (NMSettingIP6Config *setting, guint32 i);
234 gboolean nm_setting_ip6_config_add_address (NMSettingIP6Config *setting, NMIP6Address *address);
235 void nm_setting_ip6_config_remove_address (NMSettingIP6Config *setting, guint32 i);
236 NM_AVAILABLE_IN_0_9_10
237 gboolean nm_setting_ip6_config_remove_address_by_value (NMSettingIP6Config *setting, NMIP6Address *address);
238 void nm_setting_ip6_config_clear_addresses (NMSettingIP6Config *setting);
240 guint32 nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting);
241 NMIP6Route * nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i);
242 gboolean nm_setting_ip6_config_add_route (NMSettingIP6Config *setting, NMIP6Route *route);
243 void nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i);
244 NM_AVAILABLE_IN_0_9_10
245 gboolean nm_setting_ip6_config_remove_route_by_value (NMSettingIP6Config *setting, NMIP6Route *route);
246 void nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting);
247 gboolean nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting);
250 gint64 nm_setting_ip6_config_get_route_metric (NMSettingIP6Config *setting);
252 gboolean nm_setting_ip6_config_get_ignore_auto_dns (NMSettingIP6Config *setting);
253 const char * nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting);
254 gboolean nm_setting_ip6_config_get_never_default (NMSettingIP6Config *setting);
255 gboolean nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting);
256 NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting);
260 #endif /* NM_SETTING_IP6_CONFIG_H */