#ident "$Id: frs.h,v 1.12 1997/09/23 16:38:19 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.
 * 
 *****************************************************************************/

/*****************************************************************************
 *                                                                           *
 * (c) COPYRIGHT 1991, 1992 HARRIS & JEFFRIES, INC.                          *
 *                          888 WASHINGTON STREET                            *
 *                          SUITE 130                                        *
 *                          DEDHAM, MA  02026                                *
 * ALL RIGHTS RESERVED                                                       *
 *                                                                           *
 * This software is the property of Harris & Jeffries, Inc. and is furnished *
 * under license by Harris & Jeffries, Inc. and this software may be used    *
 * only in accordance with the terms of said license.  This copyright notice *
 * may not be removed, modified or obliterated without the prior written     *
 * permission of Harris & Jeffries, Inc.                                     *
 *                                                                           *
 * This software may not be copied, transmitted, provided to or otherwise    *
 * made available to any other person, company, corporation or other entiry  *
 * except as specified in the terms of said license.                         *
 *                                                                           *
 * No right, title, ownership or other interest in the software is hereby    *
 * granted or transferred.                                                   *
 *                                                                           *
 * The information contained herein is subject to change without notice and  *
 * should not be construed as a commitment by Harris & Jeffries, Inc.        *
 *                                                                           *
 *****************************************************************************

   MODULE NAME:


		@@@@@@  @@@@@    @@@@           @    @
		@       @    @  @               @    @
		@@@@@   @    @   @@@@           @@@@@@
		@       @@@@@        @   @@@    @    @
		@       @   @   @    @   @@@    @    @
		@       @    @   @@@@    @@@    @    @


   ORIGINAL AUTHOR:  David Jeffries
   SUBJECT MATTER 
	  SPECIALIST:   Deepak Shahane

   REVISION HISTORY:

   Date     Version  Name          Description
   -------- -------  ------------  --------------------------------------------
   01-16-92 1.10A    H&J (DJ)      Original
   11-20-92 2.00E    H&J (DJ)      Change len argument in FRSLmiRcvStat()
							from u_short to short and change for-loop
							test to "len > 0", to catch invalid
							status format. 

   09-28-93 2.00H    H&J (GB)      Created new headers for protocol 
							 encapsulation and reassembly for support
							 of RFC 1490.
							Added new API PIDs for use with the
							 encapsulation/reassembly functions for
							 RFC1490 support.
		  Other    H&J           See H&J's bug reports

   $Log: frs.h,v $
   Revision 1.12  1997/09/23 16:38:19  gary
   The Frame Relay and X.25 API's consist of 32-bit fields only.  This is
   to simplify structure alignment considerations, and make endian issues
   less cumbersome.

   In addition, the Frame Relay API now uses SNID's instead of links, thereby
   making it more compatible with the X.25 and ISDN API's.

   These changes span a large number of files.

   Revision 1.11  1997/09/15 21:18:55  gary
   Modified buffer offset when copying encapsulated data to new buffers.
   It was not a multiple of 4.  This would slow down bcopy calls.

   Revision 1.10  1996/10/24 20:02:16  gary
   1) Fixed bug in FRI_GetLinkParameters that would cause garbage to be
   returned.
   2) Removed support for old method of compression (per-packet basis).
   The API has not changed (yet).  The STAC parameters are simply ignored.
   3) FRF.9 activated.

   Revision 1.9  1996/10/22 21:19:15  gary
   A bit of rearranging was required in order to move the FRF9_Stats_t
   structure over to fr_cont.h. (needed by host drivers)

   Revision 1.8  1996/10/21 19:12:19  gary
   Rearranged the location of certain API definitions, so that all API-related
   material can be found in a single header file.

   Revision 1.7  1996/10/18 21:59:29  gary
   Minor Frame Relay directory clean-up.

   Revision 1.6  1996/06/19 16:33:42  gary
   General cleanup and modifications so that the source files may be
   compiled using makefile v2.x.  References to the compiler flag
   "JUPITER" were replaced with "PCI".  #include <xxx> lines were
   replaced with #include "xxx".

   Revision 1.5  1996/05/29 23:04:03  gary
   Code to handle Mode-1 nogotiations and code to handle received FRF.9
   frames more or less complete, but as yet untested.

   Revision 1.4  1996/04/26 19:58:07  gary
   First rev of changes: Frame Relay on PRI card.
   Bug fix: sequence number on segmented frames was wrong.

   Revision 1.3  1995/04/10 09:25:35  garyp
   changed several variable declarations from _EXTERN_ to extern,
   because they are defined in space.c, NOT frsutil.c

 * Revision 1.20  1994/07/27  20:31:09  stavrosm
 * Release 2.2
 *
 * Revision 1.19  1994/07/13  15:57:45  stavrosm
 * Changed comments for FRS_OPT_LINK_STATE and FRS_OPT_PLL_STATE.
 *
 * Revision 1.18  1994/07/08  14:44:26  stavrosm
 * Added link state, and PLL state related constants.
 *
 * Revision 1.17  1994/07/06  20:11:11  saula
 * Bug Report #SA-940706:
 * 1. Efficiency improvements using timers for Traffic Control
 *    (CIR & Excess Burst enforcement)
 * 2. Improvement in congestion control for fallback:
 *    Excess bits get zapped temporarily during BECN / congestion.
 *
 * Revision 1.16  1994/06/28  14:05:40  stavrosm
 * Added IPX and ARP encapsulation.
 *
 * Revision 1.15  1994/06/22  18:29:22  stavrosm
 * Added comments to indicate which structures need to be packed.
 *
 * Revision 1.14  1994/03/16  21:27:52  deepak
 * Change in struct LCB; FRS_CFG ==> FRS_LINK_CFG.
 *
 * Revision 1.13  1994/02/25  20:18:42  guest
 * Add support for Q.933 Annex A.  Bug Report SA-101.
 *
 * Revision 1.12  93/11/02  11:14:38  stavrosm
 * Release 2.1
 * 
..............................................................................

   DESCRIPTION:

   This module is an include file required by all frs modules. It contains the
   most general declarations, definitions, macro & structure declarations and
   function prototyping.

..............................................................................
  REF DOCUMENTS:

  (a) U.S Sprint Frame Relay Service Interface Specification Doc #: 5136.02
  (b) Frame Relay Interface Specification, Stratacom Inc., Doc #: 001-207460
  (c) Frame Relay Stack Functional Specification Rel 1.2 Harris & Jeffries Inc.
  (d) Frame Relay Stack External Specification Rel 1.2 Harris & Jeffries Inc.
  (e) MIB for Frame Relay DTEs - RFC Draft from Internet Engr Task Force (IETF).
  (f) Multiprotocol Interconnect over Frame Relay Networks - T. Bradley, C.Brown
	 Wellfleet Communications, Inc. A. Malis BBN Communications Oct 14, 1991.


..............................................................................

  SPECIAL COMPILE/LINK INSTRUCTIONS:
    see Notes in frsopt.h

..............................................................................
*/
#ifndef FRS_H
#define FRS_H

/* Get compile time options...
 */
#include "frsopt.h"
#include "frf9.h"

/**/
/*****************************************************************************
 *                            DECLARATIONS
 ****************************************************************************/

#if    USE_TARGET_SYSTEM_TYPEDEFS
#include <name_of_target_system_typedef_file>
#else

#if 0
/** Native typedef declarations....
 **/
typedef unsigned char   u_char;           /* 8-bit */
typedef unsigned short  u_short;          /* 16-bit */
typedef unsigned long   u_int;            /* 32-bit */
typedef unsigned long   u_long;           /* 64-bit or 32-bit */
#endif

#endif

#if USE_PROTOTYPES
/** The typedefs commented 'incomplete definition' appear here for the sake
 ** of the ANSI compiler. Since the actual definitions for the typedefs do
 ** not appear before the prototype declarations in frssys.h, the 'incomplete'
 ** definitions prevent the compiler from complaining about unknown types
 ** declared in the function prototypes.
 **/
typedef struct ccb;                       /* incomplete definition */
typedef struct lcb;                       /* incomplete definition */
typedef struct event;                     /* incomplete definition */
typedef struct frs_link_cfg;              /* incomplete definition */
typedef struct cfg_update;                /* incomplete definition */
typedef void (*TASK_FUNC_PTR)(u_int);
#else
typedef void (*TASK_FUNC_PTR)();
#endif

typedef u_short FRSstate;
typedef u_long frs_time;
/* Frame relay frame header structure...
 *  This header is tacked on outbound frames and stripped from inbound frames
 *  by the FRS. 
 *
 *  A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 *  needs to be packed on byte boundary. Use a compile line option for packing, 
 *  if one is supported by your compiler. Otherwise use packing specific pragmas 
 *  that are supported by your compiler.
 */
typedef struct fr_hdr
{
    u_char dlciMSB;                /* MSB */
    u_char dlciLSB;                /* LSB */
}
FR_HDR;

/** Size (in octets) of sections of the encapsulation header.
 **/
