
#define CON			2
#define	Ndrive		0x50	/* drive P	*/
#define	MAXTRAP		34		/* posible traps +2	*/
#define	MAXHOSTS	8
#define NETHAN		24
#define	MAX_PATH	128

#define	SOH		1		/* START OF HEADER CHAR */
#define	EOT		4		/* end of transmission char */
#define	ACK		6		/* acknowledge sector transmission */
#define	NAK		21		/* error in transmission detected */
#define ERRORMAX 5
#define RETRYMAX 2
#define SECSIZ	1024L
#define HDRSIZ	8
#define PACSIZ	8
#define TCPBUF	2*(MAX_PATH+HDRSIZ)
#define	TCPFTP	1500
#define	NPORT	59
#define	FPORT	60

#define	ENMFIL	-49L
#define	EFNF	-33L
#define	EACCDN	-36L

/*		For alert		*/

#define	NO_RESP	0
#define	NO_INP	1
#define	N_ERR	2
#define TERM	3
#define UNH		4

/*		Prototypes		*/

void Trp1trp11(void);
void Trap_ins(void);
void net_core(char *);
void N_entry(void);
long S_reset(void);
void Stk_chg(void);
void Stk_rest(void);
int  cmd_tx(int num);
void cmd_tx1(int nobytes);
void get_answ(char	*parm);
void send_back(int cnt);
void fill_buf(int len);
int	 N_path(void);
int R_path(char *parm, int len);
int	ack_wait(void);
void makeRec(int , char *);
void send_RID( int);
/*int	 proc_func(void);	*/
int	 Iget_path(void);
int	 Rget_path(void);

int  N_BTST(int i, int j);
int  N_BSET(int i, int j);
void RELOC(long *buf, long relo);
void L_dcreate(char *parm);
void L_ddelete(char *parm);
void L_dsetpath(char *parm);
void L_fcreate(char *parm);
void L_fopen(char *parm);

void N_dcreate(char *Ibuf);
void N_ddelete(char *Ibuf);
void N_dsetpath(char *parm);
void N_fcreate(char *parm);
void N_fopen(char *parm);

/* ========== New from 18-7-97 =========== */
typedef unsigned long uint32;         /* Unsigned 32 bit (longword)         */

int 	is_STING (void);
void	wmess (const char *s);
int 	FTP_open (int port, uint32 rhost);
int		buf_out(int cnp, void *tx_buf, int count);

/* Well known hosts */
typedef struct
{
	uint32	ip_addr;
	char	name[8];
	short	dial;
	short	enabled;
	char	phone[20];
	short	cnh;
} WKH;

typedef	struct
{
	char	fpath[MAX_PATH];
	int		cnh, fhan;
	long	flen;
} FTS;

typedef	struct
{
	char	junk0, junk1, junk2;
	char	han;
	long	len;
} FRW;

typedef struct
{
	long	res;
	int 	func;
	int 	posh, posl;
	int 	han;
	char	fromh, froml;
} FSEEK;
	
typedef	struct
{
	char	cmd_st;
	char	station;
	char	cmd;
	char	path_yn;
	int		dummy;
	int		timeout;
	char	buf[SECSIZ];
}CM_PACKET;

typedef	struct
{
	char	soh;
	char	stid;
	long	res;
	int		eot;
	char	buf[SECSIZ];
}D_HDR;

typedef struct
{
	void	(*func)(char *);
}TRAP;
