static void get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) { NMSettingIP4Config *setting = NM_SETTING_IP4_CONFIG (object); NMSettingIP4ConfigPrivate *priv = NM_SETTING_IP4_CONFIG_GET_PRIVATE (setting); switch (prop_id) { case PROP_METHOD: g_value_set_string (value, nm_setting_ip4_config_get_method (setting)); break; case PROP_DNS: g_value_set_boxed (value, priv->dns); break; case PROP_DNS_SEARCH: g_value_set_boxed (value, priv->dns_search); break; case PROP_ADDRESSES: nm_utils_ip4_addresses_to_gvalue (priv->addresses, value); break; case PROP_ROUTES: nm_utils_ip4_routes_to_gvalue (priv->routes, value); break; case PROP_IGNORE_AUTO_ROUTES: g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_routes (setting)); break; case PROP_IGNORE_AUTO_DNS: g_value_set_boolean (value, nm_setting_ip4_config_get_ignore_auto_dns (setting)); break; case PROP_DHCP_CLIENT_ID: g_value_set_string (value, nm_setting_ip4_config_get_dhcp_client_id (setting)); break; case PROP_DHCP_SEND_HOSTNAME: g_value_set_boolean (value, nm_setting_ip4_config_get_dhcp_send_hostname (setting)); break; case PROP_DHCP_HOSTNAME: g_value_set_string (value, nm_setting_ip4_config_get_dhcp_hostname (setting)); break; case PROP_NEVER_DEFAULT: g_value_set_boolean (value, priv->never_default); break; case PROP_MAY_FAIL: g_value_set_boolean (value, priv->may_fail); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/* Caller owns a reference to the NMDHCPClient on return */ NMDHCPClient * nm_dhcp_manager_start_ip4 (NMDHCPManager *self, const char *iface, const char *uuid, NMSettingIP4Config *s_ip4, guint32 timeout, guint8 *dhcp_anycast_addr) { NMDHCPManagerPrivate *priv; NMDHCPClient *client = NULL; const char *hostname = NULL; g_return_val_if_fail (self, NULL); g_return_val_if_fail (NM_IS_DHCP_MANAGER (self), NULL); priv = NM_DHCP_MANAGER_GET_PRIVATE (self); if (s_ip4) { const char *method = nm_setting_ip4_config_get_method (s_ip4); if (method) { /* Method must be 'auto' */ g_return_val_if_fail (strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO) == 0, NULL); } /* If we're asked to send the hostname to DHCP server, and the hostname * isn't specified, and a hostname provider is registered: use that */ if (nm_setting_ip4_config_get_dhcp_send_hostname (s_ip4)) { hostname = nm_setting_ip4_config_get_dhcp_hostname (s_ip4); /* If we're supposed to send the hostname to the DHCP server but * the user didn't specify one, use the persistent hostname. */ if (!hostname && priv->hostname_provider) { hostname = nm_hostname_provider_get_hostname (priv->hostname_provider); if ( hostname && (!strcmp (hostname, "localhost.localdomain") || !strcmp (hostname, "localhost6.localdomain6"))) hostname = NULL; } } } client = client_start (self, iface, uuid, FALSE, s_ip4, NULL, timeout, dhcp_anycast_addr, hostname, FALSE); return client; }