/*
 * a header for PIPS network stuff
 */

#define PIPS_PORT	8001
#define PORT            "8001"
#define SERVER     "lucky.mit.edu"

#define HELP_PHONE      "(617) 253-4101"

#define	CRLF		"\015\012"
#define	LF		'\012'
#define	CR		'\015'

#define	EOL		"\012"		/* End of Line */
#define	EOL_LEN		1
#define EOM		".\015\012"		/* End of Message */
#define EOM_LEN		3
#define EOLM		"\012.\015\012"	/* EOL + EOM */
#define EOLM_LEN	(EOL_LEN + EOM_LEN)

#define BANNER     "TechInfo Server, version 1.2, March .\n"
/* prod locations *//*
#define  TRANS_LOG	"/site/logs/pips.trans.log"
#define  NEXTID_FILE	"/site/logs/pips.next.id"
#define  PROV_FILE	"/site/logs/pips.providers"
#define  VER_FILE	"/site/logs/pips.versions"
#define  LOCAL_WEB_FILE "/site/logs/pips.web"
#define  PROV_LN_SZ	40
#define  ADMIN_FILE	"/site/logs/pips.admin"
#define  ADMIN_LN_SZ	20
#define  IDLIST		"/site/logs/idlist"
*/
/* test locations */
#define  TRANS_LOG	"pips.trans.log"
#define  NEXTID_FILE	"pips.next.id"
#define  PROV_FILE	"pips.providers"
#define  VER_FILE	"pips.versions"
#define  LOCAL_WEB_FILE "pips.web"
#define  PROV_LN_SZ	40
#define  ADMIN_FILE	"pips.admin"
#define  ADMIN_LN_SZ	20
#define  IDLIST		"idlist" 

#define  HELP_ID        10210
#define  ADV_HELP_ID    22558

#define  NOBODY  -1


#define C_FULLFMT	0x1	/* Using full format output */
#define C_BUSY		0x2	/* connection is already being serviced */
#define C_TIMEOUT	0x4	/* Connection has timed out */
#define C_PROVIDER	0x8	/* Connection is a provider */

/*
 * Transaction codes.
 */

#define	T_ADDNODE	  'a'	/* add */
#define T_FIND            'b'	/* fnd, find */
#define	T_ENDPROVIDER	  'c'	/* epv, */
#define	T_DUMPWEB	  'd'	/* dmp, dump */
#define T_EXPAND          'e'	/* exp, expand */
#define	T_GETFILE	  'f'	/* fil, file, getfile? */
#define T_REORDER_BEFORE  'g'   /* reorder the child links */
#define T_SOURCE          'h'   /* test of valid source for an id */
#define T_RELOAD          'i'   /* reload the web from disk */
#define T_REORDER_AFTER   'j'   /* reorder the child links */
#define T_FINDKEY         'k'   /* find keyword */
#define	T_ADDLINK	  'l'	/* lnk, link */

#define	T_CLOSE_FD	  'm'	/* close a file descriptor */

#define	T_OUTPUTFMT	  'o'	/* fmt */
#define	T_TRYPROVIDER	  'p'	/* prv, provider */
#define T_QUIT            'q'   /* quit */
#define	T_REPLACENODE	  'r'	/* rpl, replace */
#define	T_SENDNODE	  's'	/* get, show? node? */
#define T_SENDFILE        't'	/* sfl, sendfile */
#define	T_RMLINK	  'u'	/* ulk, unlink */ 
#define T_VERSION         'v'   /* find current version */
#define T_TRAVERSE        'w'	/* trv, web? trav, traverse */
#define	T_RMNODE	  'x'	/* del, delete */
#define T_SAVEWEB         'y'   /* save the web to disk */
#define T_ADMIN           'z'	/* adm, admin */
/*
 * For/From netio.c
 */

/*
 * NOTE: send & deliver reference specific variable names!  `cur_sock' is a
 * global in transact.c, _sendbuf & _sendbuf_pos are global to netio.c.
 * All three parameters are kludgedly meant to be over-ridden by local
 * variables of the same name if so desired.
 */

#define	send(str)	dosend(str, _sendbuf, &_sendbuf_pos, cur_sock)
#define	deliver()	dodeliver(_sendbuf, &_sendbuf_pos, cur_sock)

#define	send_eol()	send(EOL)
#define	send_eom()	send(EOM)
#define	send_eolm()	send(EOLM)


#define	send_msg(s)	send(s), send_eolm()
#define	send_ok()	send_msg("OK")
#define	send_ok1()	send_msg("0:OK")
#define	send_nak()	send_msg("UNAUTHORIZED")
#define	send_err()	send_msg("ERROR!")
#define	send_huh()	send_msg("HUH?")

extern char	_sendbuf[];
extern char	*_sendbuf_pos;
