tcpip_definitions.h

Go to the documentation of this file.
00001 #ifndef TCPIP_DEFINITIONS_GROUP
00002 #define TCPIP_DEFINITIONS_GROUP
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : tcpip_definitions                                                 *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *  Purpose:                                                                   *
00010 *                                                                             *
00011 *    Provides some variables that make porting between Unix and W32 easier.   *
00012 *                                                                             *
00013 *******************************************************************************
00014 * Copyright (c) 2001-$now By Author.  This program is free software; you can  *
00015 * redistribute it and/or modify it under the terms of the GNU General Public  *
00016 * License as published by the Free Software Foundation; either version 2 of   *
00017 * the License or (at your option) any later version.  This is online at:      *
00018 *     http://www.fsf.org/copyleft/gpl.html                                    *
00019 * Please send any updates to: fred@gruntose.com                               *
00020 \*****************************************************************************/
00021 
00022 #include "sockets_dll.h"
00023 
00024 // sockets can be intrigued by the occurrence of the following conditions:
00025 enum socket_interests {
00026   SI_READABLE      = 0x1,   // the socket is readable; there's data there.
00027   SI_WRITABLE      = 0x2,   // the socket will accept data if it's sent.
00028   SI_CONNECTED     = 0x4,   // the socket is connected.
00029   SI_DISCONNECTED  = 0x8,   // the socket is disconnected.
00030   SI_ERRONEOUS     = 0x10,  // the socket is in an erroneous state.
00031   SI_BASELINE      = 0x20,  // the socket seems okay but not interesting.
00032 
00033   SI_ALL_SOCK_INT  = 0xFF   // all socket interests are active.
00034 };
00035 
00036 #ifdef __UNIX__
00037   // provide some unifying definitions.
00038   #define INVALID_SOCKET -1
00039   #define SOCKET_ERROR -1
00040   typedef void sock_hop;
00041 
00042   // provide synonyms for errors so we don't conflict with the windows
00043   // brain-deadness.  they define error values like EACCESS but they're not
00044   // the real values you need to use with tcp/ip.  french fried gates time.
00045   #define SOCK_EACCES EACCES
00046   #define SOCK_EADDRINUSE EADDRINUSE
00047   #define SOCK_EADDRNOTAVAIL EADDRNOTAVAIL
00048   #define SOCK_EAFNOSUPPORT EAFNOSUPPORT
00049   #define SOCK_EALREADY EALREADY
00050   #define SOCK_EBADF EBADF
00051   #define SOCK_ECONNABORTED ECONNABORTED
00052   #define SOCK_ECONNREFUSED ECONNREFUSED
00053   #define SOCK_ECONNRESET ECONNRESET
00054   #define SOCK_EDESTADDRREQ EDESTADDRREQ
00055   #define SOCK_EDQUOT EDQUOT
00056   #define SOCK_EFAULT EFAULT
00057   #define SOCK_EHOSTDOWN EHOSTDOWN
00058   #define SOCK_EHOSTUNREACH EHOSTUNREACH
00059   #define SOCK_EINPROGRESS EINPROGRESS
00060   #define SOCK_EINTR EINTR
00061   #define SOCK_EINVAL EINVAL
00062   #define SOCK_EISCONN EISCONN
00063   #define SOCK_ELOOP ELOOP
00064   #define SOCK_EMFILE EMFILE
00065   #define SOCK_EMSGSIZE EMSGSIZE
00066   #define SOCK_ENAMETOOLONG ENAMETOOLONG
00067   #define SOCK_ENETDOWN ENETDOWN
00068   #define SOCK_ENETUNREACH ENETUNREACH
00069   #define SOCK_ENETRESET ENETRESET
00070   #define SOCK_ENOBUFS ENOBUFS
00071   #define SOCK_ENOPROTOOPT ENOPROTOOPT
00072   #define SOCK_ENOTCONN ENOTCONN
00073   #define SOCK_ENOTEMPTY ENOTEMPTY
00074   #define SOCK_ENOTSOCK ENOTSOCK
00075   #define SOCK_EOPNOTSUPP EOPNOTSUPP
00076   #define SOCK_EPFNOSUPPORT EPFNOSUPPORT
00077   #define SOCK_EPROCLIM EPROCLIM
00078   #define SOCK_EPROTOTYPE EPROTOTYPE
00079   #define SOCK_EPROTONOSUPPORT EPROTONOSUPPORT
00080   #define SOCK_EREMOTE EREMOTE
00081   #define SOCK_ESHUTDOWN ESHUTDOWN
00082   #define SOCK_ESOCKTNOSUPPORT ESOCKTNOSUPPORT
00083   #define SOCK_ESTALE ESTALE
00084   #define SOCK_ETIMEDOUT ETIMEDOUT
00085   #define SOCK_ETOOMANYREFS ETOOMANYREFS
00086   #define SOCK_EWOULDBLOCK EWOULDBLOCK
00087   #define SOCK_EUSERS EUSERS
00088 #endif
00089 
00090 #ifdef __WIN32__
00091   #include <basis/portable.h>
00092 
00093   // provide some aliases for w32.
00094 #if COMPILER_VERSION==6
00095   #define hostent HOSTENT
00096 #endif
00097   typedef char sock_hop;
00098   typedef int socklen_t;
00099 
00100   // provide close to the real BSD error names using windows values.
00101   #define SOCK_EACCES WSAEACCES
00102   #define SOCK_EADDRINUSE WSAEADDRINUSE
00103   #define SOCK_EADDRNOTAVAIL WSAEADDRNOTAVAIL
00104   #define SOCK_EAFNOSUPPORT WSAEAFNOSUPPORT
00105   #define SOCK_EALREADY WSAEALREADY
00106   #define SOCK_EBADF WSAEBADF
00107   #define SOCK_ECONNABORTED WSAECONNABORTED
00108   #define SOCK_ECONNREFUSED WSAECONNREFUSED
00109   #define SOCK_ECONNRESET WSAECONNRESET
00110   #define SOCK_EDESTADDRREQ WSAEDESTADDRREQ
00111   #define SOCK_EDQUOT WSAEDQUOT
00112   #define SOCK_EFAULT WSAEFAULT
00113   #define SOCK_EHOSTDOWN WSAEHOSTDOWN
00114   #define SOCK_EHOSTUNREACH WSAEHOSTUNREACH
00115   #define SOCK_EINPROGRESS WSAEINPROGRESS
00116   #define SOCK_EINTR WSAEINTR
00117   #define SOCK_EINVAL WSAEINVAL
00118   #define SOCK_EISCONN WSAEISCONN
00119   #define SOCK_ELOOP WSAELOOP
00120   #define SOCK_EMFILE WSAEMFILE
00121   #define SOCK_EMSGSIZE WSAEMSGSIZE
00122   #define SOCK_ENAMETOOLONG WSAENAMETOOLONG
00123   #define SOCK_ENETDOWN WSAENETDOWN
00124   #define SOCK_ENETUNREACH WSAENETUNREACH
00125   #define SOCK_ENETRESET WSAENETRESET
00126   #define SOCK_ENOBUFS WSAENOBUFS
00127   #define SOCK_ENOPROTOOPT WSAENOPROTOOPT
00128   #define SOCK_ENOTCONN WSAENOTCONN
00129   #define SOCK_ENOTEMPTY WSAENOTEMPTY
00130   #define SOCK_ENOTSOCK WSAENOTSOCK
00131   #define SOCK_EOPNOTSUPP WSAEOPNOTSUPP
00132   #define SOCK_EPFNOSUPPORT WSAEPFNOSUPPORT
00133   #define SOCK_EPROCLIM WSAEPROCLIM
00134   #define SOCK_EPROTOTYPE WSAEPROTOTYPE
00135   #define SOCK_EPROTONOSUPPORT WSAEPROTONOSUPPORT
00136   #define SOCK_EREMOTE WSAEREMOTE
00137   #define SOCK_ESHUTDOWN WSAESHUTDOWN
00138   #define SOCK_ESOCKTNOSUPPORT WSAESOCKTNOSUPPORT
00139   #define SOCK_ESTALE WSAESTALE
00140   #define SOCK_ETIMEDOUT WSAETIMEDOUT
00141   #define SOCK_ETOOMANYREFS WSAETOOMANYREFS
00142   #define SOCK_EUSERS WSAEUSERS
00143 
00144   // windows specific names.
00145   #define SOCK_EWOULDBLOCK WSAEWOULDBLOCK
00146   #define SOCK_HOST_NOT_FOUND WSAHOST_NOT_FOUND
00147   #define SOCK_NO_DATA WSANO_DATA
00148   #define SOCK_NO_RECOVERY WSANO_RECOVERY
00149   #define SOCK_NOTINITIALISED WSANOTINITIALISED
00150   #define SOCK_SYSNOTREADY WSASYSNOTREADY
00151   #define SOCK_TRY_AGAIN WSATRY_AGAIN
00152   #define SOCK_VERNOTSUPPORTED WSAVERNOTSUPPORTED
00153 #endif
00154 
00155 #endif
00156 

Generated on Fri Nov 21 04:29:17 2008 for HOOPLE Libraries by  doxygen 1.5.1