#define Q922_ADDR_LEN      2  /* DLCI is 2 octets */
#define ISO_NLPID_HDR_LEN  2  /* length of an ISO frame header (octets) */
#define SNAP_HDR_LEN       8  /* length of a SNAP header (octets) */
#define FRAG_HDR_LEN       4  /* length of the fragmentation info (octets) */
#define ISO_Q933_HDR_LEN   6  /* length of Q933 header (octets) */
#define FRF9_HDR_LEN 	   8  /* FRF9 Compression Header */
#define CISCO_ENCAP_HDR_LEN 2 /* Cisco Encapsulation Header Length */

/** The amount of space required in the payload area to accomodate
 ** the largest frame relay header....
 **/
#define MIN_PAYLOAD_OFFSET     (Q922_ADDR_LEN + SNAP_HDR_LEN + \
						  FRAG_HDR_LEN + SNAP_HDR_LEN+FRF9_HDR_LEN )
#define MAX_BUFFER_OFFSET (MIN_PAYLOAD_OFFSET + (4 - (MIN_PAYLOAD_OFFSET % 4)))

/** Network Level Protocol Ids...
 **/
#define NLPID_ZERO            0x00     /* pad character present in NLPID */
#define NLPID_SNAP            0x80     /* SNAP header is present in frame */
#define NLPID_IP              0xCC     /* Internet IP */
#define NLPID_ETHR_OLD        0xCE     /* old-style eithernet over frame relay*/
#define NLPID_ISO_CLNP        0x81     /* ISO/IEC 8473 */
#define NLPID_ISO_ESIS        0x82     /* ISO/IEC 9542 */
#define NLPID_ISO_ISIS        0x83
#define NLPID_Q933            0x08     /* CCITT Q.933 frame */

/**/
/* Bring in target specific declarations...
*/
#include "frssys.h"

#ifndef TRUE
#define TRUE                    1
#endif

#ifndef FALSE
#define FALSE                   0
#endif

#ifndef NULL
#define NULL                    (void *)0
#endif

/**/
/* Bring in configuration structures...
 */
#include "frscfg.h"

#define CR_MASK                 0x02      /* C/R bit mask */
#define FECN_MASK               0x08      /* FECN bit mask */
#define BECN_MASK               0x04      /* BECN bit mask */
#define DE_MASK                 0x02      /* DE bit mask */
#define EA_MASK                 0x01      /* EA bit mask */

/* Link Control Action Codes */

#define FRS_LINK_SDT            1         /* Start Data Traffic */
#define FRS_LINK_EDT            2         /* End Data Traffic */
#define FRS_LINK_LOCAL_LOOP     3         /* Local Loopback */
#define FRS_LINK_REM_LOOP       4         /* Remote Loopback */

#define FRS_DIRECTION_OUTBOUND  0
#define FRS_DIRECTION_INBOUND   1

#define FRS_LINK_INFORMATION     0        /* Request for link information */
#define FRS_MIN_VALID_DLCI      16        /* Lowest valid dlci */
#define FRS_MAX_VALID_DLCI     991        /* Highest valid dlci */

#if FRS_DCE_SUPPORT
#define FRS_MAX_REMOTE_NODES    63     /* Maximum number of Remote nodes */ 
#define FRS_CMI_TIMER_IDLE      0xFFFF /* .rnode[i].timeout value when idle */
#define FRS_CMI_TIMEOUT         0x3    /* Number of CMI_mT1 periods 'til    */
							    /* Remote node is considered "down" */
#endif
/*********************************************************************** 
 *    FRSFR_RcvData() and FRSFR_RcvDataWait() 
 *    return FRS_COMPLETE_FRAME+(protocol_id << FRS_RC_PROT_SHIFT)
 *    for Encapsulated frames.
 *
 *    To test for return codes from these functions, caller should
 *    use (rcode & FRS_RCODE_MASK).
 *
 *    For FRS_COMPLETE_FRAME, (rcode >> FRS_RC_PROT_MASK) may be used to
 *    dispatch according to protocol_id for PLLs with Multiprotocol support
 *    (Encapsulation) enabled.
 *
 ***********************************************************************/

#define FRS_RCODE_MASK          0x00ff
#define FRS_RC_PROT_SHIFT       8

#define FRS_ENCAP_CODE_BASE     100  /* Base for Encapsulation error codes */

/* Link Error Codes from MIB */

#define FRS_LNK_UNKERR           1        /* */
#define FRS_LNK_RCVSHORT         2        /* */
#define FRS_LNK_RCVLONG          3        /* */
#define FRS_LNK_INVDLCI          4        /* */
#define FRS_LNK_UNKDLCI          5        /* */
#define FRS_LNK_LMIPROTOERR      6        /* */
#define FRS_LNK_UNKNOWNIE        7        /* */
#define FRS_LNK_SEQNUMERR        8        /* */
#define FRS_LNK_UNKRPT           9        /* */

/* Trap codes for frame relay (enterprise specific). These trap values were
 * choosen with the following in mind. The lower byte (0x0F) value of the
 * trap corresponds to the value commonly used in the standard MIB for 
 * linkDown(2) and linkUp(3). The upper byte (0xF0) value indicates the source
 * of the trap within the frs code base. The target system code (sys_trap_event:
 * frstargt.c) may mask off the upper byte to obtain the value of the generic
 * trap as defined in the standard MIB.
 */
#define GENERIC_LINKDOWN         0x02 /* As defined in MIB I */
#define GENERIC_LINKUP           0x03 /* As defined in MIB I */
#define TRAP_FROM_RX             0x10 /* Source of trap event */
#define TRAP_FROM_TX             0x20 /* Source of trap event */
#define TRAP_ONLY_MASK           0x0F /* To get the lower byte */

#define TRAP_RX_LINKDOWN         (TRAP_FROM_RX | GENERIC_LINKDOWN)
#define TRAP_RX_LINKUP           (TRAP_FROM_RX | GENERIC_LINKUP  )
#define TRAP_TX_LINKUP           (TRAP_FROM_TX | GENERIC_LINKDOWN)
#define TRAP_TX_LINKDOWN         (TRAP_FROM_TX | GENERIC_LINKDOWN)

/* Decls for link cfg options - 'lcb_opt' and 'frs_link_flags' */

#define FRS_OPT_LINK_ENBL       0x0001    /* Link is enabled */
#define FRS_OPT_STATS_ENBL      0x0002    /* Stats collection enabled */
#define FRS_OPT_PJ_LMI_CFG      0x0004    /* Plain Jane LMI enabled */
#define FRS_OPT_S_LMI_CFG       0x0008    /* Stratacom LMI enabled */
#define FRS_OPT_ANNEXD_CFG      0x0010    /* T1.617 Annex D Mgmt Ctrl enabled */
#define FRS_OPT_MULTI_CFG       0x0020    /* Multicasting is enabled */
#define FRS_OPT_LMI_XONXOFF     0x0040    /* LMI based flow ctrl enabled */
#define FRS_OPT_LMI_BW_CTRL     0x0080    /* LMI based bandwidth ctrl enabled */
#define FRS_OPT_LINK_DCE        0x0100    /* LINK is DCE */
#define FRS_OPT_BECN_XONXOFF    0x0200    /* BECN based flow ctrl enabled */
#define FRS_OPT_INJ_MGR_FORCED  0x0400    /* Forced injection scheme       */
#define FRS_OPT_INJ_MGR_BUFRD   0x0800    /* Buffered injection scheme     */
#define FRS_OPT_INJ_MGR_STD     0x1000    /* RFC Standard injection scheme */
#define FRS_OPT_ENCAP_ENABLE    0x2000    /* IETF Encapsulation enabled  */
#define FRS_OPT_ANNEXA_CFG      0x4000    /* Q.933 Annex A Mgmt Ctrl enabled */
#define FRS_OPT_LINK_STATE      0x0001    /* Link state mask */

/* Decls for pll cfg options */
#define FRS_OPT_PLL_STATE       0x0001    /* PLL state mask */

/* Decls for pll status - ccb_status */

#define FRS_CCB_STATUS_UP       0x01      /* PLL is up */
#define FRS_CCB_STATUS_RCV_BLK  0x02      /* Rcvr Blocked */
#define FRS_CCB_STATUS_XMT_BLK  0x04      /* Xmitter Blocked */
#define FRS_CCB_LMI_CCB         0x08      /* This CCB is really an LMI ccb */
#define FRS_CCB_FALLBACK        0x10      /* This CCB is currently in fallback*/

#if FRS_DCE_SUPPORT
#define FRS_CCB_STATUS_UP_PND   0x20      /* Remote CCB is ready when we are */
#define FRS_CCB_CMI_CCB         0x40      /* This CCB is really a CMI ccb */
#endif

/* Frame Relay Link States */

#define NUM_FRS_LCB_STATES      2       /* Number of States */
#define NUM_FRS_LCB_EVENTS      4       /* Number of Events */
#define FRS_LKDWN               0       /* Link down */
#define FRS_LKUP                1       /* Link up */
#define FRS_FRAME               2       /* Frame rcvd/xmitted */
#define FRS_TXDN                3       /* Frame xmit done */

/**/
/*
 ***** STATISTICS *****
*/

