📄 defs.h
字号:
/************************************************************************************* Filename : defs.h*** Purpose : Preprocessor Definitions for SIBO Comms/NCP*** Author : Matt J. Gumbley, borrowed heavily from Michael and SDK*** Created : 08/01/99*** Last updated : 08/01/99***************************************************************************************** Modification Record**********************************************************************************/#ifndef DEFS_H#define DEFS_H#define E_MAX_NAME 12/* Asynchronous comms definitions *//* Serial port characteristics */typedef struct{ unsigned char tbaud; /* transmit Baud rate selector */ unsigned char rbaud; /* receive Baud rate selector */ unsigned char frame; /* number of data,parity and stop bits */ unsigned char parity; /* parity selector */ unsigned char hand; /* handshake flags */ unsigned char xon; /* XON character */ unsigned char xoff; /* XOFF character */ unsigned char flags; /* ignore parity errors/dont drive DTR changing chars */ unsigned long int tmask; /* terminator mask */ } P_SRCHAR;/* Baud rates */#define P_BAUD_50 0x01#define P_BAUD_75 0x02#define P_BAUD_110 0x03#define P_BAUD_134 0x04#define P_BAUD_150 0x05#define P_BAUD_300 0x06#define P_BAUD_600 0x07#define P_BAUD_1200 0x08#define P_BAUD_1800 0x09#define P_BAUD_2000 0x0A#define P_BAUD_2400 0x0B#define P_BAUD_3600 0x0C#define P_BAUD_4800 0x0D#define P_BAUD_7200 0x0E#define P_BAUD_9600 0x0F#define P_BAUD_19200 0x10#define P_BAUD_38400 0x11#define P_BAUD_56000 0x12#define P_BAUD_115000 0x13/* allocation of frame bits */#define P_DATA_FRM 0x0f /* number of data bits mask */ #define P_DATA_5 0 /* 5 data bits */ #define P_DATA_6 1 /* 6 data bits */ #define P_DATA_7 2 /* 7 data bits */ #define P_DATA_8 3 /* 8 data bits */ #define P_TWOSTOP 0x10 /* 2 stop bits if set,1 if clear */ #define P_PARITY 0x20 /* 1 parity bit if set,0 if clear */ /* parity - ignored unless P_PARITY is set */#define P_PAR_EVEN 1 /* even parity */ #define P_PAR_ODD 2 /* odd parity */ #define P_PAR_MARK 3 /* mark parity */ #define P_PAR_SPACE 4 /* space parity */ /* handshaking control */#define P_OBEY_XOFF 0x01 /* respond to received XOFF (and XON) if set */ #define P_SEND_XOFF 0x02 /* send XOFF/XON to control receive buffer if set */ #define P_IGN_CTS 0x04 /* ignore the state of CTS if set */ #define P_OBEY_DSR 0x08 /* obey the state of DSR if set */ #define P_FAIL_DSR 0x10 /* fail if DSR goes OFF if set */ #define P_OBEY_DCD 0x20 /* obey the state of DCD if set */ #define P_FAIL_DCD 0x40 /* fail if DCD goes OFF if set */ /* flags control */#define P_IGNORE_PARITY 0x01 /* ignore parity errors */ /* For P_FCTRL function */#define P_SRCTRL_CTS 0x01#define P_SRCTRL_DSR 0x02#define P_SRCTRL_DCD 0x04#define P_SRCTRL_RTS 0x08#define P_SRCTRL_DTR 0x10#define P_SRDTR_ON 1 /* to set DTR to MARK */ #define P_SRDTR_OFF 2 /* to set DTR to SPACE */ /* Bit masks for P_FINQ function */#define P_SRINQ_50 0x0001#define P_SRINQ_75 0x0002#define P_SRINQ_110 0x0004#define P_SRINQ_134 0x0008#define P_SRINQ_150 0x0010#define P_SRINQ_300 0x0020#define P_SRINQ_600 0x0040#define P_SRINQ_1200 0x0080#define P_SRINQ_1800 0x0100#define P_SRINQ_2000 0x0200#define P_SRINQ_2400 0x0400#define P_SRINQ_3600 0x0800#define P_SRINQ_4800 0x1000#define P_SRINQ_7200 0x2000#define P_SRINQ_9600 0x4000#define P_SRINQ_19200 0x8000/* second baud rate word */#define P_SRINQ_38400 0x0001#define P_SRINQ_56000 0x0002/* 2nd set of info */#define P_SRINQ_DATA5 0x0001 /* supports 5 data bits */ #define P_SRINQ_DATA6 0x0002 /* supports 6 data bits */ #define P_SRINQ_DATA7 0x0004 /* supports 7 data bits */ #define P_SRINQ_DATA8 0x0008 /* supports 8 data bits */ #define P_SRINQ_STOP2 0x0010 /* supports 2 stop bits (as well as 1) */ #define P_SRINQ_PAREVEN 0x0020 /* supports even parity */ #define P_SRINQ_PARODD 0x0040 /* supports odd parity */ #define P_SRINQ_PARMARK 0x0080 /* supports mark parity */ #define P_SRINQ_PARSPACE 0x0100 /* supports space parity */ #define P_SRINQ_SETDTR 0x0200 /* can set DTR */ #define P_SRINQ_SPLIT 0x400 /* supports split Baud rates */ #define P_SRINQ_XONXOFF 0x800 /* Supports soft xon/xoff characters */ /* what options are selected */#define P_MDM_TONE 0x01 /* as opposed to PULSE dialling (default) */ #define P_MDM_BELL 0x02 /* as opposed to CCITT (default) */ #define P_MDM_NO_MODULATION 0x04 /* as opposed to CCITT or BELL */ #define P_MDM_CONSTANT_SPEED 0x08 /* modem has constant speed interface */ /* Error correction types */#define P_MDM_ERRCORRECT_NONE 0 /* NO error correction */ #define P_MDM_ERRCORRECT 1 /* some form of error correction (ARQ)*/ #define P_MDM_ERRCORRECT_MNP 2 /* MNP error correction being used */ #define P_MDM_ERRCORRECT_V42 3 /* V42 error correction being used */ typedef struct{ unsigned short int supported; /* what baud rates are supported by modem */ unsigned short int options; /* flags which options are selected */ unsigned short int baudrate; /* baud rate currently running at/to run at */ unsigned char chand; /* connected handshaking */ unsigned char ichand; /* incoming call handshaking */ } P_MDMCHR;/* PLP Protocol *//* Packet types (high nibble of type byte) */#define PLP_MSG_ACKNOWLEDGE 0x00#define PLP_MSG_DISCONNECT 0x10#define PLP_MSG_LINK_REQUEST 0x20#define PLP_MSG_DATA 0x30#define PLP_MSG_MASK 0xF0#define PLP_SEQUENCE_MASK 0x0F/* NCP Protocol */#define NCP_VERSION_NUMBER 2 /* We're just a v2 - what's the diff? */#define NCLINK_VERSION_NUMBER 3 /* As returned by the 3c */#define NCLINK_MINOR_VERNO 1/* Informational data obtained by supervisory reads */#define PHYS_LINK_FAILED 0 /* Link layer has failed*/#define PHYS_CONNECT_FAILED 1 /* Waiting for connection failed */#define PHYS_CHARS_FAILED 2 /* Setting serial characteristics failed */#define PHYS_INIT_FAILED 3 /* Initialization of modem failed */#define PHYS_DIAL_FAILED 4 /* Dialling phone number failed */#define PHYS_MDMCONFIG_FAILED 5 /* additional modem config failed */#define PHYS_PHYS_LINK_ESTABLISHED 6 /* A physical link established */#define PHYS_WAITING_FOR_CALL 7 /* Physical layer waiting for call */#define PHYS_DIALLING_NUMBER 8 /* Physical layer dialling */#define PHYS_CONFIGURING_MODEM 9 /* configuring modem */#define PHYS_NCP_LINK_ESTAB_OK 10 /* Ncp link established OK */#define PHYS_NCP_LINK_ESTAB_NEW_NCP 11 /* Talking to different Ncp */#define PHYS_NCP_LINK_ESTAB_INVALID_VER 12 /* Remote NCP is V1.0 !!*/#define PHYS_NCP_LINK_END 13 /* remote NCP is terminating */#define PHYS_SERCONFIG_FAILED 14 /* serial port not there */#define MAX_DVR_NAME 10 /* Max device driver name size (incl zero term) */#define MAX_PHONE_NO 40 /* Max phone number length */#define MAX_MODEM_CMD 40 /* Max extra modem config *//* Control functions to perform */#define NCLINK_CTRL_RETRY 0#define NCLINK_CTRL_EXIT 1#define NCLINK_CTRL_NEWNCP_OK 2#define NCLINK_CTRL_NEW_CONFIG 3typedef struct{ P_SRCHAR sch; P_MDMCHR mch; WORD16 errcorrect; /* what sort of error correction modem using */ WORD16 connectbaud; /* baud rate at which connected */ BYTE serdvr[MAX_DVR_NAME]; BYTE mdmdvr[MAX_DVR_NAME]; BYTE masdvr[MAX_DVR_NAME]; BYTE lnkdvr[MAX_DVR_NAME]; BYTE phoneno[MAX_PHONE_NO]; BYTE mdmconf[MAX_MODEM_CMD];} DVRS;typedef struct{ WORD16 vers; /* Remote NCP sofware version */ WORD32 id; /* Remote NCP id */} REM_NCP;typedef union{ REM_NCP remncp; /* Remote NCP info */ DVRS dvrs; /* Driver names, phone number */} PHY_INFO;typedef struct /* Physical layer status information */{ WORD16 cmdtype; /* Info type */ WORD16 errnum; /* Error number if applicable to type */ PHY_INFO p; /* Physical layer info */} NCLINK_INFO;typedef struct /* Network sense data struct */{ WORD16 chanused; /* True if channel being used else False */ WORD32 xmitK; /* number K bytes transmitted */ WORD32 recvK; /* number K bytes received */ BYTE procname[E_MAX_NAME+2]; /* Process name that owns channel */} NCLINK_SREC;/* Inter controller message types */#define NCON_MSG_DATA_XOFF 1#define NCON_MSG_DATA_XON 2#define NCON_MSG_CONNECT_TO_SERVER 3#define NCON_MSG_CONNECT_RESPONSE 4#define NCON_MSG_CHANNEL_CLOSED 5#define NCON_MSG_NCP_INFO 6 /* MUST BE 6 for older versions */ #define NCON_MSG_CHANNEL_DISCONNECT 7#define NCON_MSG_NCP_END 8/* RFSV Protocol *//* Packet types */#define RFSV_FOPEN 0#define RFSV_FCLOSE 2#define RFSV_FREAD 4#define RFSV_FDIRREAD 6#define RFSV_FDEVICEREAD 8#define RFSV_FWRITE 10#define RFSV_FSEEK 12#define RFSV_FFLUSH 14#define RFSV_FSETEOF 16#define RFSV_RENAME 18#define RFSV_DELETE 20#define RFSV_FINFO 22#define RFSV_SFSTAT 24#define RFSV_PARSE 26#define RFSV_MKDIR 28#define RFSV_OPENUNIQUE 30#define RFSV_STATUSDEVICE 32#define RFSV_PATHTEST 34
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -