Main Page   Class Hierarchy   Compound List   File List   Compound Members  

socket_t.hpp

00001 /*
00002  *  This program is free software; you can redistribute it and/or modify
00003  *  it under the terms of the GNU General Public License as published by
00004  *  the Free Software Foundation; either version 2 of the License, or
00005  *  (at your option) any later version.
00006  *
00007  *  This program is distributed in the hope that it will be useful,
00008  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00009  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00010  *  GNU General Public License for more details.
00011  *
00012  *  You should have received a copy of the GNU General Public License
00013  *  along with this program; if not, write to the Free Software
00014  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00015  *
00016  * (c)Copyright 2006 Hewlett-Packard Development Company, LP.
00017  *
00018  */
00019 
00020 #ifndef _SOCKET_T_HPP
00021 #define _SOCKET_T_HPP
00022 
00023 #include <sys/types.h>
00024 #include <sys/socket.h>
00025 
00026 #ifndef AF_INET6
00027 #define USE_IPV4_ONLY
00028 #endif
00029 
00030 #if defined(__hpux)
00031 
00032 #ifdef _XOPEN_SOURCE_EXTENDED
00033 #include <arpa/inet.h>
00034 #else 
00035 #include <netinet/in.h>
00036 #endif
00037 
00038 #else
00039 #include <netinet/in.h>
00040 #endif
00041 
00042 #define DEFAULT_IP_BUFFER_SIZE 65535
00043 
00044 #if defined (__hpux) 
00045 #ifdef _XOPEN_SOURCE_EXTENDED
00046 #define tool_socklen_t  socklen_t
00047 #else
00048 #define tool_socklen_t  int
00049 #endif
00050 #else
00051 #define tool_socklen_t  socklen_t
00052 #endif
00053 
00054 #if defined(__cplusplus) && defined (__hpux)
00055 #define RICAST(type, val) (reinterpret_cast<type> (val))
00056 #else
00057 #define RICAST(type, val) ((type)(val))
00058 #endif
00059 
00060 #ifdef USE_IPV4_ONLY
00061 
00062 typedef struct sockaddr_in      T_SockAddrStorage ;
00063 #define SOCKADDR_IN_SIZE(a)     sizeof(struct sockaddr_in)
00064 #define SOCKADDR_FAMILY         sin_family
00065 #else
00066 
00067 typedef struct sockaddr_storage T_SockAddrStorage ;
00068 #define SOCKADDR_IN_SIZE(a) \
00069   (((a)->ss_family == AF_INET) ? sizeof(struct sockaddr_in) \
00070                                : sizeof(struct sockaddr_in6))
00071 #define SOCKADDR_FAMILY        ss_family
00072 #endif
00073 
00074 
00075 // system call 
00076 
00077 #define call_shutdown   shutdown
00078 #define call_open       open
00079 #define call_close      close
00080 #define call_bind       bind
00081 #define call_accept     accept
00082 #define call_setsockopt setsockopt
00083 #define call_getsockopt getsockopt
00084 #define call_listen     listen
00085 #define call_send       send
00086 #define call_read       read
00087 #define call_socket     socket
00088 #define call_connect    connect
00089 #define call_fcntl      fcntl
00090 #define call_recvmsg    recvmsg
00091 // UDP
00092 #define call_recvfrom   recvfrom
00093 #define call_sendto     sendto
00094 
00095 
00096 #endif
00097 
00098 

Generated on Wed Mar 7 14:44:59 2007 for Seagull by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002