/* General & Link Statistics Constants */

#define GENERAL_STATS           0      /* Statistics Category */
#define FRS_SENDFRAMES          0x0000 /* Number of frames sent */
#define FRS_RCVFRAMES           0x0001 /* Number of frames rcvd */
#define FRS_SENDCHAR            0x0002 /* Number of chars sent */
#define FRS_RCVCHAR             0x0003 /* Number of chars rcvd */
#define FRS_RCVFECNS            0x0004 /* Number of FECNs rcvd */
#define FRS_RCVBECNS            0x0005 /* Number of BECNs rcvd */
#define FRS_LINK_CREATE_TIME    0x0006 /* Time Stamp when Link came up */
#define FRS_LINK_ERR_TIME       0x0007 /* Time Stamp of last error */
#define FRS_LINK_ERR_TYPE       0x0008 /* Type of Error for SNMP */
#define FRS_MAX_GEN_STAT        0x0009 /* DELIMITER */

/* Error Statistics Constants */

#define ERROR_STATS             1      /* Statistics Category */
#define FRS_RCVFRAME_INV        0x0100 /* Total Invalid frames rcvd */
#define FRS_RCVINV_SHORT        0x0101 /* Runts */
#define FRS_RCVINV_LONG         0x0102 /* Giants */
#define FRS_RCVINV_DLCI         0x0103 /* Invalid DLCI */
#define FRS_RCVUNK_DLCI         0x0104 /* Unknown DLCI */
#define FRS_RCVUNK_ERROR        0x0105 /* Unknown Error */
#define FRS_MAX_ERR_STAT        0x0106 /* DELIMITER */

/* Fragmentation Statistics Constants */

#define FRAGMENT_STATS          2      /* Statistics Category */
#define FRS_FRAGD_FRAMES        0x0200 /* Total User Frames Fragmented   */
#define FRS_FRAGS_SENT          0x0201 /* Total Fragments Sent  */
#define FRS_FRAGS_RCVD          0x0202 /* Total Fragments Received */
#define FRS_FRAMES_ASSEMBLD     0x0203 /* Total User Frames Reassembled */
#define FRS_FAILED_ASSEMBLD     0x0204 /* Total Frame Reassembly Failures */
#define FRS_PROT_CREATE_TIME    0x0205 /* Time in ms when Prot. came up */
#define FRS_MAX_FRAG_STAT       0x0206 /* DELIMITER   */

/* CCB and Circuit Statistics Constants */

#define CIRCUIT_STATS           3      /* Statistics Category */
#define FRS_CCB_REV_COUNT       0x0300 /* CCB my_rev_count  */
#define FRS_CCB_CREATE_TIME     0x0301 /* CCB Create Time   */
#define FRS_CCB_STAT_CHNG       0x0302 /* CCB LastStatChgTime  */
#define FRS_INJ_NORM_CNT        0x0303 /* CCB inj_norm_cnt  */
#define FRS_INJ_EXCESS_CNT      0x0304 /* CCB inj_excess_cnt   */
#define FRS_INJ_HOLD_CNT        0x0305 /* CCB inj_hold_cnt     */
#define FRS_FALLBACKS           0x0306 /* Circuit Total Fallbacks */
#define FRS_FALLFORWARDS        0x0307 /* Circuit Total Fallforwards */
#define FRS_TOTL_RBITS          0x0308 /* Circuit Total Rcv w/ Rbit set */
#define FRS_CCB_WRITEQ          0x0309 /* Number of Tx frames queued */
#define FRS_CCB_READQ           0x030A /* Number of Rx frames queued */
#define FRS_MAX_CCB_STAT        0x030B /* DELIMITER */

/* LMI Statistics Constants */

#define LMI_STATS               4      /* Statistics Category */
#define FRS_LMI_NET_SEQ_NUM     0x0400 /* Keep Alive Sequence Number   */
#define FRS_LMI_LOCAL_SEQ_NUM   0x0401 /* Local KA Sequence Number */
#define FRS_LMI_STAT_ENQ_CNT    0x0402 /* Stat Enqs within last nT3 */
#define FRS_LMI_TOTL_STAT_ENQS  0x0403 /* Total Stat Repsonses Sent or Rcvd*/
#define FRS_LMI_FULL_STAT_ENQS  0x0404 /* Total Full Stat Enqs Sent/Rcvd   */
#define FRS_LMI_TOTAL_STATUS    0x0405 /* Total Stat Responses Sent/Rcvd  */
#define FRS_LMI_FULL_STATUS     0x0406 /* Total Full Stat Respons Sent/Rcvd  */
#define FRS_LMI_TOTL_UPDATES    0x0407 /* Total Updates Sent/Rcvd   */
#define FRS_LMI_INV_MSG_RCVD    0x0408 /* Unknown Messages Rcvd  */
#define FRS_LMI_NO_IE_REP_TYPE  0x0409 /* Report Type Info missing  */
#define FRS_LMI_NO_IE_KA        0x040A /* Keep Alive missing  */
#define FRS_LMI_LOST_SEQ_NUM    0x040B /* Keep Alive sequence lost  */
#define FRS_LMI_STAT_TIMEOUT    0x040C /* No response to stat enq   */
#define FRS_LMI_UNSUPP_IE_MSG   0x040D /* Unknown LMI Messsage rcvd */
#define FRS_LMI_UNEXP_PVC_NUM   0x040E /* Stat rcvd about un-cfged pvc */
#define FRS_LMI_UNEXP_PVC_STAT  0x040F /* Unexpected pvc stat IE */
#define FRS_LMI_STAT_RATE_PLUS  0x0410 /* Stat Enq Poll rate exceeded  */
#define FRS_LMI_ENQ_TIMEOUT     0x0411 /* Stat Enq Poll rate insufficient */
#define FRS_MAX_LMI_STAT        0x0412 /* DELIMITER   */

/* Protocol Error Constants */

#define PROTOCOL_ERR_STATS      5      /* Statistics Category */
#define FRS_RCV_UNKPROT         0x0500 /* Unknown Protocols Rcvd */
#define FRS_RCV_UNKFRAME        0x0501 /* Unknown Frames Rcvd */
#define FRS_RCV_LOSTFRAME       0x0502 /* Lost Frames */
#define FRS_TX_UNKPROT          0x0503 /* Unknown Protocols */
#define FRS_RCV_UNKORG          0x0504 /* Unknown Organization Rcvd */
#define FRS_MAX_PROT_ERRS       0x0505 /* DELIMITER */

#if FRS_DCE_SUPPORT

/* CMI Statistics */

#define CMI_STATS               6      /* Statistics Category */
#define FRS_CMI_TOTL_STAT_ENQS  0x0600 /* Total stat msgs tx to remote nodes */
#define FRS_CMI_TOTL_STAT_RCVD  0x0601 /* Total stat msgs rx from remote */
#define FRS_CMI_FRAME_ERRORS    0x0602 /* Frame received with errors */
#define FRS_CMI_INV_MSG_RCVD    0x0603 /* Unknown CMI Messages Rcvd  */
#define FRS_CMI_IE_MISSING      0x0604 /* Report type info element missing */
#define FRS_CMI_IE_UNKNOWN      0x0605 /* Report type info element unknown */
#define FRS_CMI_UNEXP_PVC_STAT  0x0606 /* Status about unknown pvc */
#define FRS_CMI_UNEXP_LINK_STAT 0x0607 /* Status about unknown link */
#define FRS_MAX_CMI_STATS       0x0608 /* DELIMITER */
#endif

/* Injection Management Constants */
#define INJ_MGMNT_STATS         7
#define FRS_INJ_NORM_FRAMES     0x0700 /* INJECT_STATS InjNormalFrames   */
#define FRS_INJ_NORM_CHARS      0x0701 /* INJECT_STATS InjNormalChars    */
#define FRS_INJ_EXCESS_FRAMES   0x0702 /* INJECT_STATS InjExcessFrames   */
#define FRS_INJ_EXCESS_CHARS    0x0703 /* INJECT_STATS InjExcessChars    */
#define FRS_INJ_HOLD_FRAMES     0x0704 /* INJECT_STATS InjHoldFrames     */
#define FRS_INJ_HOLD_CHARS      0x0705 /* INJECT_STATS InjHoldChars      */  
#define FRS_INJ_FRAMES_DROPPED  0x0706 /* INJECT_STATS FramesDropped     */ 
#define FRS_INJ_CHARS_DROPPED   0x0707 /* INJECT_STATS CharsDropped      */ 
#define FRS_MAX_INJ_STAT        0x0708 /* DELIMITER                      */
/**/
/*
 ***** LMI DECLARATIONS *****
 */

#define FRS_LMI_INV_FRM_TYPE        0x01 /* Invalid LMI Frame Type */
#define FRS_LMI_INV_FRM_PROT_DISC   0x02 /* Invalid Protocol Discriminator */
#define FRS_LMI_INV_FRM_CALL_REF    0x03 /* Invalid Call Reference */
#define FRS_LMI_INV_FRM_HDR         0x04 /* Invalid Frame Header */
#define FRS_LMI_PROTOERR            0x05 /* General Protocol Error */

