#ident "$Id: x25inner.h,v 1.1 1995/03/16 17:18:18 garyp Exp $"
/*****************************************************************************
 * Copyright (c) 1988-95 Digi International Inc., All Rights Reserved
 * 
 * This  software  contains  proprietary  and  confidential   information   of
 * Digi International  Inc.   By  accepting  transfer  of this copy, Recipient
 * agrees to retain this software in  confidence,  to  prevent  disclosure  to
 * others,  and  to make no  use of this software other than that for which it
 * was delivered.  This is an unpublished copyright work  Digi   International
 * Inc.    Except   as   permitted   by  federal  law,  17 USC 117, copying is
 * strictly prohibited.
 * 
 * Digi  International  Inc.  CONFIDENTIAL  -   (Digi    International    Inc.
 * Confidential  when   combined   with   the   aggregated  modules  for  this
 * product) OBJECT CODE ONLY SOURCE MATERIALS
 * 
 * (C) COPYRIGHT Digi International Inc. 1995
 * 
 * All Rights Reserved
 * 
 * US   Government   Users   Restricted   Rights   -   Use,   duplication   or
 * disclosure  restricted by GSA ADP Schedule Contract with Digi International
 * Inc.
 * 
 *****************************************************************************/

/*******************************************************************
 *
 *  SpiderX25 X25 PLP Driver
 *
 *  Copyright 1991 Spider Systems Limited
 *
 *  X25INNER.H
 *
 *
 *******************************************************************/

/*
 *	x25inner.h
 *	 /projects/common/PBRAIN/SCCS/pbrainF/dev/sys/x25/0/s.x25inner.h
 *	@(#)x25inner.h	1.11
 *
 *	Last delta created	15:13:22 1/30/91
 *	This file extracted	18:32:59 11/19/92
 *
 */

/* ----------------------------------------------------------------------
   Definitions of internal structures which are not visible to the upper
			level user.
   ---------------------------------------------------------------------- */

/* ------ The Upper Glue Database Structure ------ */

struct xgldbf {
		queue_t	 *wq;		/* Write queue pointer */
		queue_t	 *rq;		/* Read queue pointer */
		struct Q gdbq;		/* Queue of listener CI/DIs */
		struct Q g_ear;		/* Listen address queue */
		int	 gstate;	/* State of the database */
		int	 gref;		/* Reference to the database */
		int	 xnetref;	/* Reference to X.25 db (attached) */
		int	 g_earmax;	/* Max no simult. CIs handled */
		int	 g_earuse;	/* Number CIs sent up */
		ushort	 xuid;		/* Effective user ID opener */
		unsigned char pvcflg;	/* Marks PVC - 2 states only */
};

/* ------ The Upper Glue Database States ------ */

#define		G_IDLE		0	/* DB is free for use */
#define		G_OPEN		1	/* DB has been opened */
#define		G_LISTENING	2	/* DB is listening for CIs */
#define		G_ATTACHED	3	/* DB is handling X.25 connection */
#define		G_FROZEN	4	/* DB M_ERROR sent */
#define		G_FREEZING	5	/* DB going to G_FROZEN (buf reqd) */
#define		G_PVCWAITING	6	/* User waiting PVC attach rsp */

/* ------ Internal connect and disconnect formats ------ */

   struct i_xdiscf {
   struct xdiscf xdisc;            /* As defined in x25_proto.h */
   int           holdns;           /* To hold the netref on listener */
   };

   struct i_xcallf {
   struct xcallf xcall;            /* As defined in x25_proto.h */
   int           holdns;           /* To hold the netref on listener */
   };


/* ------ Internal Management Structures ------ */

#define PRIORITY_LISTEN 512
#define ROOT_LISTEN     256

   struct i_xlistenf {
   unsigned char  l_cumode;		/* Match mode for CUDF */
   unsigned char  l_culength;		/* Length of CUDF match field */
   unsigned char  l_cubytes[16];	/* CUDF match field */
   unsigned char  l_mode;		/* Match mode for address */
   unsigned char  l_type;		/* Address type DTE or NSAP */
   unsigned char  l_length;		/* Semi-octet length of match field */
   unsigned char  l_add[20];		/* Address match field */
   int		  l_total;		/* Total length to match on         */
   int		  l_gref;		/* Glue module listen is for        */
   int		  l_snid;       /* Subnet work ID */
   };
