⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sdla_x25.h

📁 GNU Hurd 源代码
💻 H
📖 第 1 页 / 共 2 页
字号:
/****************************************************************************** sdla_x25.h	Sangoma X.25 firmware API definitions.** Author:	Gene Kozin	<74604.152@compuserve.com>** Copyright:	(c) 1995-1996 Sangoma Technologies Inc.**		This program is free software; you can redistribute it and/or*		modify it under the terms of the GNU General Public License*		as published by the Free Software Foundation; either version*		2 of the License, or (at your option) any later version.* ============================================================================* Dec 13, 1996	Gene Kozin	Initial version*****************************************************************************/#ifndef	_SDLA_X25_H#define	_SDLA_X25_H/*---------------------------------------------------------------------------- * Notes: * ------ * 1. All structures defined in this file are byte-aligned.  To ensure *    portability of this code between different platforms and compilers, one *    of the following defines must be defined before including this file: * *	Compiler	Platform	Define		Use option *	--------	--------	------		---------- *	GNU C		Linux		_GNUC_		- *	Microsoft C	DOS/Windows	_MSC_		- * */#ifdef		_GNUC_#  ifndef	PACKED#    define	PACKED	__attribute__((packed))#  endif	/* PACKED */#else#  define	PACKED#endif#ifdef		_MSC_#  pragma	pack(1)#endif/******	CONSTANTS DEFINITIONS ***********************************************/#define	X25_MAX_CHAN	255	/* max number of open X.25 circuits */#define	X25_MAX_DATA	1024	/* max length of X.25 data buffer *//* * X.25 shared memory layout. */#define	X25_MBOX_OFFS	0x16B0	/* general mailbox block */#define	X25_RXMBOX_OFFS	0x1AD0	/* receive mailbox */#define	X25_STATUS_OFFS	0x1EF0	/* X.25 status structure *//****** DATA STRUCTURES *****************************************************//*---------------------------------------------------------------------------- * X.25 Command Block. */typedef struct X25Cmd{	unsigned char command	PACKED;	/* command code */	unsigned short length	PACKED;	/* transfer data length */	unsigned char result	PACKED;	/* return code */	unsigned char pf	PACKED;	/* P/F bit */	unsigned short lcn	PACKED;	/* logical channel */	unsigned char qdm	PACKED;	/* Q/D/M bits */	unsigned char cause	PACKED;	/* cause field */	unsigned char diagn	PACKED;	/* diagnostics */	unsigned char pktType	PACKED;	/* packet type */	unsigned char resrv[4]	PACKED;	/* reserved */} TX25Cmd;/* * Defines for the 'command' field. *//*----- General commands --------------*/#define X25_SET_GLOBAL_VARS	0x0B   	/* set global variables */ #define X25_READ_MODEM_STATUS	0x0C 	/* read modem status */#define X25_READ_CODE_VERSION	0x15	/* read firmware version number */#define X25_TRACE_CONFIGURE	0x14	/* configure trace facility */#define X25_READ_TRACE_DATA	0x16	/* read trace data */#define	X25_SET_INTERRUPT_MODE	0x17	/* set interrupt generation mode */#define	X25_READ_INTERRUPT_MODE	0x18	/* read interrupt generation mode *//*----- HDLC-level commands -----------*/#define X25_HDLC_LINK_CONFIGURE	0x01	/* configure HDLC link level */   #define X25_HDLC_LINK_OPEN	0x02	/* open HDLC link */         	#define X25_HDLC_LINK_CLOSE	0x03	/* close HDLC link */#define X25_HDLC_LINK_SETUP	0x04	/* set up HDLC link */ #define X25_HDLC_LINK_DISC	0x05	/* disconnect DHLC link */#define X25_HDLC_LINK_STATUS	0x06	/* read DHLC link status */#define X25_HDLC_READ_STATS	0x07	/* read operational statistics */#define X25_HDLC_FLUSH_STATS	0x08 	/* flush operational statistics */#define X25_HDLC_READ_COMM_ERR	0x09 	/* read error statistics */#define X25_HDLC_FLUSH_COMM_ERR	0x0A	/* flush error statistics */#define X25_HDLC_FLUSH_BUFFERS	0x0D	/* flush HDLC-level data buffers */#define X25_HDLC_SPRVS_CNT_STAT 0x0F	/* read surervisory count status */#define X25_HDLC_SEND_UI_FRAME	0x10	/* send unnumbered information frame */#define X25_HDLC_WRITE		0x11	/* send HDLC information frame */#define X25_HDLC_READ		0x21	/* read HDLC information frame */#define X25_HDLC_READ_CONFIG	0x12	/* read HDLC configuration */#define X25_HDLC_SET_CONFIG	0x13	/* set HDLC configuration *//*----- X.25-level commands -----------*/#define X25_READ		0x22	/* read X.25 packet */#define X25_WRITE		0x23	/* send X.25 packet */#define X25_PLACE_CALL		0x30	/* place a call on SVC */#define X25_ACCEPT_CALL		0x31	/* accept incoming call */#define X25_CLEAR_CALL		0x32	/* clear call */#define X25_CLEAR_CONFRM	0x33	/* send clear confirmation packet */#define X25_RESET		0x34	/* send reset request packet */#define X25_RESET_CONFRM	0x35	/* send reset confirmation packet */#define X25_RESTART		0x36	/* send restart request packet */#define X25_RESTART_CONFRM	0x37	/* send restart confirmation packet */#define X25_INTERRUPT		0x38	/* send interrupt request packet */#define X25_INTERRUPT_CONFRM	0x39	/* send interrupt confirmation pkt */#define X25_REGISTRATION_RQST	0x3A	/* send registration request packet */#define X25_REGISTRATION_CONFRM	0x3B	/* send registration confirmation */#define X25_IS_DATA_AVAILABLE	0x40	/* querry receive queue */#define X25_INCOMING_CALL_CTL	0x41	/* select incoming call options */#define X25_CONFIGURE_PVC	0x42	/* configure PVC */#define X25_GET_ACTIVE_CHANNELS	0x43	/* get a list of active circuits */#define X25_READ_CHANNEL_CONFIG	0x44	/* read virt. circuit configuration */#define X25_FLUSH_DATA_BUFFERS	0x45	/* flush X.25-level data buffers */#define X25_READ_HISTORY_TABLE	0x46	/* read asynchronous event log */#define X25_HISTORY_TABLE_CTL	0x47	/* control asynchronous event log */#define	X25_GET_TX_D_BIT_STATUS	0x48	/* is packet with D-bit acknowledged */#define	X25_READ_STATISTICS	0x49	/* read X.25-level statistics */#define	X25_FLUSH_STATISTICS	0x4A	/* flush X.25-level statistics */#define	X25_READ_CONFIGURATION	0x50	/* read HDLC & X.25 configuration */#define	X25_SET_CONFIGURATION	0x51	/* set HDLC & X.25 configuration *//* * Defines for the 'result' field. *//*----- General results ---------------*/#define X25RES_OK		0x00#define X25RES_ERROR		0x01#define X25RES_LINK_NOT_IN_ABM	0x02	/* link is not in ABM mode */#define X25RES_LINK_CLOSED	0x03#define X25RES_INVAL_LENGTH	0x04#define X25RES_INVAL_CMD	0x05#define X25RES_UNNUMBERED_FRAME	0x06	/* unnumbered frame received */#define X25RES_FRM_REJECT_MODE	0x07	/* link is in Frame Reject mode */#define X25RES_MODEM_FAILURE	0x08	/* DCD and/or CTS dropped */#define X25RES_N2_RETRY_LIMIT	0x09	/* N2 retry limit has been exceeded */#define X25RES_INVAL_LCN	0x30	/* invalid logical channel number */#define X25RES_INVAL_STATE	0x31	/* channel is not in data xfer mode */#define X25RES_INVAL_DATA_LEN	0x32	/* invalid data length */#define X25RES_NOT_READY	0x33	/* no data available / buffers full */#define X25RES_NETWORK_DOWN	0x34#define X25RES_CHANNEL_IN_USE	0x35	/* there is data queued on this LCN */#define X25RES_REGST_NOT_SUPPRT	0x36	/* registration not supported */#define X25RES_INVAL_FORMAT	0x37	/* invalid packet format */#define X25RES_D_BIT_NOT_SUPPRT	0x38	/* D-bit pragmatics not supported */#define X25RES_FACIL_NOT_SUPPRT	0x39	/* Call facility not supported */#define X25RES_INVAL_CALL_ARG	0x3A	/* erroneous call arguments */#define X25RES_INVAL_CALL_DATA	0x3B	/* erroneous call user data */#define X25RES_ASYNC_PACKET	0x40	/* asynchronous packet received */#define X25RES_PROTO_VIOLATION	0x41	/* protocol violation occurred */#define X25RES_PKT_TIMEOUT	0x42	/* X.25 packet time out */#define X25RES_PKT_RETRY_LIMIT	0x43	/* X.25 packet retry limit exceeded *//*----- Command-dependent results -----*/#define X25RES_LINK_DISC	0x00	/* HDLC_LINK_STATUS */#define X25RES_LINK_IN_ABM	0x01	/* HDLC_LINK_STATUS */#define X25RES_NO_DATA		0x01	/* HDLC_READ/READ_TRACE_DATA*/#define X25RES_TRACE_INACTIVE	0x02	/* READ_TRACE_DATA */#define X25RES_LINK_IS_OPEN	0x01	/* HDLC_LINK_OPEN */#define X25RES_LINK_IS_DISC	0x02	/* HDLC_LINK_DISC */#define X25RES_LINK_IS_CLOSED	0x03	/* HDLC_LINK_CLOSE */#define X25RES_INVAL_PARAM	0x31	/* INCOMING_CALL_CTL */#define X25RES_INVAL_CONFIG	0x35	/* REGISTR_RQST/CONFRM *//* * Defines for the 'qdm_bits' field. */#define X25CMD_Q_BIT_MASK	0x04#define X25CMD_D_BIT_MASK	0x02#define X25CMD_M_BIT_MASK	0x01/* * Defines for the 'pkt_type' field. *//*----- Asynchronous events ------*/#define ASE_CLEAR_RQST		0x02#define ASE_RESET_RQST		0x04#define ASE_RESTART_RQST	0x08#define ASE_INTERRUPT		0x10#define ASE_DTE_REGISTR_RQST	0x20#define ASE_CALL_RQST		0x30#define ASE_CALL_ACCEPTED	0x31#define ASE_CLEAR_CONFRM	0x32#define ASE_RESET_CONFRM	0x33#define ASE_RESTART_CONFRM	0x34#define ASE_INTERRUPT_CONFRM	0x35#define ASE_DCE_REGISTR_CONFRM	0x36#define ASE_DIAGNOSTIC		0x37#define ASE_CALL_AUTO_CLEAR	0x38#define AUTO_RESPONSE_FLAG	0x80/*----- Time-Out events ----------*/#define TOE_RESTART_RQST	0x03#define TOE_CALL_RQST		0x05#define TOE_CLEAR_RQST		0x08#define TOE_RESET_RQST		0x0A/*----- Protocol Violation events */#define PVE_CLEAR_RQST		0x32#define PVE_RESET_RQST		0x33#define PVE_RESTART_RQST	0x34#define PVE_DIAGNOSTIC		0x37/*---------------------------------------------------------------------------- * X.25 Mailbox. *	This structure is located at offsets X25_MBOX_OFFS and X25_RXMBOX_OFFS *	into shared memory window. */typedef struct X25Mbox{	unsigned char opflag	PACKED;	/* 00h: execution flag */	TX25Cmd cmd		PACKED;	/* 01h: command block */	unsigned char data[1]	PACKED;	/* 10h: data buffer */} TX25Mbox;/*---------------------------------------------------------------------------- * X.25 Time Stamp Structure. */typedef struct X25TimeStamp{	unsigned char month	PACKED;	unsigned char date	PACKED;	unsigned char sec	PACKED;	unsigned char min	PACKED;	unsigned char hour	PACKED;} TX25TimeStamp;/*---------------------------------------------------------------------------- * X.25 Status Block. *	This structure is located at offset X25_STATUS_OFF into shared memory *	window. */typedef struct X25Status{	unsigned short pvc_map	PACKED;	/* 00h: PVC map */	unsigned short icc_map	PACKED;	/* 02h: Incoming Chan. map */	unsigned short twc_map	PACKED;	/* 04h: Two-way Cnan. map */	unsigned short ogc_map	PACKED;	/* 06h: Outgoing Chan. map */	TX25TimeStamp tstamp	PACKED;	/* 08h: timestamp (BCD) */	unsigned char iflags	PACKED;	/* 0Dh: interrupt flags */	unsigned char imask     PACKED; /* 0Eh: interrupt mask  */	unsigned char resrv	PACKED;	/* 0Eh: */	unsigned char gflags	PACKED;	/* 10h: misc. HDLC/X25 flags */	unsigned char cflags[X25_MAX_CHAN] PACKED; /* channel status bytes */} TX25Status;/* * Bitmasks for the 'iflags' field. */#define X25_RX_INTR	0x01	/* receive interrupt */#define X25_TX_INTR	0x02	/* transmit interrupt */#define X25_MODEM_INTR	0x04	/* modem status interrupt (CTS/DCD) */#define X25_EVENT_INTR	0x10	/* asynchronous event encountered */#define X25_CMD_INTR	0x08	/* interface command complete *//* * Bitmasks for the 'gflags' field. */#define X25_HDLC_ABM	0x01	/* HDLC is in ABM mode */#define X25_RX_READY	0x02	/* X.25 data available */#define X25_TRACE_READY	0x08	/* trace data available */#define X25_EVENT_IND	0x20	/* asynchronous event indicator */#define X25_TX_READY	0x40	/* space is available in Tx buf.*//* * Bitmasks for the 'cflags' field. */#define X25_XFER_MODE	0x80	/* channel is in data transfer mode */#define X25_TXWIN_OPEN	0x40	/* transmit window open */#define X25_RXBUF_MASK	0x3F	/* number of data buffers available *//***************************************************************************** * Following definitions structurize contents of the TX25Mbox.data field for * different X.25 interface commands. ****************************************************************************//* --------------------------------------------------------------------------- * X25_SET_GLOBAL_VARS Command. */typedef struct X25GlobalVars{	unsigned char resrv	PACKED;	/* 00h: reserved */	unsigned char dtrCtl	PACKED;	/* 01h: DTR control code */	unsigned char resErr	PACKED;	/* 01h: '1' - reset modem error */} TX25GlobalVars;/* * Defines for the 'dtrCtl' field. */#define X25_RAISE_DTR	0x01#define X25_DROP_DTR	0x02/* --------------------------------------------------------------------------- * X25_READ_MODEM_STATUS Command. */typedef struct X25ModemStatus{	unsigned char	status	PACKED;		/* 00h: modem status */} TX25ModemStatus;/* * Defines for the 'status' field. */#define X25_CTS_MASK	0x20#define X25_DCD_MASK	0x08/* ---------------------------------------------------------------------------

⌨️ 快捷键说明

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