#define FRS_UNNUM_INFO_FRAME_TYPE   0x03 /* Unnumbered Frame Type */
#define FRS_LMI_PROT_DISCRIMINATOR  0x09 /* LMI Protocol Discriminator */
#define FRS_LMI_ANNEXD_PROT_DISC    0x08 /* AnnexD Protocol Discriminator */
#define FRS_LMI_STATUS_MSG_TYPE     0x7D /* LMI Status Message */
#define FRS_LMI_STATENQ_MSG_TYPE    0x75 /* LMI Status Enquiry */
#define FRS_LMI_UPDATE_MSG_TYPE     0x7B /* LMI Update Message */

#define FRS_LMI_LOCK_SHIFT          0x95 /* Lock Shift to Codeset 5 */
#define FRS_LMI_COMMON_HDR_LEN      0x02 /* LMI Common Header Length */

#define FRS_LMI_IE_REP_TYPE         0x01 /* REPORT_TYPE Info Element */
#define FRS_LMI_IE_KEEP_ALIVE       0x03 /* KEEP_ALIVE Info Element */
#define FRS_LMI_IE_MULTI_STAT       0x05 /* MULTICAST STATUS Info Element */
#define FRS_LMI_IE_PVC_STAT         0x07 /* PVC STATUS Info Element */

#define FRS_LMI_ANNEXA_PROT_DISC    0x08 /* Q.933 Protocol Discriminator */
#define FRS_LMI_ANNEXA_IE_REP_TYPE  0x51 /* REPORT_TYPE IE for Q.933 */
#define FRS_LMI_ANNEXA_IE_KEEP_ALIVE 0x53 /* KEEP_ALIVE IE for Q.933 */
#define FRS_LMI_ANNEXA_IE_PVC_STAT  0x57 /* PVC STATUS ID for Q.933 */


#if FRS_DCE_SUPPORT
#define FRS_CMI_IE_REMOTE_PVC_STAT  0x09 /* Remote PVC STATUS Info Element */
#endif

#define FRS_LMI_IE_REP_TYPE_LEN     0x01 /* REPORT_TYPE Info Element length */
#define FRS_LMI_IE_KEEP_ALIVE_LEN   0x02 /* KEEP_ALIVE Info Element length */
#define FRS_LMI_IE_PVCS_LEN         0x03 /* PVC Status Info Element length */

#if FRS_DCE_SUPPORT
#define FRS_CMI_IE_REMOTE_PVCS_LEN  0x05 /* Remote PVC Status IE length */
#endif

#define FRS_LMI_FULL_STAT_RPT       0x00 /* FULL STATUS Msg Info Element */
#define FRS_LMI_SEQ_NUM_XCHG        0x01 /* Sequence # xchange Info Elemen */
#define FRS_LMI_ASYNC_PVC_STAT      0x02 /* Async PVC Status - AnnexD only */

#define FRS_LMI_DBIT_MASK           0x02 /* D-bit Status Mask */
#define FRS_LMI_NBIT_MASK           0x08 /* N-bit Status Mask */
#define FRS_LMI_STATUS_EXIST        0x00 /* PVC Exists */
#define FRS_LMI_STATUS_DEL          0x00 /* PVC Deleted */
#define FRS_LMI_STATUS_ADDED        0x08 /* PVC Added */
#define FRS_LMI_STATUS_ACT          0x02 /* PVC Active */
#define FRS_LMI_STATUS_BUFR         0x01 /* PVC Congested */

/* Masks for unused bits in AnnexD PVC Status IE...
*/
#define FRS_ANNEXD_PVCS_EX_MASK     0x80 /* EXT bits */
#define FRS_ANNEXD_PVCS_OC1_SPARE   0x40 /* SPARE bit in Octet 1 */
#define FRS_ANNEXD_PVCS_OC2_SPARE   0x07 /* SPARE bits in Octet 2 */

/* Masks for unused bits in AnnexA PVC Status IE...
*/
#define FRS_ANNEXA_PVCS_EX_MASK     0x80 /* EXT bits */
#define FRS_ANNEXA_PVCS_OC1_SPARE   0x40 /* SPARE bit in Octet 1 */
#define FRS_ANNEXA_PVCS_OC2_SPARE   0x07 /* SPARE bits in Octet 2 */

#if FRS_DCE_SUPPORT
#define FRS_CMI_PVCS_OC2_SPARE      0x04 /* SPARE bits in Octet 2 for CMI */
#define FRS_CMI_PVCS_OC2_BECN       0x02 /* Remote BECN in Octet 2 for CMI */
#define FRS_CMI_PVCS_OC2_FECN       0x01 /* Remote FECN in Octet 2 for CMI */
#endif

#define FRS_ANNEXD_PVCS_OC3_SPARE   0x75 /* SPARE bits in Octet 3 */
#define FRS_ANNEXA_PVCS_OC3_SPARE   0x75 /* SPARE bits in Octet 3 */

#define FRS_EVT_NOSYNC_KEEP_ALIVE   0x00 /* Thresholding? = Yes */
#define FRS_EVT_STAT_MSG_TIMEOUT    0x01 /* Thresholding? = Yes */
#define FRS_EVT_NO_KEEP_ALIVE       0x02 /* Thresholding? = No */
#define FRS_EVT_NO_REPORT_TYPE      0x03 /* Thresholding? = No */
#define FRS_EVT_INV_KEEP_ALIVE      0x04 /* Thresholding? = No */
#define FRS_EVT_INV_REPORT_TYPE     0x05 /* Thresholding? = No */
#define FRS_EVT_INV_IE_MSGTYPE      0x06 /* Thresholding? = No */
#define FRS_EVT_MAX                 0x07

#define FRS_EVT_ALARM               0x00 /* ALARMing event */
#define FRS_EVT_CLEAR               0x01 /* CLEARing event */

#define FRS_LMI_THRESH_ST_NORMAL    0x00 /* No ongoing thresholding */
#define FRS_LMI_THRESH_ST_WATCH     0x01 /* May cross threshold or recover */
#define FRS_LMI_THRESH_ST_PASSED    0x02 /* Threshold passed */

#define FRS_LMI_STAT_ENQ_FRAME_LEN  13  /* Frame size to hold STAT_ENQ */
#define FRS_LMI_STATUS_FRAME_LEN    13  /* Frame size to hold STATUS preamble */

#define	FRS_TIMER_FREE		    0   /* Timer Element is Free */
#define FRS_TIMER_ALLOCATED	    1   /* Timer Element is Allocated */
#define	FRS_TIMER_ACTIVE	    2   /* Timer Element is Active */

#if FRS_DCE_SUPPORT
#define FRS_CMI_STATUS_FRAME_LEN    8   /* Frame size to hold CMI preamble */
#endif

#define FRS_SHORT_FRAME             3    /* FCS is already stripped */
#define FRS_LONG_FRAME              8191 /* Q.921 FCS unreliable if > 4096 */

/* LMI FLAG BIT DEFINITIONS...
*/
#define LMI_STATUS_PENDING      0x01 /* Outstanding Stat Rsp */
#define LMI_FORCE_FULL_STATUS   0x02 /* Force Full Status Enqs */
#define LMI_FAST_TIMER          0x04 /* Send LMI polls at faster rate */
#define LMI_EXPECT_F_STATUS     0x08 /* *Have* to receive full status */


/**/
/*****************************************************************************
*                             MACROS
*****************************************************************************/

#define m_TST(v,f) (v & f)
#define m_Set(v,f) (v |= f)
#define m_Rst(v,f) (v &= ~f)
#define m_Tog(v,f) (v = (~(v & f) & ~f))

#ifndef	CHAR_BITS
#define	CHAR_BITS	8
#endif

#define MSB(x)     (u_char)((((u_short)(x) << CHAR_BITS) & 0xFF00))
#define LSB(x)     (u_char)(((u_short)(x) & 0x00FF))


#ifndef min
#define min(x,y)  (((x) < (y)) ? (x) : (y))
#endif

/** Macros for option bit testing
 **/
