lib/socket move interfaces code to the top level
authorAndrew Bartlett <abartlet@samba.org>
Mon, 2 May 2011 03:02:17 +0000 (13:02 +1000)
committerAndrew Tridgell <tridge@samba.org>
Sun, 8 May 2011 10:57:04 +0000 (12:57 +0200)
lib/socket/interfaces.c [moved from source4/lib/socket/netif.c with 99% similarity]
lib/socket/interfaces.h [new file with mode: 0644]
lib/socket/wscript_build [new file with mode: 0644]
source4/lib/socket/netif.h
source4/lib/socket/wscript_build
wscript_build

similarity index 99%
rename from source4/lib/socket/netif.c
rename to lib/socket/interfaces.c
index 2846813d3f3958e3fc0f8152da1c6031239255ae..1801e870f01efe415049db74a8cfd84ae540ad0d 100644 (file)
@@ -1,20 +1,20 @@
-/* 
+/*
    Unix SMB/CIFS implementation.
    return a list of network interfaces
    Copyright (C) Andrew Tridgell 1998
    Copyright (C) Jeremy Allison 2007
    Copyright (C) Jelmer Vernooij 2007
-   
+
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
-   
+
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
-   
+
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
@@ -33,7 +33,7 @@
 
 #include "includes.h"
 #include "system/network.h"
-#include "netif.h"
+#include "interfaces.h"
 #include "lib/util/tsort.h"
 
 /****************************************************************************
diff --git a/lib/socket/interfaces.h b/lib/socket/interfaces.h
new file mode 100644 (file)
index 0000000..b4e113d
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   structures for lib/netif/
+
+   Copyright (C) Andrew Tridgell 2004
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#include "system/network.h"
+
+struct iface_struct {
+       char name[16];
+       int flags;
+       struct sockaddr_storage ip;
+       struct sockaddr_storage netmask;
+       struct sockaddr_storage bcast;
+};
+
+struct interface;
+
+bool make_netmask(struct sockaddr_storage *pss_out,
+                 const struct sockaddr_storage *pss_in,
+                 unsigned long masklen);
+void make_bcast(struct sockaddr_storage *pss_out,
+               const struct sockaddr_storage *pss_in,
+               const struct sockaddr_storage *nmask);
+void make_net(struct sockaddr_storage *pss_out,
+             const struct sockaddr_storage *pss_in,
+             const struct sockaddr_storage *nmask);
+
+int get_interfaces(TALLOC_CTX *mem_ctx, struct iface_struct **pifaces);
diff --git a/lib/socket/wscript_build b/lib/socket/wscript_build
new file mode 100644 (file)
index 0000000..61bde12
--- /dev/null
@@ -0,0 +1,7 @@
+#!/usr/bin/env python
+
+bld.SAMBA_LIBRARY('interfaces',
+    source='interfaces.c',
+    deps='samba-util',
+    private_library=True
+    )
index 6a06c4bf15e281e49541dac952f813ed22f8520e..1d90a4fd1391f4f7e7c5549fa350de9e265418d1 100644 (file)
 */
 
 #include "system/network.h"
-
-struct iface_struct {
-       char name[16];
-       int flags;
-       struct sockaddr_storage ip;
-       struct sockaddr_storage netmask;
-       struct sockaddr_storage bcast;
-};
-
-struct interface;
-
-#define MAX_INTERFACES 128
-
-#ifndef AUTOCONF_TEST
+#include "lib/socket/interfaces.h"
 #include "lib/socket/netif_proto.h"
-#endif
index e2ff9b078a772de4e20bb0e86a9d9c577329efe4..fa497335fb85be4ca615e23637e22d45c811583b 100644 (file)
@@ -1,11 +1,11 @@
 #!/usr/bin/env python
 
 bld.SAMBA_LIBRARY('netif',
-    source='interface.c netif.c',
-    autoproto='netif_proto.h',
-    deps='samba-util',
-    private_library=True
-    )
+                  source='interface.c',
+                  deps='samba-util interfaces',
+                  private_library=True,
+                  autoproto='netif_proto.h'
+                  )
 
 bld.SAMBA_MODULE('socket_ip',
     source='socket_ip.c',
index 74f5dc3018aa8de04801e80925b252311a98e0c5..5cbbc308d30681b22238d321210c58d435c90f9c 100644 (file)
@@ -33,6 +33,7 @@ bld.SAMBA_MKVERSION('version.h')
 # bld.ENABLE_MAGIC_ORDERING()
 
 bld.RECURSE('lib/replace')
+bld.RECURSE('lib/socket')
 bld.RECURSE('lib/talloc')
 bld.RECURSE('lib/tdb')
 bld.RECURSE('lib/tevent')