• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

spl/net/csocket.h

00001 #error "Plain Old C no longer supported"
00002 
00003 
00004 //#ifndef _csocket_h
00005 //#define _csocket_h
00006 
00007 //#include <stdio.h>
00008 //
00009 //#if defined(_WIN32) || defined(WIN32)
00010 //#include <spl/configwin32.h>
00011 //#else
00012 //#include <spl/autoconf/config.h>
00013 //#endif
00014 //
00015 //#include <spl/debug.h>
00016 //#ifdef HAVE_ERRNO_H
00017 //#include <errno.h>
00018 //#endif
00019 //#include <sys/types.h>
00020 //#include <spl/strbuf.h>
00021 //
00022 //#if defined(_WIN32) || defined(WIN32)
00024 //#define _WINSOCKAPI_
00025 //#include <spl/cleanwindows.h>
00026 //#include <winsock2.h>
00027 //#include <spl/configwin32.h>
00028 //#endif
00029 //
00030 //#include <sys/types.h>
00031 //#ifdef HAVE_NETINET_IN_H
00032 //#include <netinet/in.h>
00033 //#endif
00034 //#ifdef HAVE_SYS_SOCKET_H
00035 //#include <sys/socket.h>
00036 //#endif
00037 //#ifdef HAVE_ERRNO_H
00038 //#include <errno.h>
00039 //#endif
00040 //#ifdef HAVE_UNISTD_H
00041 //#include <unistd.h>
00042 //#endif
00043 //#ifdef HAVE_SYS_FCNTL_H
00044 //#include <sys/fcntl.h>
00045 //#endif
00046 //#ifdef HAVE_FCNTL_H
00047 //#include <fcntl.h>
00048 //#endif
00049 //#ifdef HAVE_NETINET_TCP_H
00050 //#include <netinet/tcp.h>
00051 //#endif
00052 //#ifdef HAVE_ARPA_INET_H
00053 //#include <arpa/inet.h>
00054 //#endif
00055 //#ifdef HAVE_NETDB_H
00056 //#include <netdb.h>
00057 //#endif
00058 //
00059 //#if !defined(SOCKET) && !defined(_WIN32)
00060 //typedef int SOCKET;
00061 //#endif
00062 //#if !defined(_WIN32)
00063 //typedef struct sockaddr_in SOCKADDR_IN;
00064 //#endif
00065 //#if !defined(_WIN32)
00066 //#define closesocket(A) close(A)
00067 //#define INVALID_SOCKET -1
00068 //#endif
00069 //#if !defined(SD_BOTH)
00070 //#define SD_BOTH SHUT_RDWR
00071 //#endif
00072 //#ifdef HAVE_SYS_TIME_H
00073 //#include <sys/time.h>
00074 //#endif
00075 //#ifdef HAVE_SYS_IOCTL_H
00076 //#include <sys/ioctl.h>
00077 //#endif
00078 //#ifdef HAVE_TIME_H
00079 //#include <time.h>
00080 //#endif
00081 //
00082 //#ifdef __cplusplus
00083 //extern "C" {
00084 //#endif
00085 //
00086 //typedef struct csocket
00087 //{
00088 //      int m_errorStatus;         /* from errno */
00089 //      SOCKET m_fd;
00090 //      SOCKADDR_IN m_saAddr;
00091 //} csocket;
00092 //
00093 //csocket *socketConstruct ( const int port );
00094 //csocket *socketAccept ( const csocket *acceptFrom ); /* call accept */
00095 //void socketDestruct( csocket *sock );
00096 //
00097 //bool socketSetNonBlocking( const csocket *sock );
00098 //bool socketSetBlocking( const csocket *sock );
00099 //
00100 //bool socketListen ( csocket *sock, const int iNumBuf);
00101 //bool socketSend ( csocket *sock, const byte *data, const int len);  /* write to sock */
00103 //int socketRecv ( csocket *sock, byte *buf, const int blen);   /* pull data from sock. */
00104 //bool socketFlush( csocket *sock );
00105 //bool socketBind ( csocket *sock );
00106 //int socketBytesAvail( csocket *sock );
00107 //
00108 //bool socketConnect ( csocket *sock, const char *address);   /* INADDR_ANY... */
00109 //
00110 //SOCKET socketGetFd( csocket *sock );
00111 //SOCKADDR_IN *socketGetAddr( csocket *sock );
00112 //
00113 //void socketClose( csocket *sock );
00114 //void socketShutdown( csocket *sock, const int i/*=SD_BOTH*/ );
00115 //
00116 //bool socketSetLingerOn( csocket *sock );
00117 //bool socketSetLingerOff( csocket *sock );
00118 //bool socketSetNoDelay( csocket *sock );
00119 //
00120 //bool socketSetSendTimeout( csocket *sock, const int toMS);
00121 //bool socketSetRecvTimeout( csocket *sock, const int toMS);
00122 //int socketGetSendTimeout( csocket *sock );
00123 //int socketGetRecvTimeout( csocket *sock );
00124 //bool socketSetAddrReuse ( csocket *sock, const int i );
00125 //
00126 //void socketShutdownService(  );
00127 //
00128 //#define SOCKBUF_SIZE 1024
00129 //
00130 //typedef struct _socketbuffer
00131 //{
00132 //      byte buf[SOCKBUF_SIZE];
00133 //      int len;
00134 //      int pos;
00135 //      csocket *sock;
00136 //} socketbuffer;
00137 //
00138 //socketbuffer *socketbufferConstruct( csocket *sock );
00139 //void socketbufferDestruct( socketbuffer *sbuf );
00140 //int socketbufferGetCh( socketbuffer *sbuf );
00141 //bool socketbufferReadLine( socketbuffer *sbuf, strbuf *output );
00142 //int socketbufferPending( const socketbuffer *sbuf );
00143 //bool socketbufferRead( socketbuffer *sbuf, strbuf *output, const int size );
00144 //
00145 //#if defined( DEBUG ) || defined( _DEBUG )
00146 //void socketValidateMem( const csocket *sock );
00147 //void socketCheckMem( const csocket *sock );
00148 //void socketbufferValidateMem( const socketbuffer *sbuf );
00149 //void socketbufferCheckMem( const socketbuffer *sbuf );
00150 //#else
00151 //#define socketValidateMem( A )
00152 //#define socketCheckMem( A )
00153 //#define socketbufferValidateMem( A );
00154 //#define socketbufferCheckMem( A );
00155 //#endif
00156 //
00157 //
00158 //#ifdef __cplusplus
00159 //}
00160 //#endif
00161 
00162 
00163 //#endif