summaryrefslogtreecommitdiff
path: root/source4/lib/util.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-01 22:48:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:11 -0500
commit284349482f5293a9a23d0f72d7c2aab46b55843b (patch)
tree6f96931afb18ea841983a2895b62c97fed9f77b7 /source4/lib/util.c
parent9f14afa12c11d02a49f4f310c3f8d834ce8a835d (diff)
downloadsamba-284349482f5293a9a23d0f72d7c2aab46b55843b.tar.gz
samba-284349482f5293a9a23d0f72d7c2aab46b55843b.tar.bz2
samba-284349482f5293a9a23d0f72d7c2aab46b55843b.zip
r3443: the next stage in the include files re-organisation.
I have created the include/system/ directory, which will contain the wrappers for the system includes for logical subsystems. So far I have created include/system/kerberos.h and include/system/network.h, which contain all the system includes for kerberos code and networking code. These are the included in subsystems that need kerberos or networking respectively. Note that this method avoids the mess of #ifdef HAVE_XXX_H in every C file, instead each C module includes the include/system/XXX.h file for the logical system support it needs, and the details are kept isolated in include/system/ This patch also creates a "struct ipv4_addr" which replaces "struct in_addr" in our code. That avoids every C file needing to import all the system networking headers. (This used to be commit 2e25c71853f8996f73755277e448e7d670810349)
Diffstat (limited to 'source4/lib/util.c')
-rw-r--r--source4/lib/util.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/source4/lib/util.c b/source4/lib/util.c
index 07dc182580..7b6396fa93 100644
--- a/source4/lib/util.c
+++ b/source4/lib/util.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "system/network.h"
/**************************************************************************n
Find a suitable temporary directory. The result should be copied immediately
@@ -421,7 +422,7 @@ uint32_t interpret_addr(const char *str)
/* if it's in the form of an IP address then get the lib to interpret it */
if (is_ipaddress(str)) {
- res = inet_addr(str);
+ res = sys_inet_addr(str);
} else {
/* otherwise assume it's a network name of some sort and use
sys_gethostbyname */
@@ -446,9 +447,9 @@ uint32_t interpret_addr(const char *str)
/*******************************************************************
A convenient addition to interpret_addr().
******************************************************************/
-struct in_addr interpret_addr2(const char *str)
+struct ipv4_addr interpret_addr2(const char *str)
{
- struct in_addr ret;
+ struct ipv4_addr ret;
uint32_t a = interpret_addr(str);
ret.s_addr = a;
return ret;
@@ -458,7 +459,7 @@ struct in_addr interpret_addr2(const char *str)
Check if an IP is the 0.0.0.0.
******************************************************************/
-BOOL is_zero_ip(struct in_addr ip)
+BOOL is_zero_ip(struct ipv4_addr ip)
{
uint32_t a;
putip((char *)&a,(char *)&ip);
@@ -469,9 +470,9 @@ BOOL is_zero_ip(struct in_addr ip)
Set an IP to 0.0.0.0.
******************************************************************/
-void zero_ip(struct in_addr *ip)
+void zero_ip(struct ipv4_addr *ip)
{
- *ip = inet_makeaddr(0,0);
+ *ip = sys_inet_makeaddr(0,0);
return;
}
@@ -480,7 +481,7 @@ void zero_ip(struct in_addr *ip)
Are two IPs on the same subnet?
********************************************************************/
-BOOL same_net(struct in_addr ip1,struct in_addr ip2,struct in_addr mask)
+BOOL same_net(struct ipv4_addr ip1,struct ipv4_addr ip2,struct ipv4_addr mask)
{
uint32_t net1,net2,nmask;