#define LMI_OPTS (FRS_OPT_PJ_LMI_CFG | FRS_OPT_S_LMI_CFG | FRS_OPT_ANNEXD_CFG | FRS_OPT_ANNEXA_CFG)
#define m_FRS_IS_LINK_ENBL(p)        ((p)->lcb_opt & FRS_OPT_LINK_ENBL)
#define m_FRS_IS_STATS_ENBL(p)       ((p)->lcb_opt & FRS_OPT_STATS_ENBL)
#define m_FRS_IS_PJ_LMI_CFG(p)       ((p)->lcb_opt & FRS_OPT_PJ_LMI_CFG)
#define m_FRS_IS_S_LMI_CFG(p)        ((p)->lcb_opt & FRS_OPT_S_LMI_CFG)
#define m_FRS_IS_ANNEXD_CFG(p)       ((p)->lcb_opt & FRS_OPT_ANNEXD_CFG)
#define m_FRS_IS_ANNEXA_CFG(p)       ((p)->lcb_opt & FRS_OPT_ANNEXA_CFG)
#define m_FRS_IS_MULTI_CFG(p)        ((p)->lcb_opt & FRS_OPT_MULTI_CFG)
#define m_FRS_IS_LMI_XONXOFF(p)      ((p)->lcb_opt & FRS_OPT_LMI_XONXOFF)
#define m_FRS_IS_LMI_BW_CTRL(p)      ((p)->lcb_opt & FRS_OPT_LMI_BW_CTRL)
#define m_FRS_IS_LINK_DCE(p)         ((p)->lcb_opt & FRS_OPT_LINK_DCE)
#define m_FRS_IS_BECN_XONXOFF(p)     ((p)->lcb_opt & FRS_OPT_BECN_XONXOFF)
#define m_FRS_IS_LINK_ENCAP(p)       ((p)->lcb_opt & FRS_OPT_ENCAP_ENABLE)
#define m_FRS_IS_INJ_MGR_FORCED(p)   ((p)->lcb_opt & FRS_OPT_INJ_MGR_FORCED)
#define m_FRS_IS_INJ_MGR_BUFFERED(p) ((p)->lcb_opt & FRS_OPT_INJ_MGR_BUFRD)
#define m_FRS_IS_INJ_MGR_STANDARD(p) ((p)->lcb_opt & FRS_OPT_INJ_MGR_STD)
#define m_FRS_IS_ANY_LMI_CFG(p)      ((p)->lcb_opt & LMI_OPTS)
#define m_IS_FRS_PLL_OPEN(p)         (p->dlci)

#define m_IS_PLL_VALID( h, p ) ((h) < gGlobalCfg.frsTotalPLLs) && \
						 (((p) = frsCCBtable[(h)]) != CCBNULL)
#define m_FRS_CHECK                (gFrsEnabled == TRUE)

#define m_FRS_MARK_CCB_RCV_BLOCKED(p) \
    ((p)->ccb_status |= FRS_CCB_STATUS_RCV_BLK)

#define m_FRS_MARK_CCB_RCV_UNBLOCKED(p) \
    ((p)->ccb_status &= ~FRS_CCB_STATUS_RCV_BLK)

#define m_FRS_IS_CCB_RCV_BLOCKED(p) \
    ((p)->ccb_status & FRS_CCB_STATUS_RCV_BLK)

#define m_FRS_MARK_CCB_XMT_BLOCKED(p) \
    ((p)->ccb_status |= FRS_CCB_STATUS_XMT_BLK)

#define m_FRS_MARK_CCB_XMT_UNBLOCKED(p) \
    ((p)->ccb_status &= ~FRS_CCB_STATUS_XMT_BLK)

#define m_FRS_IS_CCB_XMT_BLOCKED(p) \
    ((p)->ccb_status & FRS_CCB_STATUS_XMT_BLK)

#define m_FRS_RESET_CCB_LMI_CCB(p) \
    ((p)->ccb_status &= ~FRS_CCB_LMI_CCB)

#define m_FRS_SET_CCB_LMI_CCB(p) \
    ((p)->ccb_status |= FRS_CCB_LMI_CCB)

#define m_FRS_IS_LMI_CCB(p) \
    ((p)->ccb_status & FRS_CCB_LMI_CCB)

#if FRS_DCE_SUPPORT
#define m_FRS_RESET_CCB_FALLBACK(pCCB) \
	((pCCB)->ccb_status &= ~FRS_CCB_FALLBACK)

#define m_FRS_SET_CCB_FALLBACK(pCCB) \
	((pCCB)->ccb_status |= FRS_CCB_FALLBACK)

#define m_FRS_IS_CCB_FALLBACK(pCCB) \
	((pCCB)->ccb_status & FRS_CCB_FALLBACK)
#endif

#define m_FRS_RESET_CCB_UP(p) \
    ((p)->ccb_status &= ~FRS_CCB_STATUS_UP)

#define m_FRS_SET_CCB_UP(p) \
    ((p)->ccb_status |= FRS_CCB_STATUS_UP)

#define m_FRS_IS_CCB_UP(p) \
    ((p)->ccb_status & FRS_CCB_STATUS_UP)

#if FRS_DCE_SUPPORT
#define m_FRS_RESET_CCB_UP_PND(p) \
	((p)->ccb_status &= ~FRS_CCB_STATUS_UP_PND)

#define m_FRS_SET_CCB_UP_PND(p) \
	((p)->ccb_status |= FRS_CCB_STATUS_UP_PND)

#define m_FRS_IS_CCB_UP_PND(p) \
	((p)->ccb_status & FRS_CCB_STATUS_UP_PND)
#endif

#define m_LMI_RESET_STAT_PEND(p) \
    ((p)->lmi_flag &= ~LMI_STATUS_PENDING)

#define m_LMI_SET_STAT_PEND(p) \
    ((p)->lmi_flag |= LMI_STATUS_PENDING)

#define m_LMI_IS_STAT_PEND(p) \
    ((p)->lmi_flag & LMI_STATUS_PENDING)

#define m_LMI_RESET_F_FULL_STAT(p) \
    ((p)->lmi_flag &= ~LMI_FORCE_FULL_STATUS)

#define m_LMI_SET_F_FULL_STAT(p) \
    ((p)->lmi_flag |= LMI_FORCE_FULL_STATUS)

#define m_LMI_IS_F_FULL_STAT(p) \
    ((p)->lmi_flag & LMI_FORCE_FULL_STATUS)

#define m_LMI_RESET_FAST_TMR(p) \
    ((p)->lmi_flag &= ~LMI_FAST_TIMER)

#define m_LMI_SET_FAST_TMR(p) \
    ((p)->lmi_flag |= LMI_FAST_TIMER)

#define m_LMI_IS_FAST_TMR(p) \
    ((p)->lmi_flag & LMI_FAST_TIMER)

#if FRS_DCE_SUPPORT
#define m_FRS_IS_CCB_LOCAL_EP(pCCB) \
	(!((pCCB)->fwd_node || (pCCB)->fwd_link))

#define m_FRS_IS_CCB_PLL_TERMINUS(pCCB) \
	((pCCB)->fwd_node && (pCCB)->fwd_link)

#define m_FRS_IS_CCB_LOCAL_SWITCH(pCCB) \
	(!((pCCB)->fwd_node) && (pCCB)->fwd_link)
#endif

#define mSetDLCI(z) \
   z->my_header.dlciMSB = (u_char)(z->my_header.dlciMSB & CR_MASK)\
	  | (u_char)((z->dlci >> 2)&0xFC); \
   z->my_header.dlciLSB = (u_char)(z->my_header.dlciLSB\
	  & (FECN_MASK | BECN_MASK | DE_MASK | EA_MASK))\
	  | (u_char)((z->dlci << 4)&0xF0);\
   mSetEA(z);

#define mGetFrameDLCI(b) \
   ((((u_short)((BYTE *)b)[0]) << 2) & 0x3F0) \
	  + ((((u_short)((BYTE *)b)[1]) >> 4) & 0x0F)

#define mMarkFrameforDrop(z) z->start &= 0x0000; z->start |= 0xFFFE;
#define mSetEA(z)     z->my_header.dlciLSB |= EA_MASK;
#define mSetCR(z)     z->my_header.dlciMSB |= CR_MASK;
#define mSetFECN(z)   z->my_header.dlciLSB |= FECN_MASK;
#define mSetBECN(z)   z->my_header.dlciLSB |= BECN_MASK;
#define mSetDE(z)     z->my_header.dlciLSB |= DE_MASK;
#define mResetEA(z)   z->my_header.dlciLSB &= ~EA_MASK;
#define mResetCR(z)   z->my_header.dlciMSB &= ~CR_MASK;
#define mResetFECN(z) z->my_header.dlciLSB &= ~FECN_MASK;
#define mResetBECN(z) z->my_header.dlciLSB &= ~BECN_MASK;
#define mResetDE(z)   z->my_header.dlciLSB &= ~DE_MASK;

/**/
/*****************************************************************************
*                             STRUCTURES
*****************************************************************************/

#ifndef DEFINESONLY

/* General Statistics maintained at the Global, Per Link, Per PLL 
	   and Per Protocol levels...
*/
typedef struct gen_stats
{
    u_long SendFrames;               /* Total Frames Transmitted */
    u_long RcvFrames;                /* Total Frames Rcvd */
    u_long SendChars;                /* Total Chars Transmitted */
    u_long RcvChars;                 /* Total Chars Rcvd */
    u_long RcvFECNs;                 /* Total Frames /w FECN */
    u_long RcvBECNs;                 /* Total Frames /w BECN */
}
GEN_STATS;

/* Fragmentation Statistics maintained at the Per Protocol level...
*/
typedef struct frag_stats
{
    u_long SendFragmented;     /* Total User Frames Fragmented */    
    u_long SendFragments;      /* Total Frames Transmitted */
    u_long RcvFragments;       /* Total Frames Rcvd */
    u_long RcvReassembled;     /* Total User Frames Reassembled */
    u_long RcvReassembleFail;  /* Total Frame Reassembly Failures */
}
FRAG_STATS;

/**/
/* Error statistics maintained at the Global and Per Link Level...
 */
