/* assumes IBM TCP/IP 1.2.1 (or possibly higher) for OS/2 1.x and 2.x */

/* to avoid warnings/errors, you will have to fix the TCP/IP headers 
 * in two places: 
 *
 * - in netlib.h, remove the useless SIGALRM definition
 * - in utils.h, replace // comments by regular ones 
 *
 * both headers are not included directly but via types.h
 */

#ifdef __IBMC__
#define off_t _dummy_off_t  /* avoid warning */
#include <types.h>
#undef off_t
#else
#define far _far
#define cdecl _cdecl
#include <types.h>
#endif

#include <netinet/in.h>
#include <netdb.h>
#include <sys/socket.h>

#ifdef TCPDEC
#define IP   244
#define AYT  246
#define socket_close           close_socket
#define socket_ioctl(f,c,b)    ioctl(f,c,(char *)b)
#define bzero(s,n)             memset(s,0,n)
#define bcopy(h,a,l)           memmove(a,h,l)
#define FD_SETSIZE             MAX_SOCKETS
typedef void *caddr_t;
#endif

#ifdef TCPIBM
/* uncomment this to use the BSD select() with IBM TCP/IP */
/* #define BSD_SELECT */
#include <sys/ioctl.h>
#include <sys/select.h>
#include <protocol/telnet.h>
#define socket_close           soclose
#define socket_ioctl(f,c,b)    ioctl(f,c,(char *)b,sizeof(long))
/* this is a bit dangerous, but we always read a long with sioctl */
#undef sleep
#undef perror
#endif

#define TCPIPLIB

#define socket_errno           errno
#define socket_read(f,s,n)     recv(f,s,n,0)
#define socket_write(f,s,n)    send(f,s,n,0)

_PROTOTYP( int netinit, (void) );

_PROTOTYP( int os2_netopen, (char *, int *, int) );
_PROTOTYP( int os2_netclos, (void) );
_PROTOTYP( int os2_netflui, (void) );
_PROTOTYP( int os2_nettchk, (void) );
_PROTOTYP( int os2_netbreak, (void) );
_PROTOTYP( int os2_netinc, (int) );
_PROTOTYP( int os2_nettol, (char *, int) );
_PROTOTYP( int os2_nettoc, (int) );
