diff options
-rw-r--r-- | lib/socket/interfaces.c (renamed from source4/lib/socket/netif.c) | 10 | ||||
-rw-r--r-- | lib/socket/interfaces.h | 44 | ||||
-rw-r--r-- | lib/socket/wscript_build | 7 | ||||
-rw-r--r-- | source4/lib/socket/netif.h | 16 | ||||
-rw-r--r-- | source4/lib/socket/wscript_build | 10 | ||||
-rw-r--r-- | wscript_build | 1 |
6 files changed, 63 insertions, 25 deletions
diff --git a/source4/lib/socket/netif.c b/lib/socket/interfaces.c index 2846813d3f..1801e870f0 100644 --- a/source4/lib/socket/netif.c +++ b/lib/socket/interfaces.c @@ -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 index 0000000000..b4e113dcc8 --- /dev/null +++ b/lib/socket/interfaces.h @@ -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 index 0000000000..61bde129c5 --- /dev/null +++ b/lib/socket/wscript_build @@ -0,0 +1,7 @@ +#!/usr/bin/env python + +bld.SAMBA_LIBRARY('interfaces', + source='interfaces.c', + deps='samba-util', + private_library=True + ) diff --git a/source4/lib/socket/netif.h b/source4/lib/socket/netif.h index 6a06c4bf15..1d90a4fd13 100644 --- a/source4/lib/socket/netif.h +++ b/source4/lib/socket/netif.h @@ -20,19 +20,5 @@ */ #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 diff --git a/source4/lib/socket/wscript_build b/source4/lib/socket/wscript_build index e2ff9b078a..fa497335fb 100644 --- a/source4/lib/socket/wscript_build +++ b/source4/lib/socket/wscript_build @@ -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', diff --git a/wscript_build b/wscript_build index 74f5dc3018..5cbbc308d3 100644 --- a/wscript_build +++ b/wscript_build @@ -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') |