mnpdat.h

来自「汇编源代码大全2」· C头文件 代码 · 共 140 行

H
140
字号
/***************************************************************************

 				General MNP Definitions

***************************************************************************/

#define SUCCESS 	0	/* success return code from all functions */
#define TRUE		1
#define FALSE		0

/*-------------------- Return Codes used by LLVL -------------------------*/

#define FAILURE      (-64)	/* no further information */
#define TIME_OUT     (-65)	/* timeout */
#define NO_PHYSICAL  (-66)	/* physical connection down */
#define LNK_DOWN     (-67)	/* link connection down */
				/* see mnp_cb.ld_reason for LD reason code */
#define LR_CODE      (-73)	/* when there is an error in parsing an LR,
				   an LD is sent back with reason code (1-5)
				   LR_CODE is added to that reason code and
				   returned as one of the 5 error codes below

		      -72	received LPDU not LR as expected
		      -71	reserved
		      -70	incompatible or unknown parameters
		      -69	reserved
		      -68	reserved
				*/

#define BUFF_ERR     (-75)	/* buffer error */

/* -----------------------------------------------------------------------*/

#define NULL		0

/* Protocol Data Units */

#define LR		1
#define LD		2
#define LT		4
#define LA		5
#define LN		6
#define LNA		7

/* Protocol Data Units Formats (Offsets) */

#define PDU_LI		0		/* header length indicator */
#define PDU_TYPE	1		/* type of pdu */

/***************************************************************************
*									   *
*			Buffer Management Definitions			   *
*									   *
***************************************************************************/


/* each blst (buffer list) structure controls an actual buffer */

struct blst {
	int mark;			/* 0: free | 1: used */
	char *bptr;			/* pointer to the actual buffer */
	int len;			/* lenght of data in buffer */
	struct blst *next_b;		/* pointer to next structure */
};

/* each buffer structure controls a linked list of blst structures */

struct buffer {
	struct blst *list;		/* pointer to head node */
	struct blst *free;		/* pointer to node with free buffer */
	int num;			/* total number of nodes (buffers) */
	int used;			/* number of buffers being used */
	struct blst *used_lst;		/* pointer to head of list
					  of buffers in use */
	struct blst *next_lst;
};

#define BIT0_ON 	(0x01)

/***************************************************************************

     				LLVL Definitions

***************************************************************************/

/* Link Disconnect reason code */
#define PROT_ERR		1
#define PROT_LVL_MISMATCH	2
#define BAD_LR_PARMS		3
#define RETRAN_TMR_EXP		4
#define INACT_TMR_EXP		5

struct link_ctl_blk {
	/* variables initialized at one-time initialization */
	char status_1;		/* link status */
	char status_2;		/* link status */
	char status_3;		/* link status */
	int ack_timer;		/* acknowledgement timer value */
	int max_data_sz;	/* negotiated maximum user data size */
	int prot_level; 	/* negotiated protocol level */
	int lt_tmr;		/* lt (data) retransmission timer value */
	int srv_class;		/* local service class */
	int window_sz;		/* negotiated window size */
	int window_tmr; 	/* flow control window timer value */
	int baud_rate;		/* current link baud rate */
	char ln_rsn;		/* last ln (remote) receive sequence number */
	char ln_ssn;		/* last ln (local) send sequence number */

	/* variables initialized/reset at link reset */
	char ltssn_acked;	/* last lt sent seq. # that has been acked */
				/* by remote link */
	char ltrsn_acked;	/* last lt received seq. # that has been */
				/* acked by local link */
	char lt_rsn;		/* last lt (remote) received sequence number */
	char lt_ssn;		/* last lt (local) sent sequence number */
	int ln_ret_cnt; 	/* ln retransmission count */
	int lt_ret_cnt; 	/* lt retransmission count */

	/* variables initialized at start of data phase */
	int ack_threshold;	/* acknowledgement threshold */
	int lcl_credit; 	/* receive (local) credit */
	int rem_credit; 	/* send (remote) credit */

	/* other variables */
	int l_disc_code;	/* link layer disconnect code */
	int ln_rtype;		/* ln lpdu type received */
	int ln_stype;		/* ln lpdu type to be sent */
	int lpdu_type;		/* type of last lpdu received */
	int u_disc_code;	/* user disconnect code */
	char lr_parm;		/* lr parameter flag */
};

/* Link Status Byte 1 bit definition (lcb.status_1)
*/
#define LA_RECEIVED	1	/* on: la lpdu received */
#define LINK_EST	2	/* on: link established */
#define DATA_READY	4	/* on: user data available (lt received) */
#define ACK_TIMER	8	/* on: timer set */
#define RET_TIMER	16	/* on: retran timer set */
#define MODE		32	/* on: acceptor 

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?