
/*
 *	NNet.h
 *
 *   Header file for Nicks network functions
 *
 */

#ifndef _NNET_H_
#define _NNET_H_

/*
 *   Includes
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>

#ifdef _AMIGA
#include <bsdsocket.h>
#endif

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

/*
 *   Definitions
 */

#define TRUE			1
#define FALSE			0

#define NOT_CONNECTED		-700
#define CONNECTION_LOST		-701
#define TIMEOUT			-702
#define INTERRUPT		-703

#define TERM_LEN                5
#define TERM_STR                "\r\n.\r\n"

#define CODE_LEN		3

#define DEF_TIMEOUT		60

/*
 *   Protos
 */

  extern int InitAmigaTCP( void );
  extern void QuitAmigaTCP( void );

  extern int ChkTerm( char *, const char *, unsigned int );

  extern int SetAddress( const char *, const char *, struct sockaddr_in * );
  extern long MakeConnection( const struct sockaddr_in * );
  extern void EndConnection( long );
  extern int SendCommand( const long, const char *, const char * );
  extern int GetResponse( const long );
  extern int GetData( const long, char *, int );

  extern long RecvN( const long, char *, long, long, unsigned int );
  extern long TORecv( const long, char *, long, long, unsigned int );

#define close CloseSocket

#endif
