#ifndef GOTCHALIB_H
#define GOTCHALIB_H

#ifndef  EXEC_TYPES_H
#include <exec/types.h>
#endif

struct gl_address {
USHORT zone;		/* zone number */
USHORT net;		/* net number */
USHORT node;		/* node number */
USHORT point;		/* point number */
UBYTE domain[32];	/* domain name */
BOOL anyzone;		/* any zone (?:) */
BOOL anynet;		/* any net (:?) */
BOOL anynode;		/* any node (/?) */
BOOL anypoint;		/* any point (.?) */
BOOL anydomain;		/* any domain (@?) */
BOOL anyany;		/* any zone,net,node,point (?:?/?.?) */
};

struct gl_pattern {
USHORT	thiszone;	/* PRIVATE! don't even think about reading */
USHORT	thisnet;	/* anything from here or even writing to here!! */
LONG	zoneoff;
LONG	netoff;
LONG	m;
BOOL	stop;
UBYTE   thisdomain[32];
};

struct gl_nodeinfo {	/* filled by GL_FindNode functions */
USHORT zone;		/* zone number */
USHORT net;		/* net number */
USHORT node;		/* node number */
USHORT point;		/* point number */
USHORT region;		/* region number */
USHORT hub;		/* hub number */
SHORT cost;		/* cost for this address */
UBYTE domain[32];	/* domain */
UBYTE name[64];		/* BBS name */
UBYTE location[64];	/* location */
UBYTE sysop[64];	/* sysop name */
UBYTE phone[64];	/* original phonenumber */
UBYTE tphone[64];	/* translated phonenumber */
UBYTE baud[32];		/* baudrate from the nodelist */
UBYTE flags[64];	/* nodelist flags */
UBYTE password[32];	/* password */
};

	/* flags for GL_NodeRequest */
#define GLBF_NOINFO 1		/* "quick mode", no browser info window */

	/* GL_NodeRequest and GL_PortRequest returncodes */
enum {
	GLB_OK,		/* everything OK */
	GLB_CANCEL,	/* user canceled */
	GLB_NOLIBGT,	/* no gadtools library */
	GLB_NOLIBGTL,	/* no gtlayout library */
	GLB_NOLIBINT,	/* no intuition library */
	GLB_NOWINDOW,	/* no window */
	GLB_NOMEM	/* no memory */
};

struct gl_browser {
struct Screen 		*scr;	/* screen to open on or NULL */
struct gl_context 	*co;	/* context from GL_OpenNL */
ULONG	flags;			/* GLBF_#? */
UBYTE	*result;		/* where to store the result, 64 bytes buffer */
BYTE	*wtitle;		/* window title or NULL */
};

	/* flags for GL_PortRequest */
#define GLPF_GOTCHAONLY 1	/* list only Gotcha ports */

struct gl_portreq {
struct Screen 	*scr;		/* screen to open on or NULL */
struct Window	*win;		/* parent window or NULL */
char		*wtitle;	/* window title or NULL */
UBYTE		*defport;	/* initial port name */
UBYTE		*res;		/* buffer to store the result */
ULONG		resmax;		/* size of result buffer in bytes */
ULONG		flags;		/* GLPF_#? or'ed together */
};


enum {
	AN_HEAD,	/* AddHead */
	AN_TAIL,	/* AddTail */
	AN_ENQUEUE,    	/* Enqueue (priority) */
	AN_INSERT,	/* Insert, case sensitive, after (char*)<data> */
	AN_INSERTI,	/* Insert, case insensitive, after (char*)<data> */
	AN_INSERT_AF,	/* Insert, sort alpha forward, case sensitive */
	AN_INSERT_AB,	/* Insert, sort alpha backwards, case sensitive */
	AN_INSERT_AFI,	/* Insert, sort alpha forward, case insensitive */
	AN_INSERT_ABI	/* Insert, sort alpha backwards, case insensitive */
};

enum {
	FN_I,		/* case insensitive */
	FN_S,		/* case sensitive */
	FN_INSTR,	/* instring */
};

	/* GL_ReadItem resultcodes */
#define GLRI_EQU 1		/* a '=' */
#define GLRI_EOF 2		/* no more items */
#define GLRI_ERR 3		/* error */
#define GLRI_OK  4		/* everything ok, could read an item */


/*******************/

struct gl_poll {
ULONG	version;		/* set to GLPOLL_VERSION */
UBYTE	*port;                  /* port to use with GUI */
ULONG	sizeport;
UBYTE	*dir;                   /* directory to scan (outbound) */
UBYTE	*wintitle;
ULONG	flags;			/* GLPF_#? */
ULONG	error;
};

enum {GLPER_NODIR=1, GLPER_NOGTLAYOUT, GLPER_NOGADTOOLS, GLPER_NOWINDOW,
	GLPER_NOHANDLE, GLPER_NOTHINGTOCALL};

#define GLPOLL_VERSION 	0
#define GLPF_CRASH      (1)	/* crash mail */
#define GLPF_DIRECT	(1<<1)	/* direct mail */
#define GLPF_NORMAL	(1<<2)	/* nomal */
#define GLPF_REQUEST	(1<<3)	/* requests */
#define GLPF_GUI        (1<<4)	/* open gui */
#define GLPF_ACTIVE	(1<<5)	/* open gui on active screen */

#endif /* GOTCHALIB_H */
