Main Page   Class Hierarchy   Compound List   File List   Compound Members   File Members  

worm_socket.h

Go to the documentation of this file.
00001 //---------------------------------------------------------------------------
00002 #ifndef _WORM_SOCKET_H
00003 #define _WORM_SOCKET_H
00004 //---------------------------------------------------------------------------
00005 
00006 #if  defined(_WNNT) || defined(_Windows)
00007 
00008 // This include is not used herein, but will prevent
00009 // difficult-to-track-down multiple-declaration conflicts
00010 
00011 #if !defined(_WINSOCKAPI_)
00012 #define _WINSOCKAPI_  // prevent wacko compilation errors
00013 #endif
00014 #include <windows.h>
00015 //#define _WINSOCKAPI_  // prevent wacko compilation errors
00016 #include <winsock2.h>
00017 
00018 #define WORM_WOULDBLOCK WSAEWOULDBLOCK
00019 
00020 #elif  defined(_SOLARIS)
00021 
00022 #include <sys/types.h>
00023 #include <socket.h>
00024 
00025 #define WORM_WOULDBLOCK EWOULDBLOCK
00026 
00027 #else
00028 
00029 #error worm_socket.h not completed for this O/S
00030 
00031 #endif
00032 
00033 
00034 enum SOCKET_CLOSE_TYPE
00035 {
00036    SOCKET_DONT_CLOSE
00037  , SOCKET_CLOSE_IMMEDIATELY
00038  , SOCKET_CLOSE_GRACEFULLY
00039  , SOCKET_CLOSE_SIMPLY
00040 };
00041 
00042 
00043 // Worm Socket Function Ids
00044 //
00045 // Intended to track the source of socket errors for
00046 // exception handling
00047 //
00048 enum WS_FUNCTION_ID
00049 {
00050     WSF_NONE
00051   , WSF_IOCTLSOCK      // ioctlsocket()
00052   , WSF_SETSOCKOPT     // setsockopt()
00053   , WSF_GETSOCKOPT     // getsockopt()
00054   , WSF_GETSOCKOPT_ERR // error obtained by good getsockopt() call
00055   , WSF_SOCKET         // socket()
00056   , WSF_INET_ADDR      // inet_addr()
00057   , WSF_GETHOSTBYADDR  // gethostbyaddr()
00058   , WSF_CONNECT        // connect()
00059   , WSF_SELECT         // select()
00060   , WSF_BIND           // bind()
00061   , WSF_LISTEN         // listen()
00062   , WSF_ACCEPT         // accept()
00063   , WSF_SEND           // send()
00064   , WSF_RECV           // recv()
00065   , WSF_RECVFROM       // recvfrom()
00066 };
00067 
00068 
00069 
00070 enum SOCKET_RECV_STATUS
00071 {
00072     RECV_STATUS_ERROR        = -3 // socket error
00073   , RECV_STATUS_BADPARAM     = -2 // read request timed out
00074   , RECV_STATUS_CLIENTCLOSED = -1 // client closed socket gracefully
00075   , RECV_STATUS_COMPLETE     =  0 // data or complete message obtained
00076   , RECV_STATUS_NOTHING      =  1 // nothing waiting on socket
00077   , RECV_STATUS_PARTIAL      =  2 // bytes, but no complete message obtained
00078   , RECV_STATUS_TIMEDOUT     =  3 // read request timed out
00079   , RECV_STATUS_CANCELLED    =  4 // cancel flag encountered
00080 };
00081 
00082 enum SOCKET_SEND_STATUS
00083 {
00084     SEND_STATUS_ERROR        = -3 // socket error
00085   , SEND_STATUS_CLIENTCLOSED = -2 // client closed socket gracefully
00086   , SEND_STATUS_BADPARAM     = -1 // read request timed out
00087   , SEND_STATUS_GOOD         =  0
00088   , SEND_STATUS_TIMEDOUT     =  1 // read request timed out
00089   , SEND_STATUS_CANCELLED    =  2 // cancel flag encountered
00090 };
00091 
00092 
00093 #endif
00094 
00095  

Generated on Tue May 6 09:16:13 2003 for Earthworm Libs by doxygen1.3-rc3