/** * nm_setting_ip6_config_get_num_routes: * @setting: the #NMSettingIP6Config * * Returns: the number of configured routes **/ guint32 nm_setting_ip6_config_get_num_routes (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), 0); return g_slist_length (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->routes); }
/** * nm_setting_ip6_config_get_ip6_privacy: * @setting: the #NMSettingIP6Config * * Returns the value contained in the #NMSettingIP6Config:ip6-privacy * property. * * Returns: IPv6 Privacy Extensions configuration value (#NMSettingIP6ConfigPrivacy). **/ NMSettingIP6ConfigPrivacy nm_setting_ip6_config_get_ip6_privacy (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NM_SETTING_IP6_CONFIG_PRIVACY_UNKNOWN); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ip6_privacy; }
/** * nm_setting_ip6_config_get_ignore_auto_routes: * @setting: the #NMSettingIP6Config * * Returns the value contained in the #NMSettingIP6Config:ignore-auto-routes * property. * * Returns: %TRUE if automatically configured (ie via DHCP) routes should be * ignored. **/ gboolean nm_setting_ip6_config_get_ignore_auto_routes (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->ignore_auto_routes; }
/** * nm_setting_ip6_config_get_dhcp_hostname: * @setting: the #NMSettingIP6Config * * Returns the value contained in the #NMSettingIP6Config:dhcp-hostname * property. * * Returns: the configured hostname to send to the DHCP server **/ const char * nm_setting_ip6_config_get_dhcp_hostname (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dhcp_hostname; }
/** * nm_setting_ip6_config_get_may_fail: * @setting: the #NMSettingIP6Config * * Returns the value contained in the #NMSettingIP6Config:may-fail * property. * * Returns: %TRUE if this connection doesn't require IPv6 addressing to complete * for the connection to succeed. **/ gboolean nm_setting_ip6_config_get_may_fail (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->may_fail; }
/** * nm_setting_ip6_config_get_method: * @setting: the #NMSettingIP6Config * * Returns: the #NMSettingIP6Config:method property of the setting **/ const char * nm_setting_ip6_config_get_method (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->method; }
/** * nm_setting_ip6_config_get_addr_gen_mode: * @setting: the #NMSettingIP6Config * * Returns the value contained in the #NMSettingIP6Config:addr-gen-mode * property. * * Returns: IPv6 Address Generation Mode. * * Since: 1.2 **/ NMSettingIP6ConfigAddrGenMode nm_setting_ip6_config_get_addr_gen_mode (NMSettingIP6Config *setting) { g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_STABLE_PRIVACY); return NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->addr_gen_mode; }
/** * nm_setting_ip6_config_clear_dns_searches: * @setting: the #NMSettingIP6Config * * Removes all configured DNS search domains. **/ void nm_setting_ip6_config_clear_dns_searches (NMSettingIP6Config *setting) { g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); nm_utils_slist_free (NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search, g_free); NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting)->dns_search = NULL; }
/** * nm_setting_ip6_config_clear_routes: * @setting: the #NMSettingIP6Config * * Removes all configured routes. **/ void nm_setting_ip6_config_clear_routes (NMSettingIP6Config *setting) { NMSettingIP6ConfigPrivate *priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); nm_utils_slist_free (priv->routes, (GDestroyNotify) nm_ip6_route_unref); priv->routes = NULL; }
/** * nm_setting_ip6_config_get_route: * @setting: the #NMSettingIP6Config * @i: index number of the route to return * * Returns: the route at index @i **/ NMIP6Route * nm_setting_ip6_config_get_route (NMSettingIP6Config *setting, guint32 i) { NMSettingIP6ConfigPrivate *priv; g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); g_return_val_if_fail (i <= g_slist_length (priv->routes), NULL); return (NMIP6Route *) g_slist_nth_data (priv->routes, i); }
/** * nm_setting_ip6_config_get_dns_search: * @setting: the #NMSettingIP6Config * @i: index number of the DNS search domain to return * * Returns: the DNS search domain at index @i **/ const char * nm_setting_ip6_config_get_dns_search (NMSettingIP6Config *setting, guint32 i) { NMSettingIP6ConfigPrivate *priv; g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), NULL); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); g_return_val_if_fail (i <= g_slist_length (priv->dns_search), NULL); return (const char *) g_slist_nth_data (priv->dns_search, i); }
/** * nm_setting_ip6_config_remove_route: * @setting: the #NMSettingIP6Config * @i: index number of the route * * Removes the route at index @i. **/ void nm_setting_ip6_config_remove_route (NMSettingIP6Config *setting, guint32 i) { NMSettingIP6ConfigPrivate *priv; GSList *elt; g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); elt = g_slist_nth (priv->routes, i); g_return_if_fail (elt != NULL); nm_ip6_route_unref ((NMIP6Route *) elt->data); priv->routes = g_slist_delete_link (priv->routes, elt); }
/** * nm_setting_ip6_config_remove_dns_search: * @setting: the #NMSettingIP6Config * @i: index number of the DNS search domain * * Removes the DNS search domain at index @i. **/ void nm_setting_ip6_config_remove_dns_search (NMSettingIP6Config *setting, guint32 i) { NMSettingIP6ConfigPrivate *priv; GSList *elt; g_return_if_fail (NM_IS_SETTING_IP6_CONFIG (setting)); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); elt = g_slist_nth (priv->dns_search, i); g_return_if_fail (elt != NULL); g_free (elt->data); priv->dns_search = g_slist_delete_link (priv->dns_search, elt); }
/** * nm_setting_ip6_config_add_dns_search: * @setting: the #NMSettingIP6Config * @dns_search: the search domain to add * * Adds a new DNS search domain to the setting. * * Returns: %TRUE if the DNS search domain was added; %FALSE if the search * domain was already known **/ gboolean nm_setting_ip6_config_add_dns_search (NMSettingIP6Config *setting, const char *dns_search) { NMSettingIP6ConfigPrivate *priv; GSList *iter; g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); g_return_val_if_fail (dns_search != NULL, FALSE); g_return_val_if_fail (dns_search[0] != '\0', FALSE); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); for (iter = priv->dns_search; iter; iter = g_slist_next (iter)) { if (!strcmp (dns_search, (char *) iter->data)) return FALSE; } priv->dns_search = g_slist_append (priv->dns_search, g_strdup (dns_search)); return TRUE; }
/** * nm_setting_ip6_config_add_dns: * @setting: the #NMSettingIP6Config * @dns: the IPv6 address of the DNS server to add * * Adds a new DNS server to the setting. * * Returns: %TRUE if the DNS server was added; %FALSE if the server was already * known **/ gboolean nm_setting_ip6_config_add_dns (NMSettingIP6Config *setting, const struct in6_addr *addr) { NMSettingIP6ConfigPrivate *priv; struct in6_addr *copy; GSList *iter; g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); for (iter = priv->dns; iter; iter = g_slist_next (iter)) { if (!memcmp (addr, (struct in6_addr *) iter->data, sizeof (struct in6_addr))) return FALSE; } copy = g_malloc0 (sizeof (struct in6_addr)); memcpy (copy, addr, sizeof (struct in6_addr)); priv->dns = g_slist_append (priv->dns, copy); return TRUE; }
/** * nm_setting_ip6_config_add_route: * @setting: the #NMSettingIP6Config * @route: the route to add * * Adds a new IPv6 route and associated information to the setting. The * given route is duplicated internally and is not changed by this function. * * Returns: %TRUE if the route was added; %FALSE if the route was already known. **/ gboolean nm_setting_ip6_config_add_route (NMSettingIP6Config *setting, NMIP6Route *route) { NMSettingIP6ConfigPrivate *priv; NMIP6Route *copy; GSList *iter; g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); g_return_val_if_fail (route != NULL, FALSE); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); for (iter = priv->routes; iter; iter = g_slist_next (iter)) { if (nm_ip6_route_compare ((NMIP6Route *) iter->data, route)) return FALSE; } copy = nm_ip6_route_dup (route); g_return_val_if_fail (copy != NULL, FALSE); priv->routes = g_slist_append (priv->routes, copy); return TRUE; }
/** * nm_setting_ip6_config_add_address: * @setting: the #NMSettingIP6Config * @address: the new address to add * * Adds a new IPv6 address and associated information to the setting. The * given address is duplicated internally and is not changed by this function. * * Returns: %TRUE if the address was added; %FALSE if the address was already * known. **/ gboolean nm_setting_ip6_config_add_address (NMSettingIP6Config *setting, NMIP6Address *address) { NMSettingIP6ConfigPrivate *priv; NMIP6Address *copy; GSList *iter; g_return_val_if_fail (NM_IS_SETTING_IP6_CONFIG (setting), FALSE); g_return_val_if_fail (address != NULL, FALSE); priv = NM_SETTING_IP6_CONFIG_GET_PRIVATE (setting); for (iter = priv->addresses; iter; iter = g_slist_next (iter)) { if (nm_ip6_address_compare ((NMIP6Address *) iter->data, address)) return FALSE; } copy = nm_ip6_address_dup (address); g_return_val_if_fail (copy != NULL, FALSE); priv->addresses = g_slist_append (priv->addresses, copy); return TRUE; }