NetworkManager r3402 - in trunk: . src



Author: dcbw
Date: Sun Mar  9 05:11:22 2008
New Revision: 3402
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3402&view=rev

Log:
2008-03-09  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:
   trunk/ChangeLog
   trunk/src/nm-ip4-config.c
   trunk/src/nm-ip4-config.h

Modified: trunk/src/nm-ip4-config.c
==============================================================================
--- trunk/src/nm-ip4-config.c	(original)
+++ trunk/src/nm-ip4-config.c	Sun Mar  9 05:11:22 2008
@@ -51,6 +51,7 @@
 
 	GArray *nameservers;
 	GPtrArray *domains;
+	GPtrArray *searches;
 
 	gchar *	hostname;
 	gchar *	nis_domain;
@@ -251,17 +252,6 @@
 	return NM_IP4_CONFIG_GET_PRIVATE (config)->nis_servers->len;
 }
 
-void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
-{
-	g_return_if_fail (NM_IS_IP4_CONFIG (config));
-	g_return_if_fail (domain != NULL);
-
-	if (!strlen (domain))
-		return;
-
-	g_ptr_array_add (NM_IP4_CONFIG_GET_PRIVATE (config)->domains, g_strdup (domain));
-}
-
 void nm_ip4_config_set_hostname (NMIP4Config *config, const char *hostname)
 {
 	g_return_if_fail (NM_IS_IP4_CONFIG (config));
@@ -319,6 +309,19 @@
 	return (NM_IP4_CONFIG_GET_PRIVATE (config)->static_routes->len) / 2;
 }
 
+
+void nm_ip4_config_add_domain (NMIP4Config *config, const char *domain)
+{
+	g_return_if_fail (NM_IS_IP4_CONFIG (config));
+	g_return_if_fail (domain != NULL);
+	g_return_if_fail (strlen (domain) > 0);
+
+	if (!strlen (domain))
+		return;
+
+	g_ptr_array_add (NM_IP4_CONFIG_GET_PRIVATE (config)->domains, g_strdup (domain));
+}
+
 const char *nm_ip4_config_get_domain (NMIP4Config *config, guint i)
 {
 	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), NULL);
@@ -333,6 +336,29 @@
 	return NM_IP4_CONFIG_GET_PRIVATE (config)->domains->len;
 }
 
+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);
+
+	g_ptr_array_add (NM_IP4_CONFIG_GET_PRIVATE (config)->searches, g_strdup (search));
+}
+
+const char *nm_ip4_config_get_search (NMIP4Config *config, guint i)
+{
+	g_return_val_if_fail (config != NULL, NULL);
+
+	return (const char *) g_ptr_array_index (NM_IP4_CONFIG_GET_PRIVATE (config)->searches, i);
+}
+
+guint32 nm_ip4_config_get_num_searches (NMIP4Config *config)
+{
+	g_return_val_if_fail (config != NULL, 0);
+
+	return NM_IP4_CONFIG_GET_PRIVATE (config)->searches->len;
+}
+
 guint32 nm_ip4_config_get_mtu (NMIP4Config *config)
 {
 	g_return_val_if_fail (NM_IS_IP4_CONFIG (config), 0);

Modified: trunk/src/nm-ip4-config.h
==============================================================================
--- trunk/src/nm-ip4-config.h	(original)
+++ trunk/src/nm-ip4-config.h	Sun Mar  9 05:11:22 2008
@@ -96,6 +96,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]