www.pudn.com > watsock.zip > WINSK.H


 
#include "winsock.h"  /* Must be included before TCPSTREAM definition */ 
 
/* TCP input buffer -- must be large enough to prevent overflow */ 
 
#define BUFLEN 8192 
 
 
/* TCP I/O stream (must be before osdep.h is included) */ 
 
#define TCPSTREAM struct tcp_stream 
TCPSTREAM { 
  char *host;                   /* host name */ 
  char *localhost;              /* local host name */ 
  SOCKET tcps;                   /* tcp socket */ 
  long ictr;                    /* input counter */ 
  char *iptr;                   /* input pointer */ 
  char ibuf[BUFLEN];            /* input buffer */ 
}; 
 
/* Holds  the addresses of the socket routines in the socket dll */ 
#define SOCKDLL struct SockDll 
SOCKDLL  { 
  SOCKET (PASCAL FAR * socket)(int af, int type, int protocol); 
  int (PASCAL FAR * connect)(SOCKET s, struct sockaddr FAR *name, int namelen); 
  int (PASCAL FAR *closesocket)(SOCKET s); 
  int (PASCAL FAR *select)(int nfds, fd_set FAR *readfds, fd_set FAR *writefds, fd_set FAR *exceptfds, struct timeval FAR *timeout); 
  int (PASCAL FAR *recv)(SOCKET s, char FAR *buf, int len, int flags); 
  int (PASCAL FAR *send)(SOCKET s, char FAR *buf, int len, int flags); 
  struct hostent * (PASCAL FAR *gethostbyname)(char FAR *name); 
  int (PASCAL FAR *gethostname)(char FAR *name, int namelen); 
  unsigned long (PASCAL FAR *inet_addr)(char FAR *cp); 
  unsigned long (PASCAL FAR *so_rhost)(char  **cp); 
  u_long (PASCAL FAR *htonl)(u_long hostlong); 
  u_short (PASCAL FAR *htons)(u_short hostshort); 
  u_long (PASCAL FAR *ntohl)(u_long netlong); 
  u_short (PASCAL FAR *ntohs)(u_short hostshort); 
}; 
 
void wat_init_libs(void) ;           /* for testing only */ 
 
int TCP_init_libs(char *global_dir); 
void TCP_free_libs(void);