/* begincopyright
  Copyright (c) 1988, 1989, 1992 Xerox Corporation. All rights reserved.
  Use and copying of this software and preparation of derivative works based
  upon this software are permitted. Any distribution of this software or
  derivative works must comply with all applicable United States export
  control laws. This software is made available AS IS, and Xerox Corporation
  makes no warranty about the software, its performance or its conformity to
  any specification. Any person obtaining a copy of this software is requested
  to send their name and post office or electronic mail address to:
    PCR Coordinator
    Xerox PARC
    3333 Coyote Hill Rd.
    Palo Alto, CA
  endcopyright */
/*	
*
*	ThreadsTLI.h
*
*	Tim Diebert: November 21, 1989 5:52:05 pm PST
*	Michael Plass: February 18, 1992 9:49:23 am PST
*
*
*	This is a collection of definitions and functions to deal with XNS
*	SPP streams.  It doesn't rely upon the TLI library functions.
*
*/

/*	I really hesitate to add this include, but its contents are needed
*	for this file to live on its own.  The include can be left out if
*	religion plays a part in your mind.
*/
#include	<sys/types.h>
#include	<nettli/tiuser.h>

/****	Type definitions	*/

union xns←net {
	u←char		c←net[4];
	u←short		s←net[2];
};

union xns←host {
	u←char		c←host[6];
	u←short		s←host[3];
};

union xns←socket {
	u←char		c←socket[2];
	u←short		s←socket;
};

struct xns←addr {
	union xns←net		x←net;
	union xns←host		x←host;
	union xns←socket	x←socket;
};

/*	In order to bypass using the TLI libraries, since they maintain
*	global state, it will be necessary to pass around something other
*	than a file descriptor.  The following defines the data structure
*	for holding the state that was originally held as global state
*	by the TLI code.
*/

struct conn←data	{
	unsigned	cd←flags;	/* flags              */
	int	cd←rcvsize;	/* rcv buffer size    */
	char *  cd←rcvbuf;	/* rcv buffer         */
	int	cd←ctlsize;	/* ctl buffer size    */
	char *  cd←ctlbuf;	/* ctl buffer         */
	char *  cd←lookdbuf;	/* look data buffer   */
	char *  cd←lookcbuf;	/* look ctl buffer    */
	int	cd←lookdsize;	/* look data buf size */
	int	cd←lookcsize;	/* look ctl buf size  */
	int	cd←maxpsz;	/* TIDU size          */
	long	cd←servtype;	/* service type       */
	int     cd←lookflg;	/* buffered look flag */
	int	cd←fd;		/* the fd normally returned by TLI	*/
	int	cd←errno;	/* the global errno from TLI		*/
	struct t←info cd←info;	/* filled in on the call to XR←T←Open	*/
};
typedef	struct conn←data conn←data←t;