summaryrefslogtreecommitdiffstats
path: root/source/lib/system.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2004-11-01 22:48:25 +0000
committerAndrew Tridgell <tridge@samba.org>2004-11-01 22:48:25 +0000
commit0d4a8b501a333f21537644295b00b6798e2d961f (patch)
tree2787ac0711abd289a6897cf0d059f211e2f66f2f /source/lib/system.c
parent9c911d91a4a7a2b21cfb1e51841988ae1702834a (diff)
downloadsamba-0d4a8b501a333f21537644295b00b6798e2d961f.tar.gz
samba-0d4a8b501a333f21537644295b00b6798e2d961f.tar.xz
samba-0d4a8b501a333f21537644295b00b6798e2d961f.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.
Diffstat (limited to 'source/lib/system.c')
-rw-r--r--source/lib/system.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/lib/system.c b/source/lib/system.c
index 1407e7474e1..2baa412622e 100644
--- a/source/lib/system.c
+++ b/source/lib/system.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "system/network.h"
/*
The idea is that this file will eventually have wrappers around all
@@ -533,3 +534,24 @@ int sys_dup2(int oldfd, int newfd)
#endif
}
+
+const char *sys_inet_ntoa(struct ipv4_addr in)
+{
+ struct in_addr in2;
+ in2.s_addr = in.s_addr;
+ return inet_ntoa(in2);
+}
+
+uint32_t sys_inet_addr(const char *s)
+{
+ return inet_addr(s);
+}
+
+struct ipv4_addr sys_inet_makeaddr(int net, int host)
+{
+ struct in_addr in;
+ struct ipv4_addr in2;
+ in = inet_makeaddr(net, host);
+ in2.s_addr = in.s_addr;
+ return in2;
+}