typedef struct err_stats
{
    u_long RcvInvFrames;       /* Total Invalid Frames Rcvd */
    u_long RcvShort;           /* Frames containing < 5 octets */
    u_long RcvLong;            /* Frames containing > 8193 octets */
    u_long InvDlci;            /* Frames with invalid DLCI */
    u_long UnkDlci;            /* Frames with unknown DLCI */
    u_long UnkError;
}
ERR_STATS;

/* Global statistics...
*/
typedef struct global_stats
{
    GEN_STATS global_gen_stats;       /* General statistics */
    ERR_STATS global_err_stats;       /* Error statistics */
}
GLOBAL_STATS;

/**/
/* Additional Circuit statistics
*/
typedef struct circ_stats
{
    u_long total_fallbacks;
    u_long total_fallforwards;
    u_long total_stat_Rbit;
}
CIRC_STATS;

/* Injection management statistics maintained at per PLL level.
 */
typedef struct inject_stats
{
    u_long InjNormalFrames;    /* total frames injected normally */
    u_long InjNormalChars;     /* Total octets injected normally */
    u_long InjExcessFrames;    /* Total frames injected in excess of Bc */
    u_long InjExcessChars;     /* Total octets injected in excess of Bc */
    u_long InjHoldFrames;      /* Total frames injected from hold queue */
    u_long InjHoldChars;       /* Total octets injected from hole queue */
    u_long InjFramesDropped;   /* Total frames dropped in Tx processes */
    u_long InjCharsDropped;    /* Total octets dropped in Tx processes */  
}   INJECT_STATS;   

typedef struct prot_errs
{
    u_long RcvUnkProt;
    u_long RcvUnkFrame;
    u_long RcvLostFrame;
    u_long TxUnkProt;
    u_long RcvUnkOrg;
}
PROT_ERRS;

/* Congestion Mgmt Structure...
    This structure is part of a CCB and maintains the congestion status
    of that PLL. Some of the fields of this structure are derived from
    the configuration record and others are maintained in real-time
    reflecting the traffic load and associated congestion.
    
*/
typedef struct tagCOSB
{
    u_int  bc_fwd;                /* Burst Size Bc (configured maximum, bytes) */
    u_int  bc_min;                /* Min value for Bc (bytes) */
    u_int  bc_cur;                /* Current Bc (bytes) */
    u_int  be_fwd;                /* Excess burst Be (configured max, bytes) */
    u_int  be_bc_cur;             /* Current Be plus Current Bc (bytes) */
    u_short  Tc;                  /* Committed Rate Measurement Interval */
    u_short  CMP;                 /* Congestion Monitor Period (CMP) Timer */
    u_int   bytes_written_in_tc; /* Bytes Xmitted in current Tc */
    frs_time TcBegin;             /* Time current Tc began */
    frs_time TcEnd;               /* Time current Tc will end */
    enum cosb_state
    {
	   COSB_NORMAL,              /* normal (max rate - fallback if BECN) */
	   COSB_1ST_BECN,            /* Rcvd 1 BECN only since NORMAL state.
							  Fall forward if CMP tick */
	   COSB_WAIT,                /* no fallback or fwd until CMP tick */
	   COSB_NO_BECN,             /* In fallback - 
							  fallback if BECN; forward if CMP tick */
    }
    State;
}
cosb;

/**/
/** Frame headers for encapsulation - Conforms to RFC1294, RFC1356, RFC1490 */

/** This header is used for protocols that have been assigned NLPID values. 
 ** Currently these are ISO_CLNP, ISO_ESIS, ISO_ISIS and Internet IP.
 **
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
 **/
typedef struct tag_iso_nlpid_frame
    {
    u_char        ctrl;        /* Frame escape character (0x03) */
    u_char        nlpid;       /* Network Layer Protocol Identifier */
    } ISO_NLPID_FRAME_HDR, *NPISO_NLPID_FRAME_HDR;

/** This header is used for protocols that do not have a NLPID assigned or do
 ** not have a SNAP encapsulation. The NLPID value is 0x08 indicating CCITT 
 ** Recommendation Q.933. This structure is used for Q.933 NLPID specifying
 ** layer 2 and layer 3 protocols.
 **
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
 **/
typedef struct tag_iso_q933
    {
    u_char        ctrl;        /* Frame escape character (0x03) */
    u_char        nlpid;       /* Network Layer Protocol Identifier (0x08) */
    u_char        l2_pid[2];   /* Layer 2 protocol id */
    u_char        l3_pid[2];   /* Layer 3 protocol id */
    } ISO_Q933_FRAME_HDR, *NPISO_Q933_FRAME_HDR;

/** This portion of the frame header applies to encapsulated frames that
 ** have been fragmented to fit within a frame relay frame. The snap_pid
 ** field in the SNAP header will indicate if the frame has been fragmented. 
 ** If it has been then this section is used to determine the sequence number of
 ** the frame and whether or not this is the last frame.
 **
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
 **/
typedef struct tag_frag_info
    {
    u_char seq[2];       /* frame sequence number */
    u_char info[2];      /* fragmentation flag */
    } FRAGMENT_HDR, *NPFRAGMENT_HDR;

/** This is the structure definition for a SNAP header. The 'fragment' member
 ** is used only when the PID value contained in the snap header indicates that
 ** the frame is a fragment; otherwise the member is not used.
 **
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
 **/
typedef struct tag_snap_header
    {
    u_char ctrl;           /* Frame escape character (0x03) */
    u_char pad;            /* one byte pad character */
    u_char nlpid;          /* Network Level Protocol id (0x80) */
    u_char oui[3];         /* Organizationally Unique Identifier */
    u_char pid[2];         /* Protocol Identifier */

    FRAGMENT_HDR fragment; /* used only if the snap header is used for
						fragmentation. */
    } SNAP_HDR, *NPSNAP_HDR;

/** Q.922 address structure
 **
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
 **/
typedef struct tag_q922_address
    {
    FR_HDR address;          /* aka DLCI */
    } Q922_ADDR, *NPQ922_ADDR;

/** Parse header - used by the encap functions to parse an incoming frame.
 ** All frame types contain a control field (1st byte). If nlpid_1 contains
 ** a value indicating that the frame is an ISO_NLPID_FRAME or a Q.933 frame
 ** then the remaining members of the structure are not used. If the nlpid_1 
 ** member does not contain a meaningful value the nlpid_2 member is checked
 ** to see if it contains the value: NLPID_SNAP. If this is the case, the 'oui'
 ** and 'pid' members are meaningful. If nlpid_2 is NLPID_SNAP and the 'pid'
 ** member contains the value FRAGMENT_PID, the 'fragment' member of the 
 ** structure will contain fragmentation information regarding reassembly of the
 ** frame.
 **
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
 **/
typedef struct tag_parse_header
    {
    u_char ctrl;    /* Frame escape character (0x03) */
    u_char nlpid_1; /* nlpid: if frame type is iso nlpid frame or Q.933 */

    u_char nlpid_2; /* checked only if nlpid_1 is zero */
    u_char oui[3];  /* used only if nlpid_2 is NLPID_SNAP */
    u_char pid[2];  /* used only if nlpid_2 is NLPID_SNAP */

    FRAGMENT_HDR fragment; /* used only if pid member is FRAGMENT_PID */
    } PARSE_HDR, *NPPARSE_HDR;


typedef struct tag_cisco_header
	{
		u_char ctrl ;
		u_char nlpid ;
	} CISCO_ENCAP_HDR, *NPCISCO_ENCAP_HDR ;
		
/**/
#if USE_PROTOTYPES

typedef void    (*BLK_FN_PTR)(u_int);
typedef u_short (*FFN_PTR) (struct ccb *, USRBUF **, struct tag_parse_header *);
typedef void    (*BFN_PTR) (struct ccb *, USRBUF *, u_short);
typedef void    (*LFN_PTR) (struct ccb *);
typedef u_short (*FN_PTR) (struct ccb *, USRBUF **);
#ifndef	STREAM_MESSAGES
typedef u_short (*MFN_PTR) (struct ccb *, USRBUF *, u_short);
#else
typedef u_short (*MFN_PTR) (struct ccb *, USRBUF *, u_short, USRBUF **);
#endif

typedef u_short (*SFN_PTR) (u_short, USRBUF *);

#else
typedef void    (*BLK_FN_PTR)();
typedef u_short (*FFN_PTR) ();
typedef void    (*BFN_PTR) ();
typedef void    (*LFN_PTR) ();
typedef u_short (*FN_PTR) ();
typedef u_short (*MFN_PTR) ();
typedef u_short (*SFN_PTR) ();
#endif

/** Protocol Entry data structure....
 **/
typedef struct tag_protocol_entry
{
    BFN_PTR fcallback; /* User's TXDone callback function for this protocol */

    /** Statistics...
	**/
    GEN_STATS gen_stats;      /* General Statistics for this protocol */
    FRAG_STATS frag_stats;    /* Fragmentation Statistics for this protocol */
    frs_time prot_CreateTime; /* Time in milliseconds when protocol started */
    queue_t *rcvd_q ;	      /* Streams Read Side Queue */
}
FRS_PROTOCOL_ENTRY;

