Commit 3f30c6f1 authored by Dan Winship's avatar Dan Winship

libnm-core: extract NMSettingIPConfig superclass out of IP4, IP6 classes

Split a base NMSettingIPConfig class out of NMSettingIP4Config and
NMSettingIP6Config, and update things accordingly.

Further simplifications of now-redundant IPv4-vs-IPv6 code are
possible, and should happen in the future.
parent 39709fdc
......@@ -2889,7 +2889,7 @@ check_and_convert_vlan_prio_maps (const char *prio_map,
static gboolean
add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
{
NMSettingIP4Config *s_ip4;
NMSettingIPConfig *s_ip4;
gboolean ret;
if (!ip4addr)
......@@ -2897,13 +2897,13 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
s_ip4 = nm_connection_get_setting_ip4_config (connection);
if (!s_ip4) {
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
g_object_set (s_ip4,
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_MANUAL,
NULL);
}
ret = nm_setting_ip4_config_add_address (s_ip4, ip4addr);
ret = nm_setting_ip_config_add_address (s_ip4, ip4addr);
nm_ip_address_unref (ip4addr);
return ret;
......@@ -2912,7 +2912,7 @@ add_ip4_address_to_connection (NMIPAddress *ip4addr, NMConnection *connection)
static gboolean
add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
{
NMSettingIP6Config *s_ip6;
NMSettingIPConfig *s_ip6;
gboolean ret;
if (!ip6addr)
......@@ -2920,13 +2920,13 @@ add_ip6_address_to_connection (NMIPAddress *ip6addr, NMConnection *connection)
s_ip6 = nm_connection_get_setting_ip6_config (connection);
if (!s_ip6) {
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
nm_connection_add_setting (connection, NM_SETTING (s_ip6));
g_object_set (s_ip6,
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_MANUAL,
NULL);
}
ret = nm_setting_ip6_config_add_address (s_ip6, ip6addr);
ret = nm_setting_ip_config_add_address (s_ip6, ip6addr);
nm_ip_address_unref (ip6addr);
return ret;
......@@ -8107,8 +8107,7 @@ editor_init_new_connection (NmCli *nmc, NMConnection *connection)
static void
editor_init_existing_connection (NMConnection *connection)
{
NMSettingIP4Config *s_ip4;
NMSettingIP6Config *s_ip6;
NMSettingIPConfig *s_ip4, *s_ip6;
NMSettingWireless *s_wireless;
NMSettingConnection *s_con;
......
This diff is collapsed.
......@@ -30,8 +30,8 @@ void nmc_properties_cleanup (void);
NMSetting *nmc_setting_new_for_name (const char *name);
void nmc_setting_custom_init (NMSetting *setting);
void nmc_setting_ip4_connect_handlers (NMSettingIP4Config *setting);
void nmc_setting_ip6_connect_handlers (NMSettingIP6Config *setting);
void nmc_setting_ip4_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_ip6_connect_handlers (NMSettingIPConfig *setting);
void nmc_setting_wireless_connect_handlers (NMSettingWireless *setting);
void nmc_setting_connection_connect_handlers (NMSettingConnection *setting, NMConnection *connection);
......
......@@ -59,12 +59,12 @@ static gboolean
nmt_page_ip4_show_by_default (NmtEditorPage *page)
{
NMConnection *conn;
NMSettingIP4Config *s_ip4;
NMSettingIPConfig *s_ip4;
conn = nmt_editor_page_get_connection (page);
s_ip4 = nm_connection_get_setting_ip4_config (conn);
if ( !g_strcmp0 (nm_setting_ip4_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|| nm_setting_ip4_config_get_num_addresses (s_ip4))
if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip4), NM_SETTING_IP4_CONFIG_METHOD_MANUAL)
|| nm_setting_ip_config_get_num_addresses (s_ip4))
return TRUE;
return FALSE;
}
......@@ -115,22 +115,22 @@ nmt_page_ip4_constructed (GObject *object)
{
NmtPageIP4 *ip4 = NMT_PAGE_IP4 (object);
NmtPageGrid *grid;
NMSettingIP4Config *s_ip4;
NMSettingIPConfig *s_ip4;
NmtNewtWidget *widget, *button;
NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip4));
s_ip4 = nm_connection_get_setting_ip4_config (conn);
if (!s_ip4) {
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
s_ip4 = (NMSettingIPConfig *) nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (s_ip4),
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
nm_connection_add_setting (conn, (NMSetting *) s_ip4);
}
widget = nmt_newt_popup_new (ip4methods);
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_METHOD,
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_METHOD,
widget, "active-id",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip4), widget);
......@@ -139,27 +139,27 @@ nmt_page_ip4_constructed (GObject *object)
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4_WITH_PREFIX);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET,
s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES,
s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
widget = nmt_ip_entry_new (25, AF_INET, FALSE, TRUE);
nm_editor_bind_ip_gateway_to_string (AF_INET,
s_ip4, NM_SETTING_IP4_CONFIG_ADDRESSES,
s_ip4, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP4);
nm_editor_bind_ip_addresses_to_strv (AF_INET,
s_ip4, NM_SETTING_IP4_CONFIG_DNS,
s_ip4, NM_SETTING_IP_CONFIG_DNS,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_DNS_SEARCH,
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_DNS_SEARCH,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
......@@ -170,7 +170,7 @@ nmt_page_ip4_constructed (GObject *object)
"text", "",
"style", NMT_NEWT_LABEL_PLAIN,
NULL);
g_object_bind_property_full (s_ip4, NM_SETTING_IP4_CONFIG_ROUTES,
g_object_bind_property_full (s_ip4, NM_SETTING_IP_CONFIG_ROUTES,
widget, "text",
G_BINDING_SYNC_CREATE,
ip4_routes_transform_to_description,
......@@ -180,7 +180,7 @@ nmt_page_ip4_constructed (GObject *object)
nmt_page_grid_append (grid, _("Routing"), widget, button);
widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_NEVER_DEFAULT,
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
nmt_page_grid_append (grid, NULL, widget, NULL);
......@@ -188,7 +188,7 @@ nmt_page_ip4_constructed (GObject *object)
nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
widget = nmt_newt_checkbox_new (_("Require IPv4 addressing for this connection"));
g_object_bind_property (s_ip4, NM_SETTING_IP4_CONFIG_MAY_FAIL,
g_object_bind_property (s_ip4, NM_SETTING_IP_CONFIG_MAY_FAIL,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
G_BINDING_INVERT_BOOLEAN);
......
......@@ -59,12 +59,12 @@ static gboolean
nmt_page_ip6_show_by_default (NmtEditorPage *page)
{
NMConnection *conn;
NMSettingIP6Config *s_ip6;
NMSettingIPConfig *s_ip6;
conn = nmt_editor_page_get_connection (page);
s_ip6 = nm_connection_get_setting_ip6_config (conn);
if ( !g_strcmp0 (nm_setting_ip6_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
|| nm_setting_ip6_config_get_num_addresses (s_ip6))
if ( !g_strcmp0 (nm_setting_ip_config_get_method (s_ip6), NM_SETTING_IP6_CONFIG_METHOD_MANUAL)
|| nm_setting_ip_config_get_num_addresses (s_ip6))
return TRUE;
return FALSE;
}
......@@ -115,22 +115,22 @@ nmt_page_ip6_constructed (GObject *object)
{
NmtPageIP6 *ip6 = NMT_PAGE_IP6 (object);
NmtPageGrid *grid;
NMSettingIP6Config *s_ip6;
NMSettingIPConfig *s_ip6;
NmtNewtWidget *widget, *button;
NMConnection *conn;
conn = nmt_editor_page_get_connection (NMT_EDITOR_PAGE (ip6));
s_ip6 = nm_connection_get_setting_ip6_config (conn);
if (!s_ip6) {
s_ip6 = (NMSettingIP6Config *) nm_setting_ip6_config_new ();
s_ip6 = (NMSettingIPConfig *) nm_setting_ip6_config_new ();
g_object_set (G_OBJECT (s_ip6),
NM_SETTING_IP6_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP6_CONFIG_METHOD_AUTO,
NULL);
nm_connection_add_setting (conn, (NMSetting *) s_ip6);
}
widget = nmt_newt_popup_new (ip6methods);
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_METHOD,
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_METHOD,
widget, "active-id",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_editor_page_set_header_widget (NMT_EDITOR_PAGE (ip6), widget);
......@@ -139,27 +139,27 @@ nmt_page_ip6_constructed (GObject *object)
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6_WITH_PREFIX);
nm_editor_bind_ip_addresses_with_prefix_to_strv (AF_INET6,
s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES,
s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Addresses"), widget, NULL);
widget = nmt_ip_entry_new (25, AF_INET6, FALSE, TRUE);
nm_editor_bind_ip_gateway_to_string (AF_INET6,
s_ip6, NM_SETTING_IP6_CONFIG_ADDRESSES,
s_ip6, NM_SETTING_IP_CONFIG_ADDRESSES,
widget, "text",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Gateway"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_IP6);
nm_editor_bind_ip_addresses_to_strv (AF_INET6,
s_ip6, NM_SETTING_IP6_CONFIG_DNS,
s_ip6, NM_SETTING_IP_CONFIG_DNS,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("DNS servers"), widget, NULL);
widget = nmt_address_list_new (NMT_ADDRESS_LIST_HOSTNAME);
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_DNS_SEARCH,
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_DNS_SEARCH,
widget, "strings",
G_BINDING_BIDIRECTIONAL | G_BINDING_SYNC_CREATE);
nmt_page_grid_append (grid, _("Search domains"), widget, NULL);
......@@ -168,7 +168,7 @@ nmt_page_ip6_constructed (GObject *object)
"text", "",
"style", NMT_NEWT_LABEL_PLAIN,
NULL);
g_object_bind_property_full (s_ip6, NM_SETTING_IP6_CONFIG_ROUTES,
g_object_bind_property_full (s_ip6, NM_SETTING_IP_CONFIG_ROUTES,
widget, "text",
G_BINDING_SYNC_CREATE,
ip6_routes_transform_to_description,
......@@ -178,7 +178,7 @@ nmt_page_ip6_constructed (GObject *object)
nmt_page_grid_append (grid, _("Routing"), widget, button);
widget = nmt_newt_checkbox_new (_("Never use this network for default route"));
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_NEVER_DEFAULT,
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_NEVER_DEFAULT,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
nmt_page_grid_append (grid, NULL, widget, NULL);
......@@ -186,7 +186,7 @@ nmt_page_ip6_constructed (GObject *object)
nmt_page_grid_append (grid, NULL, nmt_newt_separator_new (), NULL);
widget = nmt_newt_checkbox_new (_("Require IPv6 addressing for this connection"));
g_object_bind_property (s_ip6, NM_SETTING_IP6_CONFIG_MAY_FAIL,
g_object_bind_property (s_ip6, NM_SETTING_IP_CONFIG_MAY_FAIL,
widget, "active",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL |
G_BINDING_INVERT_BOOLEAN);
......
......@@ -77,21 +77,15 @@ save_routes_and_exit (NmtNewtButton *button,
{
NmtRouteEditor *editor = user_data;
NmtRouteEditorPrivate *priv = NMT_ROUTE_EDITOR_GET_PRIVATE (editor);
const char *property;
GBinding *binding;
GPtrArray *routes;
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
property = NM_SETTING_IP4_CONFIG_ROUTES;
else
property = NM_SETTING_IP6_CONFIG_ROUTES;
/* Because of the complicated dbus-glib GTypes, it's easier to cheat
* and use GBinding to do this than it is to copy the value by hand.
*/
binding = g_object_bind_property (priv->edit_setting, property,
priv->orig_setting, property,
G_BINDING_SYNC_CREATE);
g_object_unref (binding);
g_object_get (priv->edit_setting,
NM_SETTING_IP_CONFIG_ROUTES, &routes,
NULL);
g_object_set (priv->orig_setting,
NM_SETTING_IP_CONFIG_ROUTES, routes,
NULL);
g_ptr_array_unref (routes);
nmt_newt_form_quit (NMT_NEWT_FORM (editor));
}
......@@ -106,17 +100,13 @@ nmt_route_editor_constructed (GObject *object)
if (G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed)
G_OBJECT_CLASS (nmt_route_editor_parent_class)->constructed (object);
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting)) {
if (NM_IS_SETTING_IP4_CONFIG (priv->edit_setting))
routes = nmt_route_table_new (AF_INET);
g_object_bind_property (priv->edit_setting, NM_SETTING_IP4_CONFIG_ROUTES,
routes, "routes",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
} else {
else
routes = nmt_route_table_new (AF_INET6);
g_object_bind_property (priv->edit_setting, NM_SETTING_IP6_CONFIG_ROUTES,
routes, "routes",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
}
g_object_bind_property (priv->edit_setting, NM_SETTING_IP_CONFIG_ROUTES,
routes, "routes",
G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL);
vbox = nmt_newt_grid_new ();
nmt_newt_grid_add (NMT_NEWT_GRID (vbox), routes, 0, 0);
......
......@@ -86,7 +86,7 @@ add_connection (GDBusProxy *proxy, const char *con_name)
/* Build up the 'ipv4' Setting */
g_variant_builder_init (&setting_builder, G_VARIANT_TYPE ("a{sv}"));
g_variant_builder_add (&setting_builder, "{sv}",
NM_SETTING_IP4_CONFIG_METHOD,
NM_SETTING_IP_CONFIG_METHOD,
g_variant_new_string (NM_SETTING_IP4_CONFIG_METHOD_AUTO));
g_variant_builder_add (&connection_builder, "{sa{sv}}",
NM_SETTING_IP4_CONFIG_SETTING_NAME,
......
......@@ -86,7 +86,7 @@ add_connection (NMClient *client, GMainLoop *loop, const char *con_name)
/* Build up the 'ipv4' Setting */
s_ip4 = (NMSettingIP4Config *) nm_setting_ip4_config_new ();
g_object_set (G_OBJECT (s_ip4),
NM_SETTING_IP4_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NM_SETTING_IP_CONFIG_METHOD, NM_SETTING_IP4_CONFIG_METHOD_AUTO,
NULL);
nm_connection_add_setting (connection, NM_SETTING (s_ip4));
......
......@@ -631,8 +631,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
NMSettingConnection *s_con = nm_connection_get_setting_connection (self);
const char *default_ip4_method = NM_SETTING_IP4_CONFIG_METHOD_AUTO;
const char *default_ip6_method = NULL;
NMSettingIP4Config *s_ip4;
NMSettingIP6Config *s_ip6;
NMSettingIPConfig *s_ip4, *s_ip6;
NMSetting *setting;
if (parameters)
......@@ -663,7 +662,7 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
setting = nm_setting_ip4_config_new ();
g_object_set (setting,
NM_SETTING_IP4_CONFIG_METHOD, default_ip4_method,
NM_SETTING_IP_CONFIG_METHOD, default_ip4_method,
NULL);
nm_connection_add_setting (self, setting);
}
......@@ -671,8 +670,8 @@ _normalize_ip_config (NMConnection *self, GHashTable *parameters)
setting = nm_setting_ip6_config_new ();
g_object_set (setting,
NM_SETTING_IP6_CONFIG_METHOD, default_ip6_method,
NM_SETTING_IP6_CONFIG_MAY_FAIL, TRUE,
NM_SETTING_IP_CONFIG_METHOD, default_ip6_method,
NM_SETTING_IP_CONFIG_MAY_FAIL, TRUE,
NULL);
nm_connection_add_setting (self, setting);
}
......@@ -740,8 +739,7 @@ _nm_connection_verify (NMConnection *connection, GError **error)
{
NMConnectionPrivate *priv;
NMSettingConnection *s_con;
NMSettingIP4Config *s_ip4;
NMSettingIP6Config *s_ip6;
NMSettingIPConfig *s_ip4, *s_ip6;
GHashTableIter iter;
gpointer value;
GSList *all_settings = NULL, *setting_i;
......@@ -1739,14 +1737,19 @@ nm_connection_get_setting_infiniband (NMConnection *connection)
*
* A shortcut to return any #NMSettingIP4Config the connection might contain.
*
* Returns: (transfer none): an #NMSettingIP4Config if the connection contains one, otherwise %NULL
* Note that it returns the value as type #NMSettingIPConfig, since the vast
* majority of IPv4-setting-related methods are on that type, not
* #NMSettingIP4Config.
*
* Returns: (type NMSettingIP4Config) (transfer none): an #NMSettingIP4Config if the
* connection contains one, otherwise %NULL
**/
NMSettingIP4Config *
NMSettingIPConfig *
nm_connection_get_setting_ip4_config (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
return (NMSettingIP4Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP4_CONFIG);
}
/**
......@@ -1755,14 +1758,19 @@ nm_connection_get_setting_ip4_config (NMConnection *connection)
*
* A shortcut to return any #NMSettingIP6Config the connection might contain.
*
* Returns: (transfer none): an #NMSettingIP6Config if the connection contains one, otherwise %NULL
* Note that it returns the value as type #NMSettingIPConfig, since the vast
* majority of IPv6-setting-related methods are on that type, not
* #NMSettingIP6Config.
*
* Returns: (type NMSettingIP6Config) (transfer none): an #NMSettingIP6Config if the
* connection contains one, otherwise %NULL
**/
NMSettingIP6Config *
NMSettingIPConfig *
nm_connection_get_setting_ip6_config (NMConnection *connection)
{
g_return_val_if_fail (NM_IS_CONNECTION (connection), NULL);
return (NMSettingIP6Config *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
return (NMSettingIPConfig *) nm_connection_get_setting (connection, NM_TYPE_SETTING_IP6_CONFIG);
}
/**
......
......@@ -193,8 +193,8 @@ NMSettingDcb * nm_connection_get_setting_dcb (NMConnec
NMSettingGeneric * nm_connection_get_setting_generic (NMConnection *connection);
NMSettingGsm * nm_connection_get_setting_gsm (NMConnection *connection);
NMSettingInfiniband * nm_connection_get_setting_infiniband (NMConnection *connection);
NMSettingIP4Config * nm_connection_get_setting_ip4_config (NMConnection *connection);
NMSettingIP6Config * nm_connection_get_setting_ip6_config (NMConnection *connection);
NMSettingIPConfig * nm_connection_get_setting_ip4_config (NMConnection *connection);
NMSettingIPConfig * nm_connection_get_setting_ip6_config (NMConnection *connection);
NMSettingOlpcMesh * nm_connection_get_setting_olpc_mesh (NMConnection *connection);
NMSettingPpp * nm_connection_get_setting_ppp (NMConnection *connection);
NMSettingPppoe * nm_connection_get_setting_pppoe (NMConnection *connection);
......
......@@ -40,6 +40,7 @@ typedef struct _NMSettingDcb NMSettingDcb;
typedef struct _NMSettingGeneric NMSettingGeneric;
typedef struct _NMSettingGsm NMSettingGsm;
typedef struct _NMSettingInfiniband NMSettingInfiniband;
typedef struct _NMSettingIPConfig NMSettingIPConfig;
typedef struct _NMSettingIP4Config NMSettingIP4Config;
typedef struct _NMSettingIP6Config NMSettingIP6Config;
typedef struct _NMSettingOlpcMesh NMSettingOlpcMesh;
......
This diff is collapsed.
......@@ -127,6 +127,94 @@ void nm_ip_route_set_attribute (NMIPRoute *route,
const char *name,
GVariant *value);
#define NM_TYPE_SETTING_IP_CONFIG (nm_setting_ip_config_get_type ())
#define NM_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfig))
#define NM_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_SETTING_IPCONFIG, NMSettingIPConfigClass))
#define NM_IS_SETTING_IP_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_SETTING_IP_CONFIG))
#define NM_IS_SETTING_IP_CONFIG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_SETTING_IP_CONFIG))
#define NM_SETTING_IP_CONFIG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_SETTING_IP_CONFIG, NMSettingIPConfigClass))
#define NM_SETTING_IP_CONFIG_METHOD "method"
#define NM_SETTING_IP_CONFIG_DNS "dns"
#define NM_SETTING_IP_CONFIG_DNS_SEARCH "dns-search"
#define NM_SETTING_IP_CONFIG_ADDRESSES "addresses"
#define NM_SETTING_IP_CONFIG_ROUTES "routes"
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
#define NM_SETTING_IP_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
#define NM_SETTING_IP_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
#define NM_SETTING_IP_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
#define NM_SETTING_IP_CONFIG_NEVER_DEFAULT "never-default"
#define NM_SETTING_IP_CONFIG_MAY_FAIL "may-fail"
struct _NMSettingIPConfig {
NMSetting parent;
};
typedef struct {
NMSettingClass parent;
/* Padding for future expansion */
gpointer padding[8];
} NMSettingIPConfigClass;
GType nm_setting_ip_config_get_type (void);
const char *nm_setting_ip_config_get_method (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_dns (NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dns (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_add_dns (NMSettingIPConfig *setting,
const char *dns);
void nm_setting_ip_config_remove_dns (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_remove_dns_by_value (NMSettingIPConfig *setting,
const char *dns);
void nm_setting_ip_config_clear_dns (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_dns_searches (NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dns_search (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_add_dns_search (NMSettingIPConfig *setting,
const char *dns_search);
void nm_setting_ip_config_remove_dns_search (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_remove_dns_search_by_value (NMSettingIPConfig *setting,
const char *dns_search);
void nm_setting_ip_config_clear_dns_searches (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_addresses (NMSettingIPConfig *setting);
NMIPAddress *nm_setting_ip_config_get_address (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_add_address (NMSettingIPConfig *setting,
NMIPAddress *address);
void nm_setting_ip_config_remove_address (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_remove_address_by_value (NMSettingIPConfig *setting,
NMIPAddress *address);
void nm_setting_ip_config_clear_addresses (NMSettingIPConfig *setting);
guint nm_setting_ip_config_get_num_routes (NMSettingIPConfig *setting);
NMIPRoute *nm_setting_ip_config_get_route (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_add_route (NMSettingIPConfig *setting,
NMIPRoute *route);
void nm_setting_ip_config_remove_route (NMSettingIPConfig *setting,
int i);
gboolean nm_setting_ip_config_remove_route_by_value (NMSettingIPConfig *setting,
NMIPRoute *route);
void nm_setting_ip_config_clear_routes (NMSettingIPConfig *setting);
gboolean nm_setting_ip_config_get_ignore_auto_routes (NMSettingIPConfig *setting);
gboolean nm_setting_ip_config_get_ignore_auto_dns (NMSettingIPConfig *setting);
const char *nm_setting_ip_config_get_dhcp_hostname (NMSettingIPConfig *setting);
gboolean nm_setting_ip_config_get_dhcp_send_hostname (NMSettingIPConfig *setting);
gboolean nm_setting_ip_config_get_never_default (NMSettingIPConfig *setting);
gboolean nm_setting_ip_config_get_may_fail (NMSettingIPConfig *setting);
G_END_DECLS
#endif /* NM_SETTING_IP_CONFIG_H */
This diff is collapsed.
......@@ -27,7 +27,6 @@
#error "Only <NetworkManager.h> can be included directly."
#endif
#include "nm-setting.h"
#include "nm-setting-ip-config.h"
G_BEGIN_DECLS
......@@ -41,18 +40,7 @@ G_BEGIN_DECLS
#define NM_SETTING_IP4_CONFIG_SETTING_NAME "ipv4"
#define NM_SETTING_IP4_CONFIG_METHOD "method"
#define NM_SETTING_IP4_CONFIG_DNS "dns"
#define NM_SETTING_IP4_CONFIG_DNS_SEARCH "dns-search"
#define NM_SETTING_IP4_CONFIG_ADDRESSES "addresses"
#define NM_SETTING_IP4_CONFIG_ROUTES "routes"
#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_ROUTES "ignore-auto-routes"
#define NM_SETTING_IP4_CONFIG_IGNORE_AUTO_DNS "ignore-auto-dns"
#define NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID "dhcp-client-id"
#define NM_SETTING_IP4_CONFIG_DHCP_SEND_HOSTNAME "dhcp-send-hostname"
#define NM_SETTING_IP4_CONFIG_DHCP_HOSTNAME "dhcp-hostname"
#define NM_SETTING_IP4_CONFIG_NEVER_DEFAULT "never-default"
#define NM_SETTING_IP4_CONFIG_MAY_FAIL "may-fail"
/**
* NM_SETTING_IP4_CONFIG_METHOD_AUTO:
......@@ -99,11 +87,11 @@ G_BEGIN_DECLS
#define NM_SETTING_IP4_CONFIG_METHOD_DISABLED "disabled"
struct _NMSettingIP4Config {
NMSetting parent;
NMSettingIPConfig parent;
};
typedef struct {
NMSettingClass parent;
NMSettingIPConfigClass parent;
/*< private >*/
gpointer padding[4];
......@@ -111,46 +99,9 @@ typedef struct {
GType nm_setting_ip4_config_get_type (void);
NMSetting * nm_setting_ip4_config_new (void);
const char * nm_setting_ip4_config_get_method (NMSettingIP4Config *setting);
guint32 nm_setting_ip4_config_get_num_dns (NMSettingIP4Config *setting);
const char * nm_setting_ip4_config_get_dns (NMSettingIP4Config *setting, guint32 i);
gboolean nm_setting_ip4_config_add_dns (NMSettingIP4Config *setting, const char *dns);
void nm_setting_ip4_config_remove_dns (NMSettingIP4Config *setting, guint32 i);
gboolean nm_setting_ip4_config_remove_dns_by_value (NMSettingIP4Config *setting, const char *dns);
void nm_setting_ip4_config_clear_dns (NMSettingIP4Config *setting);
guint32 nm_setting_ip4_config_get_num_dns_searches (NMSettingIP4Config *setting);
const char * nm_setting_ip4_config_get_dns_search (NMSettingIP4Config *setting, guint32 i);
gboolean nm_setting_ip4_config_add_dns_search (NMSettingIP4Config *setting, const char *dns_search);
void nm_setting_ip4_config_remove_dns_search (NMSettingIP4Config *setting, guint32 i);
gboolean nm_setting_ip4_config_remove_dns_search_by_value (NMSettingIP4Config *setting, const char *dns_search);
void nm_setting_ip4_config_clear_dns_searches (NMSettingIP4Config *setting);
guint32 nm_setting_ip4_config_get_num_addresses (NMSettingIP4Config *setting);
NMIPAddress * nm_setting_ip4_config_get_address (NMSettingIP4Config *setting, guint32 i);
gboolean nm_setting_ip4_config_add_address (NMSettingIP4Config *setting, NMIPAddress *address);
void nm_setting_ip4_config_remove_address (NMSettingIP4Config *setting, guint32 i);