From 44d7f4f23829d98b95d9153970849a9681e4ef26 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 30 Mar 2005 22:09:16 +0000 Subject: r6139: Move socket_wrapper to a seperate directory (This used to be commit a2ef9225f15e369af7b884262b997ab321fd24d6) --- source4/lib/socket_wrapper/socket_wrapper.h | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 source4/lib/socket_wrapper/socket_wrapper.h (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h new file mode 100644 index 0000000000..6da5a2980c --- /dev/null +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -0,0 +1,48 @@ +/* + Copyright (C) Jelmer Vernooij 2005 + + 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 2 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, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#ifndef __SOCKET_WRAPPER_H__ +#define __SOCKET_WRAPPER_H__ + +int swrap_socket(int domain, int type, int protocol); +int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen); +int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen); +int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen); +int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen); +int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen); +int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); +int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen); +ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); +ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); +int swrap_close(int); + +#ifdef SOCKET_WRAPPER_REPLACE +#define accept swrap_accept +#define connect swrap_connect +#define bind swrap_bind +#define getpeername swrap_getpeername +#define getsockname swrap_getsockname +#define getsockopt swrap_getsockopt +#define setsockopt swrap_setsockopt +#define recvfrom swrap_recvfrom +#define sendto swrap_sendto +#define socket swrap_socket +#define close swrap_close +#endif + +#endif /* __SOCKET_WRAPPER_H__ */ -- cgit From 30a5e1c1dc405f4cc69fd375bc1bbdfa18fc389f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 27 May 2005 11:54:29 +0000 Subject: r7011: when using macros, the parameters should be specified unless its a varargs function you are replacing. Otherwise if you have any structure element called "socket" and you have a macro for "socket" then the code will fail. (This used to be commit 9b33d0ca583b0cc1602662220cade96b70c98306) --- source4/lib/socket_wrapper/socket_wrapper.h | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index 6da5a2980c..d8815a2575 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -32,17 +32,17 @@ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const str int swrap_close(int); #ifdef SOCKET_WRAPPER_REPLACE -#define accept swrap_accept -#define connect swrap_connect -#define bind swrap_bind -#define getpeername swrap_getpeername -#define getsockname swrap_getsockname -#define getsockopt swrap_getsockopt -#define setsockopt swrap_setsockopt -#define recvfrom swrap_recvfrom -#define sendto swrap_sendto -#define socket swrap_socket -#define close swrap_close +#define accept(s,addr,addrlen) swrap_accept(s,addr,addrlen) +#define connect(s,serv_addr,addrlen) swrap_connect(s,serv_addr,addrlen) +#define bind(s,myaddr,addrlen) swrap_bind(s,myaddr,addrlen) +#define getpeername(s,name,addrlen) swrap_getpeername(s,name,addrlen) +#define getsockname(s,name,addrlen) swrap_getsockname(s,name,addrlen) +#define getsockopt(s,level,optname,optval,optlen) swrap_getsockopt(s,level,optname,optval,optlen) +#define setsockopt(s,level,optname,optval,optlen) swrap_setsockopt(s,level,optname,optval,optlen) +#define recvfrom(s,buf,len,flags,from,fromlen) swrap_recvfrom(s,buf,len,flags,from,fromlen) +#define sendto(s,buf,len,flags,to,tolen) swrap_sendto(s,buf,len,flags,to,tolen) +#define socket(domain,type,protocol) swrap_socket(domain,type,protocol) +#define close(s) swrap_close(s) #endif #endif /* __SOCKET_WRAPPER_H__ */ -- cgit From 8db23753f31d45048e108f6f6a3bf8c8bb7083a6 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 30 Jun 2006 21:51:47 +0000 Subject: r16716: patch from Bjoern Jacke to fix compiler warnings on AIX metze (This used to be commit 3e5de223f715343b6421d580dc1b3f9d67c980da) --- source4/lib/socket_wrapper/socket_wrapper.h | 44 +++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index d8815a2575..3c4a2c01dc 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -32,16 +32,60 @@ ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const str int swrap_close(int); #ifdef SOCKET_WRAPPER_REPLACE + +#ifdef accept +#undef accept +#endif #define accept(s,addr,addrlen) swrap_accept(s,addr,addrlen) + +#ifdef connect +#undef connect +#endif #define connect(s,serv_addr,addrlen) swrap_connect(s,serv_addr,addrlen) + +#ifdef bind +#undef bind +#endif #define bind(s,myaddr,addrlen) swrap_bind(s,myaddr,addrlen) + +#ifdef getpeername +#undef getpeername +#endif #define getpeername(s,name,addrlen) swrap_getpeername(s,name,addrlen) + +#ifdef getsockname +#undef getsockname +#endif #define getsockname(s,name,addrlen) swrap_getsockname(s,name,addrlen) + +#ifdef getsockopt +#undef getsockopt +#endif #define getsockopt(s,level,optname,optval,optlen) swrap_getsockopt(s,level,optname,optval,optlen) + +#ifdef setsockopt +#undef setsockopt +#endif #define setsockopt(s,level,optname,optval,optlen) swrap_setsockopt(s,level,optname,optval,optlen) + +#ifdef recvfrom +#undef recvfrom +#endif #define recvfrom(s,buf,len,flags,from,fromlen) swrap_recvfrom(s,buf,len,flags,from,fromlen) + +#ifdef sendto +#undef sendto +#endif #define sendto(s,buf,len,flags,to,tolen) swrap_sendto(s,buf,len,flags,to,tolen) + +#ifdef socket +#undef socket +#endif #define socket(domain,type,protocol) swrap_socket(domain,type,protocol) + +#ifdef close +#undef close +#endif #define close(s) swrap_close(s) #endif -- cgit From b5ea572f450a9161b96c9c08789791054d24df37 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 12 Sep 2006 06:19:11 +0000 Subject: r18417: overload send() and recv() by socket wrapper and add a dummy swrap_dump_packet() function which can later dump the packet content, so that a script can then generate a capture file for wireshark metze (This used to be commit d05cab5c626b5960448f206e8c17b89edbf78733) --- source4/lib/socket_wrapper/socket_wrapper.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index 3c4a2c01dc..b4cdcbbe32 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -28,7 +28,9 @@ int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen); int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen); ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); -ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); +ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); +ssize_t swrap_recv(int s, void *buf, size_t len, int flags); +ssize_t swrap_send(int s, const void *buf, size_t len, int flags); int swrap_close(int); #ifdef SOCKET_WRAPPER_REPLACE @@ -78,6 +80,16 @@ int swrap_close(int); #endif #define sendto(s,buf,len,flags,to,tolen) swrap_sendto(s,buf,len,flags,to,tolen) +#ifdef recv +#undef recv +#endif +#define recv(s,buf,len,flags) swrap_recv(s,buf,len,flags) + +#ifdef send +#undef send +#endif +#define send(s,buf,len,flags) swrap_send(s,buf,len,flags) + #ifdef socket #undef socket #endif -- cgit From 3c096b3a9ac4980101677b5268a45e5fabfe607a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 12 Sep 2006 14:59:08 +0000 Subject: r18426: use 'family' consistantly instead of mixing 'domain' and 'family' metze (This used to be commit 224f26602ac78dbdabd4602bce42e31141102f6c) --- source4/lib/socket_wrapper/socket_wrapper.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index b4cdcbbe32..23a261faaf 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -19,7 +19,7 @@ #ifndef __SOCKET_WRAPPER_H__ #define __SOCKET_WRAPPER_H__ -int swrap_socket(int domain, int type, int protocol); +int swrap_socket(int family, int type, int protocol); int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen); int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen); -- cgit From 174742a74ce448d1944ada9dd602aadf20bce6f8 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 27 Sep 2006 10:13:45 +0000 Subject: r18947: overload listen() and ioctl() in socket_wrapper metze (This used to be commit dfaccdca1b6954cd61828749d7b000f804f3b066) --- source4/lib/socket_wrapper/socket_wrapper.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index 23a261faaf..07cf2c6601 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -23,12 +23,14 @@ int swrap_socket(int family, int type, int protocol); int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen); int swrap_bind(int s, const struct sockaddr *myaddr, socklen_t addrlen); +int swrap_listen(int s, int backlog); int swrap_getpeername(int s, struct sockaddr *name, socklen_t *addrlen); int swrap_getsockname(int s, struct sockaddr *name, socklen_t *addrlen); int swrap_getsockopt(int s, int level, int optname, void *optval, socklen_t *optlen); int swrap_setsockopt(int s, int level, int optname, const void *optval, socklen_t optlen); ssize_t swrap_recvfrom(int s, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen); ssize_t swrap_sendto(int s, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen); +int swrap_ioctl(int s, int req, void *ptr); ssize_t swrap_recv(int s, void *buf, size_t len, int flags); ssize_t swrap_send(int s, const void *buf, size_t len, int flags); int swrap_close(int); @@ -50,6 +52,11 @@ int swrap_close(int); #endif #define bind(s,myaddr,addrlen) swrap_bind(s,myaddr,addrlen) +#ifdef listen +#undef listen +#endif +#define listen(s,blog) swrap_listen(s,blog) + #ifdef getpeername #undef getpeername #endif @@ -80,6 +87,11 @@ int swrap_close(int); #endif #define sendto(s,buf,len,flags,to,tolen) swrap_sendto(s,buf,len,flags,to,tolen) +#ifdef ioctl +#undef ioctl +#endif +#define ioctl(s,req,ptr) swrap_ioctl(s,req,ptr) + #ifdef recv #undef recv #endif -- cgit From a3a619a3643edbf87882550d04e34484bd251fc4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sun, 8 Oct 2006 20:48:34 +0000 Subject: r19171: change the socket wrapper license to what heimdal uses... metze (This used to be commit 9f8809a16ef837f5cdf07ed2e383893d035e96d6) --- source4/lib/socket_wrapper/socket_wrapper.h | 51 +++++++++++++++++++---------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index 07cf2c6601..1d8dac1763 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -1,20 +1,37 @@ -/* - Copyright (C) Jelmer Vernooij 2005 - - 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 2 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, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ +/* + * Copyright (C) Jelmer Vernooij 2005 + * Copyright (C) Stefan Metzmacher 2006 + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * 3. Neither the name of the author nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ #ifndef __SOCKET_WRAPPER_H__ #define __SOCKET_WRAPPER_H__ -- cgit From 1cc7b6e7397444a859c78e5ecc61f53dd1017436 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 3 Mar 2007 01:20:36 +0000 Subject: r21671: Add initial simple tests for socket wrapper (This used to be commit 872e2ad541478597191ca9e31872d5c8e2bbb832) --- source4/lib/socket_wrapper/socket_wrapper.h | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index 1d8dac1763..fd1e48610b 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -36,6 +36,7 @@ #ifndef __SOCKET_WRAPPER_H__ #define __SOCKET_WRAPPER_H__ +const char *socket_wrapper_dir(void); int swrap_socket(int family, int type, int protocol); int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen); -- cgit From 7a287e07043cf937e22f8051c1a324d8a30c53e1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 13:34:42 +0000 Subject: r25028: Fix more warnings. (This used to be commit 3aa7ee4a0d8837471deeaa1c5a1f4a0d2a14aa6e) --- source4/lib/socket_wrapper/socket_wrapper.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/lib/socket_wrapper/socket_wrapper.h') diff --git a/source4/lib/socket_wrapper/socket_wrapper.h b/source4/lib/socket_wrapper/socket_wrapper.h index fd1e48610b..cc8b937608 100644 --- a/source4/lib/socket_wrapper/socket_wrapper.h +++ b/source4/lib/socket_wrapper/socket_wrapper.h @@ -37,6 +37,7 @@ #define __SOCKET_WRAPPER_H__ const char *socket_wrapper_dir(void); +unsigned int socket_wrapper_default_iface(void); int swrap_socket(int family, int type, int protocol); int swrap_accept(int s, struct sockaddr *addr, socklen_t *addrlen); int swrap_connect(int s, const struct sockaddr *serv_addr, socklen_t addrlen); @@ -131,4 +132,5 @@ int swrap_close(int); #define close(s) swrap_close(s) #endif + #endif /* __SOCKET_WRAPPER_H__ */ -- cgit