#ident "$Id: cproc.h,v 1.1 1995/03/16 17:14:55 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 - HDLC Driver
 *
 *  Copyright 1991 Spider Systems Limited
 *
 *  CPROC.H
 *
 *    Call procedure specific information for HDLC.
 *
 ******************************************************************/

/*
 *       /usr/projects.old/tcp/PBRAIN/SCCS/pbrainF/dev/embed/wan/0/s.cproc.h
 *      @(#)cproc.h	1.3
 *
 *      Last delta created      16:56:46 2/12/92
 *      This file extracted     10:43:03 7/22/92
 *
 */


/*
    Here are all of the valid states into which a DTE can enter
    during call set up.

    Note that all disconnected and data transfer states should have the
    same values throughout all call procedures

    First two basic states when no call procedures in use.
*/
#define	HDLC_IDLE     0
#define	HDLC_ESTB     30


/*
    First x21 or v25bis setup procedures.
*/
#define	STATE_1		1
#define	STATE_2		2
#define	STATE_3		3
#define	STATE_4		4
#define	STATE_5		5
#define	STATE_7		7
#define	STATE_8		8
#define	STATE_9		9
#define	STATE_10	10
#define	STATE_11	11
#define	STATE_12	12
#define	STATE_13	13
#define	STATE_15	15
#define	STATE_16	16
#define	STATE_17	17
#define	STATE_18	18
#define	STATE_20	20
#define	STATE_DTRANS	HDLC_ESTB

/*
    Here are all of the valid states into which a DTE can enter
    during modem procedures
*/
#define DISCONNECTED  HDLC_IDLE  /* Disabled DTR,RTS low                   */
#define PENDING_DISC  1          /* Disabled DTR,RTS low, DSR,DCD.CTS high */
#define PENDING_CONN  2	         /* Enabled DTR,RTS high, DSR,DCD,CTS low  */
#define CONNECTED     HDLC_ESTB  /* Enabled DTR,RTS high, DSR,DCD,CTS high */

/*
	IA5 characters required for v25bis. commands.
*/
#define	CRN	"CRN"	/* Call Request Number		*/
#define	DIC	"DIC"	/* Disregard Incoming Call	*/
#define	CIC	"CIC"	/* Connect Incoming Call	*/
#define	VAL	"VAL"	/* VALid			*/
#define	INV	"INV"	/* INValid			*/
#define	CFI	"CFI"	/* Call Failure Indication	*/
#define	DLC	"DLC"	/* DeLay Call			*/
#define	LSN	"LSN"	/* List Stored Numbers		*/
#define	LSF	"LSF"	/* LiSt Forbidden numbers	*/
#define	LSD	"LSD"	/* LiSt Delay call numbers	*/
#define	LSI	"LSI"	/* LiSt Identification numbers	*/


/*
	Command states received by V25bis interface.
*/
#define	DCL_ST	1	/* As above */
#define	CFI_ST	2
#define	INV_ST	3
#define	INC_ST	4
#define	VAL_ST	5


/*
	X21 states at physical interface.
*/
#define	X21STATE_UNDEF		0
#define	X21STATE_ONE		1
#define	X21STATE_ZERO		2
#define	X21STATE_RX		3
#define	X21STATE_C		4
#define	X21STATE_BEL		5
#define	X21STATE_PLUS		6
#define	X21STATE_ASTERISC	7


/*
	IA5 characters required for X21 commands.
*/
#define	SYN	0x16
#define	BEL	0x07


/*
	The number of Call Procedural interfaces currently supported.
*/
#define	NCPROCS	3

/*
	Number of timers used by interface.
*/ 
#define DEF_NTIMERS   1              /* No of timers when no call proc  */
#define MDM_NTIMERS   2              /* No of timers for modem procs    */
#define	V25_NTIMERS   4              /* No of timers for V25   procs    */
#define	X21_NTIMERS   7              /* No of timers for X21   procs    */

#define	NTIMS         X21_NTIMERS    /* Max. no. of timers possible.    */


/*
	Defined states of input signals.
*/
#define	SIG_OFF		1	/* As CCITT spec. */
#define	SIG_ON		0
#define	SIG_UNDEF	-1


/*
	Timers used for procedures.
*/
#define	HD_MODT		0

#define	V25_STATE	0
#define	V25_CALLREQ	1
#define	V25_HANGUPTM	2
#define	V25_DELAY	3

#define	X21_STATE	0
#define	X21_T1		1
#define	X21_T2		2
#define	X21_T3A		3
#define	X21_T4B		4
#define	X21_T5		5
#define	X21_T6		6

#define MDM_STATE       0
#define MDM_CALLREQ     1

/*
	Maximum address size.
*/
#define	ADDR_SZ	256

/*
	WAN_CONNECT return status's for wan_confirm.
*/
#define	CONNECT	1
#define	FAIL	0


#define	ONESEC	10	/* Timeout's in 10th secs. */
#define	HALFSEC	5	/* ~ 500 mills. = DTE response time for incoming *
			 * call using X21 call procedures.		 */


/*
	Here is the functional interface to the Calling Procedures.

	N.b. all procedural interfaces should look and act the
	same to HDLC. This is to keep a uniform interface within HDLC.
	Any additional procedural specific support required should
	be kept within the procedural interface or added across all
	of the supported interfaces.
*/
struct cproc_func
{
	int	(*init_line)() ;	/* Initiate call request sequence */
	int	(*call_req)() ;		/* Initiate call request sequence */
	int	(*disable_req)() ;	/* Disable incoming calls	  */
	int	(*program_req)() ;	/* Send a command to the DCE	  */
	int	(*disgard_req)() ;	/* Disregard incoming calls temp. */
	int	(*acc_disgarded)() ;	/* Accept disregarded calls	  */
	int	(*list_req)() ;		/* Get info. from the DCE	  */
	int	(*clear_req)() ;	/* Clear down a call in progress  */
} ;


/*
	Here are the Macros which are used to dereference the functional
	interface to the calling procedures.
*/
#define	INIT_LINE(ptr)	(*cproctbl[ptr->cproc-1].init_line)
#define	CALL_REQ(ptr)	(*cproctbl[ptr->cproc-1].call_req)
#define	DISREGARD(ptr)	(*cproctbl[ptr->cproc-1].disregard)
#define	RESETDIS(ptr)	(*cproctbl[ptr->cproc-1].resetdis)
#define	CLEAR_REQ(ptr)	(*cproctbl[ptr->cproc-1].clear_req)

