#ident "$Id: Space.c,v 1.6 1997/10/21 20:48:44 gary 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
 *
 *  SPACE.C
 *
 *
 *******************************************************************/

/*
 *	Space.c
 *	 /projects/common/PBRAIN/SCCS/pbrainF/dev/sys/x25/0/s.Space.c
 *	@(#)Space.c	1.21
 *
 *	Last delta created	17:54:34 4/15/92
 *	This file extracted	18:33:04 11/19/92
 *
 *	Modifications:
 *
 */

/* ----------------------------------------------------------------------
    Space allocation in the X.25 multiplexor code.
    Configuration limits are set only in this file.
   ---------------------------------------------------------------------- */


/* ---- CONFIGURATION LIMITS - Edit to change array sizes ------ */

/*
 * MAXXSUBNETS limits the number of networks connected
 */
#ifdef POWERPC
#define		MAXXSUBNETS	4
#elif SOH
#define		MAXXSUBNETS	16
#else
#define		MAXXSUBNETS	2
#endif

/*
 * MAXXCONFIG limits the number of configurable networks
 */
#ifdef POWERPC
#define		MAXXCONFIG	4
#elif SOH
#define		MAXXCONFIG	16
#else
#define		MAXXCONFIG	2
#endif

/*
 * MAXXDEVS limits the number of X25 streams
 */
#if POWERPC
#define		MAXXDEVS	260
#elif  SOH
#define		MAXXDEVS	260
#else
#define		MAXXDEVS	36
#endif

/*
 * MAXXVCS limits the number of PLP virtual circuit database elements 
 */
#if	POWERPC  
#define		MAXXVCS		256
#elif  SOH
#define		MAXXVCS		256
#else
#define		MAXXVCS		32
#endif

/*
 * MAXXLSAPS limits the number of PLP link database elements 
 */
#ifdef SOH
#define		MAXXLSAPS	64
#else
#define		MAXXLSAPS	16
#endif

#include "types.h"
#include "stream.h"
#include "ll_proto.h"
#include "x25_proto.h"
#include "x25_control.h"
#include "x25db.h"

/* ---- Declare the space for arrays for the X.25 multiplexor ---- */

struct x25vcformat FAR *iso_vc[MAXXVCS+1]; /* Pointer to the vc db elements   */
struct x25vcformat  xisovc[MAXXVCS+1];	   /* The vc db elements	      */
struct lsformat FAR *iso_lsap[MAXXLSAPS+1];/* Pointer to the link db elements */
struct lsformat     linklsaps[MAXXLSAPS+1];/* The link db elements	      */
struct xgldbf       xgldb[MAXXDEVS];	   /* The glue/stream db elements     */
struct xsndbf       xsndb[MAXXSUBNETS];	   /* The subnetwork stream db elements   */
struct x25cfgformat xcfg[MAXXCONFIG];	   /* The configuration elements      */

/* ---- Declare and initialise the external ABSOLUTE limits ---- */
/* ---- Note that they code limits are set to the same      ---- */

int	iMAXXVCS    = MAXXVCS;		/* Vc db usable limits		 */
int	iMAXXLSAPS  = MAXXLSAPS;	/* Link db usable limits	 */
int	iMAXXDEVS   = MAXXDEVS;		/* X.25 devices			 */
int	iMAXXCONFIG = MAXXCONFIG;	/* X.25 configured networks	 */
int	iMAXXSUBNETS= MAXXSUBNETS;	/* Subnetwork number attached	 */

/* ---- Declare and initialise the external limits used in code  ---- */
/* ---- BUT SEE THE 'INIT' AND 'CONTROL STREAM CLOSEDOWN' CODE   ---- */

int	isovcmax   = MAXXVCS;		/* Vc db usable limits		 */
int	isolsapmax = MAXXLSAPS;		/* Link db usable limits	 */
int	x25devmax  = MAXXDEVS;		/* X.25 devices			 */
int	x25cfgmax  = MAXXCONFIG;	/* X.25 configured networks	 */
int	x25submax  = MAXXSUBNETS;	/* Subnetwork number attached	 */

int     L3monarray[mon_size*MAXXSUBNETS];	/* Array of monitored events	 */

/*
 * Maximum number of entries in address table, and 
 * size of hash tables into it.
 * Hash table size MUST be at least twice address
 * table size, and preferably prime.
 */

#define	MAX_NUIADDRS	100
#define	MAX_NUIHASH	251



/******************************************************************
 * Declarations
 */

NUI_ADDR	nui_factab[MAX_NUIADDRS];	/* Address table	*/
int             nui_nuihash [MAX_NUIHASH];	/* Address hash index tables	*/
int             nui_fachash[MAX_NUIHASH];

int		max_nuiaddrs = MAX_NUIADDRS;
int		max_nuihash  = MAX_NUIHASH;