/** Multiprotocol table structure....
 **/
typedef struct tag_multiprotocol
{
    FFN_PTR fragproc;         /* Function used to process n+1 fragments (rx) */
    u_short next_tx_seq_num;  /* Next sequence number to send (tx) */
    u_short next_rx_seq_num;  /* Next sequence number to expect (rx) */
    u_short index;            /* Currently active protocol table entry  */
    u_short inuse;            /* The number of protocols used on this ccb */
    USRBUF *psframe;          /* Points to the start of a user frame   (rx) */
    USRBUF *peframe;          /* Points to the end of the user frame   (rx) */
    USRBUF *ptxsframe;        /* Points to the start of a user frame   (tx) */
    USRBUF *ptxeframe;        /* Points to the end of the user frame   (tx) */
    u_short code;             /* Last tx driver return code (tx) */
    PROT_ERRS  prot_errs;     /* Protocol errors */
    FRS_PROTOCOL_ENTRY *mp[MAX_PROTOCOL]; /* registered protocol table */
}
MULTIPROTOCOL, *NPMULTIPROTOCOL;

/**/
/* Channel Control Block...
 *  One per OPEN PLL, this structure maintains the state, statistics, Qs,
 *  callback function pointers for a channel (PLL).
*/
typedef struct ccb
{
    struct ccb *next_ccb;       /* Downstream ptr within chain */
    struct lcb *plcb;           /* LCB for this link */
    u_long     hCCB;            /* handle for this CCB */
    u_long     dlci;            /* The DLCI assigned to this PLL */
    u_short    ccb_status;      /* See FRS_CCB_STAT* flags */
    FR_HDR     my_header;       /* Pre-prepared Frame Header */

#if USE_BLOCKED_IO
    BLK_FN_PTR fReadBlock;      /* Blocking function for READ ops */
    BLK_FN_PTR fReadUnblock;    /* Unblocking function for READ ops */
    BLK_FN_PTR fWriteBlock;     /* Blocking function for WRITE ops */
    BLK_FN_PTR fWriteUnblock;   /* Unblocking function for WRITE ops */
    u_int      uarg;            /* Blocking function argument */
#endif

    QTCB       Write_Queue;     /* Outbound frame Q for this PLL */
    QTCB       Read_Queue;      /* Inbound frame Q for this PLL */

    cosb       my_cosb;         /* Congestion Mgmt info */
    u_int      my_rev_count;    /* Revision (tick) count */
    frs_time   CreateTime;      /* CCB creation time */
    frs_time   LastStatChgTime; /* Last time the status changed */
    LFN_PTR    InjectionFunc;   /* Ptr to applicable injection procedure */
    BFN_PTR    TxDoneFunc;      /* User supplied transmit done post-process */
    GEN_STATS  my_stats;        /* PLL stats */
    NPMULTIPROTOCOL encap;      /* Encapsulation support */
    u_short    CMPTimerId;      /* Congestion Mgmt Timer Id */
    u_short    InjectionTimerId;/* Injection Ctrl Timer Id */
    proc_id    owner_id;        /* The id# of process owning this channel */
    CIRC_STATS circuit_stats;    /* Additional CCB statistics */
    INJECT_STATS my_inj_stats;   /* Injection Management Stats */

#if FRS_DCE_SUPPORT
    u_char     fwd_node;         /* remote node of switched PLL */
    u_char     fwd_link;         /* remote link of switched PLL */
    u_char     fwd_dlci;         /* remote dlci of switched PLL */
    struct ccb *pFwd;            /* CCB to forward incoming frames to (DCE) */
#endif
    queue_t	*rcvd_q ;	/* Streams Read Side Data Queue */
    FRF9_t     FRF9;            /* FRF.9 Data Compression State Variables */
}
CCB;

/*
 * NULL pointer of type CCB
 */
#define CCBNULL         ((CCB *) NULL)

/* Event message structure...
 */
typedef struct event
{
    struct event *next;         /* Next event in the queue if any */
    u_short  EventCode;         /* Event code */
    void *Info;                 /* Pointer to a relevant memory buffer */
}
EVENT;

/**/
/****************************************************************************
*
*         INFORMATION ELEMENTS USED BY THE LMI PROTOCOL
*
****************************************************************************/

/* KEEP_ALIVE_SEQUENCE...
 *
 * A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 * needs to be packed on byte boundary. Use a compile line option for packing, 
 * if one is supported by your compiler. Otherwise use packing specific pragmas 
 * that are supported by your compiler.
*/
typedef struct ie_keep_alive
{
    u_char current_seq;
    u_char last_rcvd_seq;
}
IE_KEEP_ALIVE;

/* PVC_STATUS...
 *
 * A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 * needs to be packed on byte boundary. Use a compile line option for packing, 
 * if one is supported by your compiler. Otherwise use packing specific pragmas 
 * that are supported by your compiler.
*/
typedef struct ie_pvc_status
{
    u_char dlciMSB;
    u_char dlciLSB;
    u_char pvc_status;                /* Use FRS_LMI_STATUS* masks */
    u_char pvc_bw[3];
}
IE_PVC_STATUS;

#if FRS_DCE_SUPPORT
/**
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
**/
typedef struct ie_remote_pvc_status
{
    u_char  local_link;               /* link number on sending node */
    u_char  remote_link;              /* link number on receiving node */
    u_char  dlciMSB;                  /* encoded remote DLCI MSB */
    u_char  dlciLSB;                  /* encoded remote DLCI LSB */
    u_char  pvc_status;               /* Use FRS_CMI_STATUS* masks */
}
IE_REMOTE_PVC_STATUS;

#endif

/**
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
**/
typedef struct ie_annexd_pvc_status
{
    u_char          dlciMSB;
    u_char          dlciLSB;
    u_char          pvc_status;        /* Use FRS_LMI_STATUS* masks */
}
IE_ANNEXD_PVC_STATUS, IE_ANNEXA_PVC_STATUS;

/* REPORT_TYPE...
 * A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 * needs to be packed on byte boundary. Use a compile line option for packing, 
 * if one is supported by your compiler. Otherwise use packing specific pragmas 
 * that are supported by your compiler.
*/
typedef struct ie_rep_type
{
    u_char rep_type;
}
IE_REP_TYPE;


/* The union structure for information elements...
 * A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 * needs to be packed on byte boundary. Use a compile line option for packing, 
 * if one is supported by your compiler. Otherwise use packing specific pragmas 
 * that are supported by your compiler.
*/
typedef struct ie_un
{
    u_char ie_id;
    u_char ie_len;
    union
    {
	   IE_REP_TYPE ie_rep_type;
	   IE_KEEP_ALIVE ie_keep_alive;
	   IE_PVC_STATUS ie_pvc_status;
	   IE_ANNEXD_PVC_STATUS ie_annexd_pvc_status;
	   IE_ANNEXA_PVC_STATUS ie_annexa_pvc_status;

#if FRS_DCE_SUPPORT
	   IE_REMOTE_PVC_STATUS ie_remote_pvc_status;
#endif
    }
    ie_type;
}
IE_UN;

typedef struct FRI_GetDLCIEntrys_struct {
	u_long snid ;
	u_long DLCIEntryCount ; 
	IE_UN DLCIEntrys[FRS_MAX_CHANNELS] ;
} FRI_GetDLCIEntrys_t ;

/* Frame header structure for an LMI frame...
 * A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 * needs to be packed on byte boundary. Use a compile line option for packing, 
 * if one is supported by your compiler. Otherwise use packing specific pragmas 
 * that are supported by your compiler.
*/
typedef struct fr_hdr_lmi
{
    FR_HDR lmi_header;
    u_char frame_type;
    u_char prot_disc;
    u_char call_ref;
    u_char msg_type;
}
FR_HDR_LMI;

#if    FRS_DCE_SUPPORT
/**
 ** A NOTE TO THE PERSON PORTING THE FRAME RELAY CODE:  The following structure 
 ** needs to be packed on byte boundary. Use a compile line option for packing, 
 ** if one is supported by your compiler. Otherwise use packing specific pragmas 
 ** that are supported by your compiler.
**/
typedef struct fr_hdr_cmi
{
    u_char frame_type;
    u_char prot_disc;
    u_char call_ref;
    u_char msg_type;
}
FR_HDR_CMI;

#endif

/* Thresholding data base for error situations...
*/
typedef struct thresh_parm
{
    u_char consec_pos_events;
    u_char total_neg_events;
    u_short x_state;
}
THRESH_PARM;

