| 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_IP_CONFIG_H |
| 8 | #define NM_SETTING_IP_CONFIG_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 | #include "nm-utils.h" |
| 16 | |
| 17 | G_BEGIN_DECLS |
| 18 | |
| 19 | #define NM_IP_ADDRESS_ATTRIBUTE_LABEL "label" |
| 20 | |
| 21 | /** |
| 22 | * NMIPAddressCmpFlags: |
| 23 | * @NM_IP_ADDRESS_CMP_FLAGS_NONE: no flags. |
| 24 | * @NM_IP_ADDRESS_CMP_FLAGS_WITH_ATTRS: when comparing two addresses, |
| 25 | * also consider their attributes. Warning: note that attributes are GVariants |
| 26 | * and they don't have a total order. In other words, if the address differs only |
| 27 | * by their attributes, the returned compare order is not total. In that case, |
| 28 | * the return value merely indicates equality (zero) or inequality. |
| 29 | * |
| 30 | * Compare flags for nm_ip_address_cmp_full(). |
| 31 | * |
| 32 | * Since: 1.22 |
| 33 | */ |
| 34 | typedef enum { /*< flags >*/ |
| 35 | NM_IP_ADDRESS_CMP_FLAGS_NONE = 0, |
| 36 | NM_IP_ADDRESS_CMP_FLAGS_WITH_ATTRS = 0x1, |
| 37 | } NMIPAddressCmpFlags; |
| 38 | |
| 39 | typedef struct NMIPAddress NMIPAddress; |
| 40 | |
| 41 | GType nm_ip_address_get_type(void); |
| 42 | |
| 43 | NMIPAddress *nm_ip_address_new(int family, const char *addr, guint prefix, GError **error); |
| 44 | NMIPAddress *nm_ip_address_new_binary(int family, gconstpointer addr, guint prefix, GError **error); |
| 45 | |
| 46 | void nm_ip_address_ref(NMIPAddress *address); |
| 47 | void nm_ip_address_unref(NMIPAddress *address); |
| 48 | gboolean nm_ip_address_equal(NMIPAddress *address, NMIPAddress *other); |
| 49 | NM_AVAILABLE_IN_1_22 |
| 50 | int |
| 51 | nm_ip_address_cmp_full(const NMIPAddress *a, const NMIPAddress *b, NMIPAddressCmpFlags cmp_flags); |
| 52 | |
| 53 | NM_AVAILABLE_IN_1_32 |
| 54 | NMIPAddress *nm_ip_address_dup(NMIPAddress *address); |
| 55 | |
| 56 | int nm_ip_address_get_family(NMIPAddress *address); |
| 57 | const char *nm_ip_address_get_address(NMIPAddress *address); |
| 58 | void nm_ip_address_set_address(NMIPAddress *address, const char *addr); |
| 59 | void nm_ip_address_get_address_binary(NMIPAddress *address, gpointer addr); |
| 60 | void nm_ip_address_set_address_binary(NMIPAddress *address, gconstpointer addr); |
| 61 | guint nm_ip_address_get_prefix(NMIPAddress *address); |
| 62 | void nm_ip_address_set_prefix(NMIPAddress *address, guint prefix); |
| 63 | |
| 64 | char **nm_ip_address_get_attribute_names(NMIPAddress *address); |
| 65 | GVariant *nm_ip_address_get_attribute(NMIPAddress *address, const char *name); |
| 66 | void nm_ip_address_set_attribute(NMIPAddress *address, const char *name, GVariant *value); |
| 67 | |
| 68 | typedef struct NMIPRoute NMIPRoute; |
| 69 | |
| 70 | GType nm_ip_route_get_type(void); |
| 71 | |
| 72 | NMIPRoute *nm_ip_route_new(int family, |
| 73 | const char *dest, |
| 74 | guint prefix, |
| 75 | const char *next_hop, |
| 76 | gint64 metric, |
| 77 | GError **error); |
| 78 | NMIPRoute *nm_ip_route_new_binary(int family, |
| 79 | gconstpointer dest, |
| 80 | guint prefix, |
| 81 | gconstpointer next_hop, |
| 82 | gint64 metric, |
| 83 | GError **error); |
| 84 | |
| 85 | void nm_ip_route_ref(NMIPRoute *route); |
| 86 | void nm_ip_route_unref(NMIPRoute *route); |
| 87 | gboolean nm_ip_route_equal(NMIPRoute *route, NMIPRoute *other); |
| 88 | |
| 89 | enum { /*< flags >*/ |
| 90 | NM_IP_ROUTE_EQUAL_CMP_FLAGS_NONE = 0, |
| 91 | NM_IP_ROUTE_EQUAL_CMP_FLAGS_WITH_ATTRS = 0x1, |
| 92 | }; |
| 93 | |
| 94 | NM_AVAILABLE_IN_1_10 |
| 95 | gboolean nm_ip_route_equal_full(NMIPRoute *route, NMIPRoute *other, guint cmp_flags); |
| 96 | |
| 97 | NM_AVAILABLE_IN_1_32 |
| 98 | NMIPRoute *nm_ip_route_dup(NMIPRoute *route); |
| 99 | |
| 100 | int nm_ip_route_get_family(NMIPRoute *route); |
| 101 | const char *nm_ip_route_get_dest(NMIPRoute *route); |
| 102 | void nm_ip_route_set_dest(NMIPRoute *route, const char *dest); |
| 103 | void nm_ip_route_get_dest_binary(NMIPRoute *route, gpointer dest); |
| 104 | void nm_ip_route_set_dest_binary(NMIPRoute *route, gconstpointer dest); |
| 105 | guint nm_ip_route_get_prefix(NMIPRoute *route); |
| 106 | void nm_ip_route_set_prefix(NMIPRoute *route, guint prefix); |
| 107 | const char *nm_ip_route_get_next_hop(NMIPRoute *route); |
| 108 | void nm_ip_route_set_next_hop(NMIPRoute *route, const char *next_hop); |
| 109 | gboolean nm_ip_route_get_next_hop_binary(NMIPRoute *route, gpointer next_hop); |
| 110 | void nm_ip_route_set_next_hop_binary(NMIPRoute *route, gconstpointer next_hop); |
| 111 | gint64 nm_ip_route_get_metric(NMIPRoute *route); |
| 112 | void nm_ip_route_set_metric(NMIPRoute *route, gint64 metric); |
| 113 | |
| 114 | char **nm_ip_route_get_attribute_names(NMIPRoute *route); |
| 115 | GVariant *nm_ip_route_get_attribute(NMIPRoute *route, const char *name); |
| 116 | void nm_ip_route_set_attribute(NMIPRoute *route, const char *name, GVariant *value); |
| 117 | NM_AVAILABLE_IN_1_8 |
| 118 | const NMVariantAttributeSpec *const *nm_ip_route_get_variant_attribute_spec(void); |
| 119 | NM_AVAILABLE_IN_1_8 |
| 120 | gboolean nm_ip_route_attribute_validate(const char *name, |
| 121 | GVariant *value, |
| 122 | int family, |
| 123 | gboolean *known, |
| 124 | GError **error); |
| 125 | |
| 126 | #define NM_IP_ROUTE_ATTRIBUTE_CWND "cwnd" |
| 127 | #define NM_IP_ROUTE_ATTRIBUTE_FROM "from" |
| 128 | #define NM_IP_ROUTE_ATTRIBUTE_INITCWND "initcwnd" |
| 129 | #define NM_IP_ROUTE_ATTRIBUTE_INITRWND "initrwnd" |
| 130 | #define NM_IP_ROUTE_ATTRIBUTE_LOCK_CWND "lock-cwnd" |
| 131 | #define NM_IP_ROUTE_ATTRIBUTE_LOCK_INITCWND "lock-initcwnd" |
| 132 | #define NM_IP_ROUTE_ATTRIBUTE_LOCK_INITRWND "lock-initrwnd" |
| 133 | #define NM_IP_ROUTE_ATTRIBUTE_LOCK_MTU "lock-mtu" |
| 134 | #define NM_IP_ROUTE_ATTRIBUTE_LOCK_WINDOW "lock-window" |
| 135 | #define NM_IP_ROUTE_ATTRIBUTE_MTU "mtu" |
| 136 | #define NM_IP_ROUTE_ATTRIBUTE_ONLINK "onlink" |
| 137 | #define NM_IP_ROUTE_ATTRIBUTE_SCOPE "scope" |
| 138 | #define NM_IP_ROUTE_ATTRIBUTE_SRC "src" |
| 139 | #define NM_IP_ROUTE_ATTRIBUTE_TABLE "table" |
| 140 | #define NM_IP_ROUTE_ATTRIBUTE_TOS "tos" |
| 141 | #define NM_IP_ROUTE_ATTRIBUTE_TYPE "type" |
| 142 | #define NM_IP_ROUTE_ATTRIBUTE_WINDOW "window" |
| 143 | |
| 144 | /*****************************************************************************/ |
| 145 | |
| 146 | typedef struct NMIPRoutingRule NMIPRoutingRule; |
| 147 | |
| 148 | NM_AVAILABLE_IN_1_18 |
| 149 | GType nm_ip_routing_rule_get_type(void); |
| 150 | |
| 151 | NM_AVAILABLE_IN_1_18 |
| 152 | NMIPRoutingRule *nm_ip_routing_rule_new(int addr_family); |
| 153 | |
| 154 | NM_AVAILABLE_IN_1_18 |
| 155 | NMIPRoutingRule *nm_ip_routing_rule_new_clone(const NMIPRoutingRule *rule); |
| 156 | |
| 157 | NM_AVAILABLE_IN_1_18 |
| 158 | NMIPRoutingRule *nm_ip_routing_rule_ref(NMIPRoutingRule *self); |
| 159 | NM_AVAILABLE_IN_1_18 |
| 160 | void nm_ip_routing_rule_unref(NMIPRoutingRule *self); |
| 161 | |
| 162 | NM_AVAILABLE_IN_1_18 |
| 163 | gboolean nm_ip_routing_rule_is_sealed(const NMIPRoutingRule *self); |
| 164 | NM_AVAILABLE_IN_1_18 |
| 165 | void nm_ip_routing_rule_seal(NMIPRoutingRule *self); |
| 166 | |
| 167 | NM_AVAILABLE_IN_1_18 |
| 168 | int nm_ip_routing_rule_get_addr_family(const NMIPRoutingRule *self); |
| 169 | |
| 170 | NM_AVAILABLE_IN_1_18 |
| 171 | gboolean nm_ip_routing_rule_get_invert(const NMIPRoutingRule *self); |
| 172 | NM_AVAILABLE_IN_1_18 |
| 173 | void nm_ip_routing_rule_set_invert(NMIPRoutingRule *self, gboolean invert); |
| 174 | |
| 175 | NM_AVAILABLE_IN_1_18 |
| 176 | gint64 nm_ip_routing_rule_get_priority(const NMIPRoutingRule *self); |
| 177 | NM_AVAILABLE_IN_1_18 |
| 178 | void nm_ip_routing_rule_set_priority(NMIPRoutingRule *self, gint64 priority); |
| 179 | |
| 180 | NM_AVAILABLE_IN_1_18 |
| 181 | guint8 nm_ip_routing_rule_get_tos(const NMIPRoutingRule *self); |
| 182 | NM_AVAILABLE_IN_1_18 |
| 183 | void nm_ip_routing_rule_set_tos(NMIPRoutingRule *self, guint8 tos); |
| 184 | |
| 185 | NM_AVAILABLE_IN_1_18 |
| 186 | guint8 nm_ip_routing_rule_get_ipproto(const NMIPRoutingRule *self); |
| 187 | NM_AVAILABLE_IN_1_18 |
| 188 | void nm_ip_routing_rule_set_ipproto(NMIPRoutingRule *self, guint8 ipproto); |
| 189 | |
| 190 | NM_AVAILABLE_IN_1_18 |
| 191 | guint16 nm_ip_routing_rule_get_source_port_start(const NMIPRoutingRule *self); |
| 192 | NM_AVAILABLE_IN_1_18 |
| 193 | guint16 nm_ip_routing_rule_get_source_port_end(const NMIPRoutingRule *self); |
| 194 | NM_AVAILABLE_IN_1_18 |
| 195 | void nm_ip_routing_rule_set_source_port(NMIPRoutingRule *self, guint16 start, guint16 end); |
| 196 | |
| 197 | NM_AVAILABLE_IN_1_18 |
| 198 | guint16 nm_ip_routing_rule_get_destination_port_start(const NMIPRoutingRule *self); |
| 199 | NM_AVAILABLE_IN_1_18 |
| 200 | guint16 nm_ip_routing_rule_get_destination_port_end(const NMIPRoutingRule *self); |
| 201 | NM_AVAILABLE_IN_1_18 |
| 202 | void nm_ip_routing_rule_set_destination_port(NMIPRoutingRule *self, guint16 start, guint16 end); |
| 203 | |
| 204 | NM_AVAILABLE_IN_1_18 |
| 205 | guint32 nm_ip_routing_rule_get_fwmark(const NMIPRoutingRule *self); |
| 206 | NM_AVAILABLE_IN_1_18 |
| 207 | guint32 nm_ip_routing_rule_get_fwmask(const NMIPRoutingRule *self); |
| 208 | NM_AVAILABLE_IN_1_18 |
| 209 | void nm_ip_routing_rule_set_fwmark(NMIPRoutingRule *self, guint32 fwmark, guint32 fwmask); |
| 210 | |
| 211 | NM_AVAILABLE_IN_1_18 |
| 212 | guint8 nm_ip_routing_rule_get_from_len(const NMIPRoutingRule *self); |
| 213 | NM_AVAILABLE_IN_1_18 |
| 214 | const char *nm_ip_routing_rule_get_from(const NMIPRoutingRule *self); |
| 215 | NM_AVAILABLE_IN_1_18 |
| 216 | void nm_ip_routing_rule_set_from(NMIPRoutingRule *self, const char *from, guint8 len); |
| 217 | |
| 218 | NM_AVAILABLE_IN_1_18 |
| 219 | guint8 nm_ip_routing_rule_get_to_len(const NMIPRoutingRule *self); |
| 220 | NM_AVAILABLE_IN_1_18 |
| 221 | const char *nm_ip_routing_rule_get_to(const NMIPRoutingRule *self); |
| 222 | NM_AVAILABLE_IN_1_18 |
| 223 | void nm_ip_routing_rule_set_to(NMIPRoutingRule *self, const char *to, guint8 len); |
| 224 | |
| 225 | NM_AVAILABLE_IN_1_18 |
| 226 | const char *nm_ip_routing_rule_get_iifname(const NMIPRoutingRule *self); |
| 227 | NM_AVAILABLE_IN_1_18 |
| 228 | void nm_ip_routing_rule_set_iifname(NMIPRoutingRule *self, const char *iifname); |
| 229 | |
| 230 | NM_AVAILABLE_IN_1_18 |
| 231 | const char *nm_ip_routing_rule_get_oifname(const NMIPRoutingRule *self); |
| 232 | NM_AVAILABLE_IN_1_18 |
| 233 | void nm_ip_routing_rule_set_oifname(NMIPRoutingRule *self, const char *oifname); |
| 234 | |
| 235 | NM_AVAILABLE_IN_1_18 |
| 236 | guint8 nm_ip_routing_rule_get_action(const NMIPRoutingRule *self); |
| 237 | NM_AVAILABLE_IN_1_18 |
| 238 | void nm_ip_routing_rule_set_action(NMIPRoutingRule *self, guint8 action); |
| 239 | |
| 240 | NM_AVAILABLE_IN_1_18 |
| 241 | guint32 nm_ip_routing_rule_get_table(const NMIPRoutingRule *self); |
| 242 | NM_AVAILABLE_IN_1_18 |
| 243 | void nm_ip_routing_rule_set_table(NMIPRoutingRule *self, guint32 table); |
| 244 | |
| 245 | NM_AVAILABLE_IN_1_20 |
| 246 | gint32 nm_ip_routing_rule_get_suppress_prefixlength(const NMIPRoutingRule *self); |
| 247 | NM_AVAILABLE_IN_1_20 |
| 248 | void nm_ip_routing_rule_set_suppress_prefixlength(NMIPRoutingRule *self, |
| 249 | gint32 suppress_prefixlength); |
| 250 | |
| 251 | NM_AVAILABLE_IN_1_34 |
| 252 | gboolean nm_ip_routing_rule_get_uid_range(const NMIPRoutingRule *self, |
| 253 | guint32 *out_range_start, |
| 254 | guint32 *out_range_end); |
| 255 | NM_AVAILABLE_IN_1_34 |
| 256 | void nm_ip_routing_rule_set_uid_range(NMIPRoutingRule *self, |
| 257 | guint32 uid_range_start, |
| 258 | guint32 uid_range_end); |
| 259 | |
| 260 | NM_AVAILABLE_IN_1_18 |
| 261 | int nm_ip_routing_rule_cmp(const NMIPRoutingRule *rule, const NMIPRoutingRule *other); |
| 262 | |
| 263 | NM_AVAILABLE_IN_1_18 |
| 264 | gboolean nm_ip_routing_rule_validate(const NMIPRoutingRule *self, GError **error); |
| 265 | |
| 266 | /** |
| 267 | * NMIPRoutingRuleAsStringFlags: |
| 268 | * @NM_IP_ROUTING_RULE_AS_STRING_FLAGS_NONE: no flags selected. |
| 269 | * @NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET: whether to allow parsing |
| 270 | * IPv4 addresses. |
| 271 | * @NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET6: whether to allow parsing |
| 272 | * IPv6 addresses. If both @NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET and |
| 273 | * @NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET6 are unset, it's the same |
| 274 | * as setting them both. |
| 275 | * @NM_IP_ROUTING_RULE_AS_STRING_FLAGS_VALIDATE: if set, ensure that the |
| 276 | * rule verfies or fail. |
| 277 | * |
| 278 | * Since: 1.18 |
| 279 | */ |
| 280 | typedef enum { /*< flags >*/ |
| 281 | NM_IP_ROUTING_RULE_AS_STRING_FLAGS_NONE = 0, |
| 282 | |
| 283 | NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET = 0x1, |
| 284 | NM_IP_ROUTING_RULE_AS_STRING_FLAGS_AF_INET6 = 0x2, |
| 285 | NM_IP_ROUTING_RULE_AS_STRING_FLAGS_VALIDATE = 0x4, |
| 286 | } NMIPRoutingRuleAsStringFlags; |
| 287 | |
| 288 | NM_AVAILABLE_IN_1_18 |
| 289 | NMIPRoutingRule *nm_ip_routing_rule_from_string(const char *str, |
| 290 | NMIPRoutingRuleAsStringFlags to_string_flags, |
| 291 | GHashTable *, |
| 292 | GError **error); |
| 293 | |
| 294 | NM_AVAILABLE_IN_1_18 |
| 295 | char *nm_ip_routing_rule_to_string(const NMIPRoutingRule *self, |
| 296 | NMIPRoutingRuleAsStringFlags to_string_flags, |
| 297 | GHashTable *, |
| 298 | GError **error); |
| 299 | |
| 300 | /*****************************************************************************/ |
| 301 | |
| 302 | #define NM_TYPE_SETTING_IP_CONFIG (nm_setting_ip_config_get_type()) |
| 303 | #define NM_SETTING_IP_CONFIG(obj) \ |
| 304 | (G_TYPE_CHECK_INSTANCE_CAST((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig)) |
| 305 | #define NM_SETTING_IP_CONFIG_CLASS(klass) \ |
| 306 | (G_TYPE_CHECK_CLASS_CAST((klass), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass)) |
| 307 | #define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NM_TYPE_SETTING_IP_CONFIG)) |
| 308 | #define NM_IS_SETTING_IP_CONFIG_CLASS(klass) \ |
| 309 | (G_TYPE_CHECK_CLASS_TYPE((klass), NM_TYPE_SETTING_IP_CONFIG)) |
| 310 | #define NM_SETTING_IP_CONFIG_GET_CLASS(obj) \ |
| 311 | (G_TYPE_INSTANCE_GET_CLASS((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass)) |
| 312 | |
| 313 | #define NM_SETTING_IP_CONFIG_DAD_TIMEOUT_MAX 30000 |
| 314 | |
| 315 | #define NM_SETTING_IP_CONFIG_METHOD "method" |
| 316 | #define NM_SETTING_IP_CONFIG_DNS "dns" |
| 317 | #define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search" |
| 318 | #define NM_SETTING_IP_CONFIG_DNS_OPTIONS "dns-options" |
| 319 | #define NM_SETTING_IP_CONFIG_DNS_PRIORITY "dns-priority" |
| 320 | #define NM_SETTING_IP_CONFIG_ADDRESSES "addresses" |
| 321 | #define NM_SETTING_IP_CONFIG_GATEWAY "gateway" |
| 322 | #define NM_SETTING_IP_CONFIG_ROUTES "routes" |
| 323 | #define NM_SETTING_IP_CONFIG_ROUTE_METRIC "route-metric" |
| 324 | #define NM_SETTING_IP_CONFIG_ROUTE_TABLE "route-table" |
| 325 | #define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes" |
| 326 | #define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns" |
| 327 | #define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname" |
| 328 | #define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname" |
| 329 | #define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME_FLAGS "dhcp-hostname-flags" |
| 330 | #define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default" |
| 331 | #define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail" |
| 332 | #define NM_SETTING_IP_CONFIG_DAD_TIMEOUT "dad-timeout" |
| 333 | #define NM_SETTING_IP_CONFIG_DHCP_TIMEOUT "dhcp-timeout" |
| 334 | #define NM_SETTING_IP_CONFIG_REQUIRED_TIMEOUT "required-timeout" |
| 335 | #define NM_SETTING_IP_CONFIG_DHCP_IAID "dhcp-iaid" |
| 336 | #define NM_SETTING_IP_CONFIG_DHCP_REJECT_SERVERS "dhcp-reject-servers" |
| 337 | |
| 338 | /* these are not real GObject properties. */ |
| 339 | #define NM_SETTING_IP_CONFIG_ROUTING_RULES "routing-rules" |
| 340 | |
| 341 | #define NM_SETTING_DNS_OPTION_DEBUG "debug" |
| 342 | #define NM_SETTING_DNS_OPTION_NDOTS "ndots" |
| 343 | #define NM_SETTING_DNS_OPTION_TIMEOUT "timeout" |
| 344 | #define NM_SETTING_DNS_OPTION_ATTEMPTS "attempts" |
| 345 | #define NM_SETTING_DNS_OPTION_ROTATE "rotate" |
| 346 | #define NM_SETTING_DNS_OPTION_NO_CHECK_NAMES "no-check-names" |
| 347 | #define NM_SETTING_DNS_OPTION_INET6 "inet6" |
| 348 | #define NM_SETTING_DNS_OPTION_IP6_BYTESTRING "ip6-bytestring" |
| 349 | #define NM_SETTING_DNS_OPTION_IP6_DOTINT "ip6-dotint" |
| 350 | #define NM_SETTING_DNS_OPTION_NO_IP6_DOTINT "no-ip6-dotint" |
| 351 | #define NM_SETTING_DNS_OPTION_EDNS0 "edns0" |
| 352 | #define NM_SETTING_DNS_OPTION_SINGLE_REQUEST "single-request" |
| 353 | #define NM_SETTING_DNS_OPTION_SINGLE_REQUEST_REOPEN "single-request-reopen" |
| 354 | #define NM_SETTING_DNS_OPTION_NO_TLD_QUERY "no-tld-query" |
| 355 | #define NM_SETTING_DNS_OPTION_USE_VC "use-vc" |
| 356 | #define NM_SETTING_DNS_OPTION_NO_RELOAD "no-reload" |
| 357 | #define NM_SETTING_DNS_OPTION_TRUST_AD "trust-ad" |
| 358 | |
| 359 | typedef struct _NMSettingIPConfigClass NMSettingIPConfigClass; |
| 360 | |
| 361 | /** |
| 362 | * NMDhcpHostnameFlags: |
| 363 | * @NM_DHCP_HOSTNAME_FLAG_NONE: no flag set. The default value from |
| 364 | * Networkmanager global configuration is used. If such value is unset |
| 365 | * or still zero, the DHCP request will use standard FQDN flags, i.e. |
| 366 | * %NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE and |
| 367 | * %NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED for IPv4 and |
| 368 | * %NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE for IPv6. |
| 369 | * @NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE: whether the server should |
| 370 | * do the A RR (FQDN-to-address) DNS updates. |
| 371 | * @NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED: if set, the FQDN is encoded |
| 372 | * using canonical wire format. Otherwise it uses the deprecated |
| 373 | * ASCII encoding. This flag is allowed only for DHCPv4. |
| 374 | * @NM_DHCP_HOSTNAME_FLAG_FQDN_NO_UPDATE: when not set, request the |
| 375 | * server to perform updates (the PTR RR and possibly the A RR |
| 376 | * based on the %NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE flag). If |
| 377 | * this is set, the %NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE flag |
| 378 | * should be cleared. |
| 379 | * @NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS: when set, no FQDN flags are |
| 380 | * sent in the DHCP FQDN option. When cleared and all other FQDN |
| 381 | * flags are zero, standard FQDN flags are sent. This flag is |
| 382 | * incompatible with any other FQDN flag. |
| 383 | * |
| 384 | * #NMDhcpHostnameFlags describe flags related to the DHCP hostname and |
| 385 | * FQDN. |
| 386 | * |
| 387 | * Since: 1.22 |
| 388 | */ |
| 389 | typedef enum { /*< flags >*/ |
| 390 | NM_DHCP_HOSTNAME_FLAG_NONE = 0x0, |
| 391 | |
| 392 | NM_DHCP_HOSTNAME_FLAG_FQDN_SERV_UPDATE = 0x1, |
| 393 | NM_DHCP_HOSTNAME_FLAG_FQDN_ENCODED = 0x2, |
| 394 | NM_DHCP_HOSTNAME_FLAG_FQDN_NO_UPDATE = 0x4, |
| 395 | |
| 396 | NM_DHCP_HOSTNAME_FLAG_FQDN_CLEAR_FLAGS = 0x8, |
| 397 | |
| 398 | } NMDhcpHostnameFlags; |
| 399 | |
| 400 | GType nm_setting_ip_config_get_type(void); |
| 401 | |
| 402 | const char *nm_setting_ip_config_get_method(NMSettingIPConfig *setting); |
| 403 | |
| 404 | guint nm_setting_ip_config_get_num_dns(NMSettingIPConfig *setting); |
| 405 | const char *nm_setting_ip_config_get_dns(NMSettingIPConfig *setting, int idx); |
| 406 | gboolean nm_setting_ip_config_add_dns(NMSettingIPConfig *setting, const char *dns); |
| 407 | void nm_setting_ip_config_remove_dns(NMSettingIPConfig *setting, int idx); |
| 408 | gboolean nm_setting_ip_config_remove_dns_by_value(NMSettingIPConfig *setting, const char *dns); |
| 409 | void nm_setting_ip_config_clear_dns(NMSettingIPConfig *setting); |
| 410 | |
| 411 | guint nm_setting_ip_config_get_num_dns_searches(NMSettingIPConfig *setting); |
| 412 | const char *nm_setting_ip_config_get_dns_search(NMSettingIPConfig *setting, int idx); |
| 413 | gboolean nm_setting_ip_config_add_dns_search(NMSettingIPConfig *setting, const char *dns_search); |
| 414 | void nm_setting_ip_config_remove_dns_search(NMSettingIPConfig *setting, int idx); |
| 415 | gboolean nm_setting_ip_config_remove_dns_search_by_value(NMSettingIPConfig *setting, |
| 416 | const char *dns_search); |
| 417 | void nm_setting_ip_config_clear_dns_searches(NMSettingIPConfig *setting); |
| 418 | |
| 419 | guint nm_setting_ip_config_get_num_dns_options(NMSettingIPConfig *setting); |
| 420 | gboolean nm_setting_ip_config_has_dns_options(NMSettingIPConfig *setting); |
| 421 | const char *nm_setting_ip_config_get_dns_option(NMSettingIPConfig *setting, guint idx); |
| 422 | gboolean nm_setting_ip_config_add_dns_option(NMSettingIPConfig *setting, const char *dns_option); |
| 423 | void nm_setting_ip_config_remove_dns_option(NMSettingIPConfig *setting, int idx); |
| 424 | gboolean nm_setting_ip_config_remove_dns_option_by_value(NMSettingIPConfig *setting, |
| 425 | const char *dns_option); |
| 426 | void nm_setting_ip_config_clear_dns_options(NMSettingIPConfig *setting, gboolean is_set); |
| 427 | |
| 428 | NM_AVAILABLE_IN_1_4 |
| 429 | int nm_setting_ip_config_get_dns_priority(NMSettingIPConfig *setting); |
| 430 | |
| 431 | guint nm_setting_ip_config_get_num_addresses(NMSettingIPConfig *setting); |
| 432 | NMIPAddress *nm_setting_ip_config_get_address(NMSettingIPConfig *setting, int idx); |
| 433 | gboolean nm_setting_ip_config_add_address(NMSettingIPConfig *setting, NMIPAddress *address); |
| 434 | void nm_setting_ip_config_remove_address(NMSettingIPConfig *setting, int idx); |
| 435 | gboolean nm_setting_ip_config_remove_address_by_value(NMSettingIPConfig *setting, |
| 436 | NMIPAddress *address); |
| 437 | void nm_setting_ip_config_clear_addresses(NMSettingIPConfig *setting); |
| 438 | |
| 439 | const char *nm_setting_ip_config_get_gateway(NMSettingIPConfig *setting); |
| 440 | |
| 441 | guint nm_setting_ip_config_get_num_routes(NMSettingIPConfig *setting); |
| 442 | NMIPRoute *nm_setting_ip_config_get_route(NMSettingIPConfig *setting, int idx); |
| 443 | gboolean nm_setting_ip_config_add_route(NMSettingIPConfig *setting, NMIPRoute *route); |
| 444 | void nm_setting_ip_config_remove_route(NMSettingIPConfig *setting, int idx); |
| 445 | gboolean nm_setting_ip_config_remove_route_by_value(NMSettingIPConfig *setting, NMIPRoute *route); |
| 446 | void nm_setting_ip_config_clear_routes(NMSettingIPConfig *setting); |
| 447 | |
| 448 | gint64 nm_setting_ip_config_get_route_metric(NMSettingIPConfig *setting); |
| 449 | |
| 450 | NM_AVAILABLE_IN_1_10 |
| 451 | guint32 nm_setting_ip_config_get_route_table(NMSettingIPConfig *setting); |
| 452 | |
| 453 | NM_AVAILABLE_IN_1_18 |
| 454 | guint nm_setting_ip_config_get_num_routing_rules(NMSettingIPConfig *setting); |
| 455 | NM_AVAILABLE_IN_1_18 |
| 456 | NMIPRoutingRule *nm_setting_ip_config_get_routing_rule(NMSettingIPConfig *setting, guint idx); |
| 457 | NM_AVAILABLE_IN_1_18 |
| 458 | void nm_setting_ip_config_add_routing_rule(NMSettingIPConfig *setting, |
| 459 | NMIPRoutingRule *routing_rule); |
| 460 | NM_AVAILABLE_IN_1_18 |
| 461 | void nm_setting_ip_config_remove_routing_rule(NMSettingIPConfig *setting, guint idx); |
| 462 | NM_AVAILABLE_IN_1_18 |
| 463 | void nm_setting_ip_config_clear_routing_rules(NMSettingIPConfig *setting); |
| 464 | |
| 465 | gboolean nm_setting_ip_config_get_ignore_auto_routes(NMSettingIPConfig *setting); |
| 466 | gboolean nm_setting_ip_config_get_ignore_auto_dns(NMSettingIPConfig *setting); |
| 467 | |
| 468 | const char *nm_setting_ip_config_get_dhcp_hostname(NMSettingIPConfig *setting); |
| 469 | gboolean nm_setting_ip_config_get_dhcp_send_hostname(NMSettingIPConfig *setting); |
| 470 | |
| 471 | gboolean nm_setting_ip_config_get_never_default(NMSettingIPConfig *setting); |
| 472 | gboolean nm_setting_ip_config_get_may_fail(NMSettingIPConfig *setting); |
| 473 | NM_AVAILABLE_IN_1_2 |
| 474 | int nm_setting_ip_config_get_dad_timeout(NMSettingIPConfig *setting); |
| 475 | NM_AVAILABLE_IN_1_2 |
| 476 | int nm_setting_ip_config_get_dhcp_timeout(NMSettingIPConfig *setting); |
| 477 | NM_AVAILABLE_IN_1_34 |
| 478 | int nm_setting_ip_config_get_required_timeout(NMSettingIPConfig *setting); |
| 479 | NM_AVAILABLE_IN_1_22 |
| 480 | const char *nm_setting_ip_config_get_dhcp_iaid(NMSettingIPConfig *setting); |
| 481 | |
| 482 | NM_AVAILABLE_IN_1_22 |
| 483 | NMDhcpHostnameFlags nm_setting_ip_config_get_dhcp_hostname_flags(NMSettingIPConfig *setting); |
| 484 | |
| 485 | NM_AVAILABLE_IN_1_28 |
| 486 | const char *const *nm_setting_ip_config_get_dhcp_reject_servers(NMSettingIPConfig *setting, |
| 487 | guint *out_len); |
| 488 | NM_AVAILABLE_IN_1_28 |
| 489 | void nm_setting_ip_config_add_dhcp_reject_server(NMSettingIPConfig *setting, const char *server); |
| 490 | NM_AVAILABLE_IN_1_28 |
| 491 | void nm_setting_ip_config_remove_dhcp_reject_server(NMSettingIPConfig *setting, guint idx); |
| 492 | NM_AVAILABLE_IN_1_28 |
| 493 | void nm_setting_ip_config_clear_dhcp_reject_servers(NMSettingIPConfig *setting); |
| 494 | |
| 495 | G_END_DECLS |
| 496 | |
| 497 | #endif /* NM_SETTING_IP_CONFIG_H */ |
| 498 | |