Return to Network.h CVS log | Up to [Pegasus] / pegasus / src / Pegasus / Common |
1 mike 1.1 //%2006//////////////////////////////////////////////////////////////////////// 2 // 3 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development 4 // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems. 5 // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.; 6 // IBM Corp.; EMC Corporation, The Open Group. 7 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.; 8 // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group. 9 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.; 10 // EMC Corporation; VERITAS Software Corporation; The Open Group. 11 // Copyright (c) 2006 Hewlett-Packard Development Company, L.P.; IBM Corp.; 12 // EMC Corporation; Symantec Corporation; The Open Group. 13 // 14 // Permission is hereby granted, free of charge, to any person obtaining a copy 15 // of this software and associated documentation files (the "Software"), to 16 // deal in the Software without restriction, including without limitation the 17 // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 18 // sell copies of the Software, and to permit persons to whom the Software is 19 // furnished to do so, subject to the following conditions: 20 // 21 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN 22 mike 1.1 // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED 23 // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 24 // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 25 // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 26 // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 27 // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 // 30 //============================================================================== 31 // 32 //%///////////////////////////////////////////////////////////////////////////// 33 34 #ifndef Pegasus_Network_h 35 #define Pegasus_Network_h 36 37 #include <Pegasus/Common/Config.h> 38 39 //============================================================================== 40 // 41 // Network.h 42 // 43 mike 1.1 // This file includes network-related system-header files. Please include 44 // this file directly rather than including system headers directly. If 45 // special inclusions are necessary for any platform, please add them to 46 // this file rather than other files. The reason for this file is to limit 47 // platform-specific conditional compilation expressions to only a few 48 // well-known header files. 49 // 50 //============================================================================== 51 52 //------------------------------------------------------------------------------ 53 // 54 // PEGASUS_OS_TYPE_WINDOWS network system header files 55 // 56 //------------------------------------------------------------------------------ 57 58 #ifdef PEGASUS_OS_TYPE_WINDOWS 59 # ifdef FD_SETSIZE 60 # error 61 "<Pegasus/Common/Network.h>: FD_SETSIZE is already defined. This " 62 "file must be included prior to any header file that defines " 63 "FD_SETSIZE, such as <windows.h>, <winsock.h>, or winsock2.h>." 64 mike 1.1 # endif 65 # define FD_SETSIZE 1024 66 # include <windows.h> 67 # ifndef _WINSOCKAPI_ 68 # include <winsock2.h> 69 # endif 70 # include <wincrypt.h> 71 #endif 72 73 //------------------------------------------------------------------------------ 74 // | ||
75 carson.hovey 1.4 // PEGASUS_OS_TYPE_UNIX or PEGASUS_OS_VMS network system header files. | ||
76 mike 1.1 // 77 //------------------------------------------------------------------------------ 78 | ||
79 carson.hovey 1.4 #if defined(PEGASUS_OS_TYPE_UNIX) || defined (PEGASUS_OS_VMS) | ||
80 mike 1.1 # include <errno.h> 81 # include <sys/types.h> 82 # include <fcntl.h> 83 # include <netdb.h> 84 # include <netinet/in.h> 85 # include <arpa/inet.h> 86 # include <sys/socket.h> 87 # include <sys/time.h> | ||
88 thilo.boehm 1.6 # include <net/if.h> 89 # include <sys/ioctl.h> | ||
90 mike 1.1 # ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET 91 # include <unistd.h> 92 # include <sys/un.h> 93 # endif 94 # ifdef PEGASUS_OS_OS400 95 # include <unistd.cleinc> 96 # else 97 # include <unistd.h> 98 # endif 99 # ifdef PEGASUS_PLATFORM_ZOS_ZSERIES_IBM 100 # ifndef TCP_NODELAY 101 # define TCP_NODELAY 1 102 # endif 103 # else 104 # include <netinet/tcp.h> 105 # endif 106 #endif 107 108 //------------------------------------------------------------------------------ 109 // 110 // PEGASUS_SOCKET_ERROR 111 mike 1.1 // 112 //------------------------------------------------------------------------------ 113 114 #ifdef PEGASUS_OS_TYPE_WINDOWS 115 # define PEGASUS_SOCKET_ERROR SOCKET_ERROR 116 #else 117 # define PEGASUS_SOCKET_ERROR (-1) 118 #endif 119 | ||
120 thilo.boehm 1.6 //------------------------------------------------------------------------------ 121 // 122 // PEGASUS_NETWORK_TCPIP_STOPPED 123 // 124 // This return code indicates that the transpor layer is 125 // stopped and the socket is invalid. The socket must created again. 126 // 127 //------------------------------------------------------------------------------ 128 129 #ifdef PEGASUS_OS_ZOS 130 # define PEGASUS_NETWORK_TCPIP_STOPPED EIO 131 #else 132 # define PEGASUS_NETWORK_TCPIP_STOPPED 0 133 #endif 134 135 //------------------------------------------------------------------------------ 136 // 137 // PEGASUS_NETWORK_TCPIP_TRYAGAIN 138 // 139 // This return code indicates that the transport layer is 140 // temporary unavailable and the program can try again. 141 thilo.boehm 1.6 // 142 //------------------------------------------------------------------------------ 143 144 #ifdef PEGASUS_OS_ZOS 145 # define PEGASUS_NETWORK_TCPIP_TRYAGAIN EAGAIN 146 #else 147 # define PEGASUS_NETWORK_TCPIP_TRYAGAIN 0 148 #endif 149 150 //------------------------------------------------------------------------------ 151 // 152 // PEGASUS_NETWORK_TRYAGAIN 153 // 154 // This return code indicates that the network function 155 // should be tried again by the program. 156 // 157 //------------------------------------------------------------------------------ 158 159 #if !defined(PEGASUS_OS_TYPE_WINDOWS) 160 # define PEGASUS_NETWORK_TRYAGAIN EAGAIN 161 #else 162 thilo.boehm 1.6 # define PEGASUS_NETWORK_TRYAGAIN 0 163 #endif 164 | ||
165 kumpf 1.3 //////////////////////////////////////////////////////////////////////////////// 166 // 167 // getSocketError() 168 // 169 //////////////////////////////////////////////////////////////////////////////// 170 171 static inline int getSocketError() 172 { 173 #ifdef PEGASUS_OS_TYPE_WINDOWS 174 return WSAGetLastError(); 175 #else 176 return errno; 177 #endif 178 } 179 | ||
180 mike 1.1 //------------------------------------------------------------------------------ 181 // 182 // PEGASUS_INVALID_SOCKET 183 // 184 //------------------------------------------------------------------------------ 185 186 #ifdef PEGASUS_OS_TYPE_WINDOWS 187 # define PEGASUS_INVALID_SOCKET INVALID_SOCKET 188 #else 189 # define PEGASUS_INVALID_SOCKET (-1) 190 #endif 191 192 //------------------------------------------------------------------------------ 193 // 194 // SocketHandle 195 // 196 //------------------------------------------------------------------------------ 197 198 #ifdef PEGASUS_OS_TYPE_WINDOWS 199 typedef SOCKET SocketHandle; 200 #else 201 mike 1.1 typedef int SocketHandle; 202 #endif 203 204 //------------------------------------------------------------------------------ 205 // | ||
206 mike 1.2 // SocketLength | ||
207 mike 1.1 // 208 //------------------------------------------------------------------------------ 209 | ||
210 kumpf 1.5 #if defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) || \ | ||
211 mike 1.1 defined(PEGASUS_PLATFORM_SOLARIS_SPARC_GNU) || \ 212 defined(PEGASUS_PLATFORM_TRU64_ALPHA_DECCXX) || \ 213 defined(PEGASUS_PLATFORM_WIN32_IX86_MSVC) | ||
214 mike 1.2 typedef int SocketLength; 215 #elif defined(PEGASUS_PLATFORM_VMS_ALPHA_DECCXX) || \ | ||
216 mike 1.1 defined(PEGASUS_PLATFORM_VMS_IA64_DECCXX) || \ 217 defined(PEGASUS_PLATFORM_ZOS_ZSERIES_IBM) | ||
218 mike 1.2 typedef size_t SocketLength; 219 #elif defined(PEGASUS_PLATFORM_HPUX_IA64_ACC) && \ | ||
220 mike 1.1 !defined(_XOPEN_SOURCE_EXTENDED) | ||
221 mike 1.2 typedef int SocketLength; 222 #elif defined(PEGASUS_PLATFORM_HPUX_PARISC_ACC) && \ | ||
223 mike 1.1 !defined(_XOPEN_SOURCE_EXTENDED) | ||
224 mike 1.2 typedef int SocketLength; 225 #elif defined(PEGASUS_PLATFORM_SOLARIS_SPARC_CC) && \ | ||
226 mike 1.1 defined(SUNOS_5_6) | ||
227 mike 1.2 typedef int SocketLength; 228 #else 229 typedef socklen_t SocketLength; | ||
230 mike 1.1 #endif 231 232 #endif /* Pegasus_Network_h */ |
No CVS admin address has been configured |
Powered by ViewCVS 0.9.2 |