/* LMI Channel Ctrl Block...
    One per LMI, this structure maintains are relevant information
    for LMI to operate over a link.
*/
typedef struct lmi_ccb
{
    struct ccb common_ccb;            /* General CCB */

/* Counters and flags */
    u_char net_seq_num;               /* Counters for keep alive sequencing */
    u_char local_seq_num;
    u_char stat_enq_count;            /* # of STAT_ENQs within last nT3 */
    u_char lmi_flag;                  /* Network STATUS msg pending */
							   /* Force full status enquiries */
							   /* Fast Timer for LMI polling */
/* Configuration parameters */
    u_char lmi_polling_interval;      /* mT1 or T391 */
    u_char lmi_max_poll_interval;     /* mT2 or T392 */
    u_char lmi_xcess_poll_interval;   /* mT3 (nT3 must be > nT2) */
    u_char full_status_int_count;     /* mN1 or N391 */
    u_char lmi_alarm_event_thresh;    /* mN2 or N392 */
    u_char lmi_reset_event_count;     /* mN3 or N393 (mN3 should be >= mN2) */
    u_char lmi_max_stat_enq_count;    /* mN4 */

/* Polling and Response Statistics (Totals) */
    u_int  lmi_total_stat_enqs;/* Status enqs sent(DTE) or rcvd(DCE) */
    u_int  lmi_full_stat_enqs; /* Full Status enqs sent(DTE) or rcvd(DCE) */
    u_int  lmi_total_status;   /* Status responses rcvd(DTE) or sent(DCE) */
    u_int  lmi_full_status;    /* Full Status responses rcvd(DTE) or sent(DCE)*/
    u_int  lmi_total_updates;  /* updates rcvd(DTE) or sent(DCE) */

/* Error Statistics */
    u_int  lmi_inv_frm_hdr;           /* Error in Frame Relay header */
    u_int  lmi_proto_err;             /* Error in LMI frame */
    u_int  lmi_inv_msg_rcvd;          /* Unknown LMI message rcvd */
    u_int  lmi_no_ie_rep_type;        /* Report Type Info Element missing */
    u_int  lmi_no_ie_keep_alive;      /* Keep Alive IE missing */
    u_int  lmi_lost_seq_num_sync_event; /* Keep Alive Sequencing Loss Event */
    u_int  lmi_stat_resp_timeout;     /* No response to our status enq */

    u_int  lmi_unsupp_ie_msg;         /* Unknown IE type rcvd */
    u_int  lmi_unexpected_pvc_num;    /* Status rcvd about an un-cfged pvc */
    u_int  lmi_unexpected_pvc_stat_msg; /* PVC Stat IE was not expected */

    u_int  lmi_stat_enq_rate_plus;    /* Stat Enq Poll rate was exceeded */
    u_int  lmi_stat_enq_timeout;      /* Stat Enq Poll rate insufficient */
    u_int  lmi_outbound_frame_too_big; /* LMI frame exceeded max frame size */

/* Thresholding parameters */
    THRESH_PARM thresh_array[2];    /* Currently, only 2 events are thresh'ed */

}
LMICCB;

typedef	struct	frs_timer {
	u_int	time_future ;
	u_short	flags ;
	u_long  arg ;
	void	(*func)(u_long) ;
	struct	frs_timer *prev ;
	struct  frs_timer *next ;
}FRS_TIMER ;

#if FRS_DCE_SUPPORT
/* CMI Channel Ctrl Block...
    One per FRS, this structure maintains all relevant information
    for CMI to operate in a Frame Relay Service Network.
*/
typedef struct cmi_ccb
{
    u_int    my_rev_count;            /* Revision (tick) count */

    u_short  CmiTimerId;              /* CMI T1 timer ID */

/* Configuration parameters */
    u_char cmi_polling_interval;      /* CMI T1 interval */

/* Polling and Response Statistics (Totals) */
    u_int  cmi_total_status_sent;   /* Status messages sent to remote nodes */
    u_int  cmi_total_status_rcvd;   /* Status messages rcvd from remote nodes */

/* Error Statistics */
    u_int  cmi_proto_err;             /* Error in CMI frame */
    u_int  cmi_inv_msg_rcvd;          /* Unknown CMI message rcvd */
    u_int  cmi_no_ie_rep_type;        /* Report Type Info Element missing */

    u_int  cmi_unsupp_ie_msg;         /* Unknown IE type rcvd */
    u_int  cmi_unexpected_pvc_num;    /* Status rcvd about an un-cfged pvc */
    u_int  cmi_unexpected_link_num;   /* Status rcvd about an un-cfged link */

    u_short remote_node;              /* Current Remote Node list index */
    u_short remote_node_count;        /* Remote Node count */

/* List of remote nodes with PLLs terminated in this node */
    struct
    {
	   u_short  node_num;
	   u_short  timeout;
    } rnode[FRS_MAX_REMOTE_NODES];

}
CMICCB;
#endif                             /* FRS_DCE_SUPPORT */

#endif                             /* ifndef DEFINESONLY */


/* Link Ctrl Block...
    One per enabled link, this structure maintains the state, statistics, Qs,
    and associated info for a frame relay link...
*/
typedef struct lcb
{
    u_long   hLCB;             /* Link handle */
    u_short  lcb_opt;          /* LCB options in effect - see FRS_OPT_* */
    u_long   lmi_dlci;         /* LMI's dlci for this link */
    u_short  num_plls;         /* Number of PLLs on this link */
    QTCB     TQTCB;            /* Transmission Q */
    QTCB     RQTCB;            /* Receive Q */
    u_short  State;            /* Link State */
    MFN_PTR  fMakeFrame;       /* Ptr to function to build a frame */
    FN_PTR   fUnMakeFrame;     /* Ptr to function to xtract from a frame */
    struct   ccb *ccbList;     /* Ptr: linkedlist of CCBs layered on the LCB */
    struct   lmi_ccb *lmi_ccb; /* Ptr to special CCB exclusively for LMI */
    u_short  last_err;         /* Last error seen on this link */
    USRBUF   *err_data;        /* Frame containing error data */
    u_short  err_type;         /* Error type code for SNMP */
    frs_time err_time;         /* Elapsed time at which this error occurred */
    FRS_LINK_CFG  *my_cfg;     /* Ptr to this link's config struct */
    GEN_STATS my_stats;        /* Link stats */
    ERR_STATS my_err_stats;    /* Link error stats */
    u_short  LmiTimerId;       /* LMI Polling timer Id */
    u_short  LmiXcessChkTimerId;/* LMI Excess Poll Chk Timer Id */
    proc_id  child_id;         /* Task below frame relay */
    frs_time link_CreateTime;  /* Time in milliseconds when link created */
    frs_time link_uptime;      /* Time in milliseconds when link came up */
	IE_UN	 DLCIEntrys[FRS_MAX_CHANNELS] ; /* Full Status Update Information Elements */
	u_long	 DLCIEntryCount ;  /* Number of DLCI Entrys in Update message */
}
LCB;

/*
 * NULL pointer of type LCB
 */
#define LCBNULL         ((LCB *) NULL)


/**/
/*****************************************************************************
*                             FUNCTION PROTOTYPES
*****************************************************************************/

#include "frsproto.h"

#if USE_PROTOTYPES
u_short sys_oui_proc( struct ccb *, NPPARSE_HDR );
u_short sys_ins_oui( struct ccb *, NPSNAP_HDR );
#endif

/**/
/*****************************************************************************
*                             GLOBALS and EXTERNS
*****************************************************************************/

#ifndef DEFINESONLY

#ifndef FRSDATA_C
extern FRS_SYS_CFG gGlobalCfg;
#endif

#ifdef FRSUTIL_C

#define _EXTERN_ 
#define _INIT_(gooeey) gooeey
#define _COMMA_ ,

#else  /* ifdef FRSUTIL_C */

#define _EXTERN_ extern
#define _INIT_(gooeey)
#define _COMMA_

#endif /* ifdef FRSUTIL_C */

_EXTERN_ u_short gFrsEnabled _INIT_(= FALSE); 
_EXTERN_ struct lcb **frsLCBtable;     /* Link Ctrl Blk LCB table */ 
_EXTERN_ struct ccb **frsCCBtable;     /* Channel Ctrl Blk table */


#ifdef STATIC_MEMORY   

extern LCB		*frsLCBtable_ptrs[] ;
extern CCB		*frsCCBtable_ptrs[] ;

extern LCB 		frsLCBtab[]; 	
extern CCB 		frsCCBtab[]; 
extern LMICCB		frsLMICCBtab[];
extern FRS_PROTOCOL_ENTRY	frsFRS_PROTOCOL_ENTRYtab[];
extern MULTIPROTOCOL	frsMULTIPROTOCOLtab[];
extern EVENT		frsEVENTtab[]; 

extern unsigned char frsLCBtable_free[] ;
extern unsigned char frsCCBtable_free[] ;
extern unsigned char frsLMICCBtable_free[] ;
extern unsigned char frsFRS_PROTOCOL_ENTRYtable_free[] ; 
extern unsigned char frsMULTIPROTOCOLtable_free[] ;
extern unsigned char frsEVENTtable_free[] ;

#endif

extern FRS_TIMER	*frsTIMERfree_ptr ;
extern FRS_TIMER	*frsTIMERdispatch_ptr ;
extern FRS_TIMER	 frsTIMERtable[] ;

_EXTERN_ struct global_stats gGlobalStats;

#undef _EXTERN_
#undef _INIT_
#undef _COMMA_

#endif     /* ifndef DEFINESONLY */
#endif       /* ifndef FRS_H */
