NetworkManager r3397 - in branches/NETWORKMANAGER_0_6_0_RELEASE: . src



Author: dcbw
Date: Sat Mar  8 19:37:25 2008
New Revision: 3397
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3397&view=rev

Log:
2008-03-08  Dan Williams  <dcbw redhat com>

	Patch from Bas Zoetekouw <bas debian org>

	* src/nm-ip4-config.c
	  src/nm-ip4-config.h
		- (nm_ip4_config_add_search, nm_ip4_config_get_search,
		   nm_ip4_config_get_num_searches): add 'searches' as distinct from
			domains.  'searches' is the correct way to store multiple search
			domains, whereas 'domains' is really just supposed to store one
			domain.  Some sites abuse the DHCP 'domain-name' option to push
			search domains to the client.
		- (nm_ip4_config_add_domain): group with related functions (my patch)



Modified:
   branches/NETWORKMANAGER_0_6_0_RELEASE/ChangeLog
   branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.c
   branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.h

Modified: branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.c
==============================================================================
--- branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.c	(original)
+++ branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.c	Sat Mar  8 19:37:25 2008
@@ -46,6 +46,7 @@
 
 	GSList *	nameservers;
 	GSList *	domains;
+	GSList *	searches;
 
 	gchar *	hostname;
 	gchar *	nis_domain;
@@ -264,17 +265,6 @@
 	return (g_slist_length (config->nis_servers));
 }
 
-void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
-{
-	g_return_if_fail (config != NULL);
-	g_return_if_fail (domain != NULL);
-
-	if (!strlen (domain))
-		return;
-
-	config->domains = g_slist_append (config->domains, g_strdup (domain));
-}
-
 void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname)
 {
 	g_return_if_fail (config != NULL);
@@ -310,6 +300,17 @@
 	return config->nis_domain;
 }
 
+void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
+{
+	g_return_if_fail (config != NULL);
+	g_return_if_fail (domain != NULL);
+
+	if (!strlen (domain))
+		return;
+
+	config->domains = g_slist_append (config->domains, g_strdup (domain));
+}
+
 const char *nm_ip4_config_get_domain (NMIP4Config *config, guint i)
 {
 	const char *domain;
@@ -329,6 +330,34 @@
 	return (g_slist_length (config->domains));
 }
 
+void nm_ip4_config_add_search (NMIP4Config *config, const char *search)
+{
+	g_return_if_fail (config != NULL);
+	g_return_if_fail (search != NULL);
+	g_return_if_fail (strlen (search) > 0);
+
+	config->searches = g_slist_append (config->searches, g_strdup (search));
+}
+
+const char *nm_ip4_config_get_search (NMIP4Config *config, guint i)
+{
+	const char *search;
+
+	g_return_val_if_fail (config != NULL, NULL);
+	g_return_val_if_fail (i < g_slist_length (config->searches), NULL);
+
+	if ((search = (const char *) g_slist_nth_data (config->searches, i)))
+		return search;
+	return NULL;
+}
+
+guint32 nm_ip4_config_get_num_searches (NMIP4Config *config)
+{
+	g_return_val_if_fail (config != NULL, 0);
+
+	return (g_slist_length (config->searches));
+}
+
 guint32 nm_ip4_config_get_mtu (NMIP4Config *config)
 {
 	g_return_val_if_fail (config != NULL, 0);

Modified: branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.h
==============================================================================
--- branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.h	(original)
+++ branches/NETWORKMANAGER_0_6_0_RELEASE/src/nm-ip4-config.h	Sat Mar  8 19:37:25 2008
@@ -68,6 +68,10 @@
 const char *	nm_ip4_config_get_domain			(NMIP4Config *config, guint i);
 guint32		nm_ip4_config_get_num_domains		(NMIP4Config *config);
 
+void			nm_ip4_config_add_search			(NMIP4Config *config, const char *search);
+const char *	nm_ip4_config_get_search			(NMIP4Config *config, guint i);
+guint32		nm_ip4_config_get_num_searches		(NMIP4Config *config);
+
 guint32		nm_ip4_config_get_mtu			(NMIP4Config *config);
 void			nm_ip4_config_set_mtu			(NMIP4Config *config, guint32 mtu);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]