#if !defined(__COMMDEFINES_H_) #define __COMMDEFINES_H_ //----------------------------------------------------------------------------- //RFC 2217 related Defines //----------------------------------------------------------------------------- #define RFC2217_HEADER_SIZE 6 //Client to Access Server // Client will use these to make RFC Packets in TX thread static const unsigned char CLIENT_SIGNATURE = 0; static const unsigned char CLIENT_SET_BAUDRATE = 1; static const unsigned char CLIENT_SET_DATASIZE = 2; static const unsigned char CLIENT_SET_PARITY = 3; static const unsigned char CLIENT_SET_STOPSIZE = 4; static const unsigned char CLIENT_SET_CONTROL = 5; static const unsigned char CLIENT_NOTIFY_LINESTATE = 6; static const unsigned char CLIENT_NOTIFY_MODEMSTATE = 7; static const unsigned char CLIENT_FLOWCONTROL_SUSPEND = 8; static const unsigned char CLIENT_FLOWCONTROL_RESUME = 9; static const unsigned char CLIENT_SET_LINESTATE_MASK = 10; static const unsigned char CLIENT_SET_MODEMSTATE_MASK = 11; static const unsigned char CLIENT_PURGE_DATA = 12; //Access Server to Client // Client will use these to interpret the Packets in RX thread static const unsigned char SERVER_SIGNATURE = 0; static const unsigned char SERVER_SET_BAUDRATE = 101; static const unsigned char SERVER_SET_DATASIZE = 102; static const unsigned char SERVER_SET_PARITY = 103; static const unsigned char SERVER_SET_STOPSIZE = 104; static const unsigned char SERVER_SET_CONTROL = 105; static const unsigned char SERVER_NOTIFY_LINESTATE = 106; static const unsigned char SERVER_NOTIFY_MODEMSTATE = 107; static const unsigned char SERVER_FLOWCONTROL_SUSPEND = 108; static const unsigned char SERVER_FLOWCONTROL_RESUME = 109; static const unsigned char SERVER_SET_LINESTATE_MASK = 110; static const unsigned char SERVER_SET_MODEMSTATE_MASK = 111; static const unsigned char SERVER_PURGE_DATA = 112; ///////////////////////////////// // a variable declared with "static const unsigned char" cannot be used as a case in the // switch statement, the followitn #defines are replication of Client to Access Server // commands and SET-CONTROL optins #define _CLIENT_SIGNATURE 0 #define _CLIENT_SET_BAUDRATE 1 #define _CLIENT_SET_DATASIZE 2 #define _CLIENT_SET_PARITY 3 #define _CLIENT_SET_STOPSIZE 4 #define _CLIENT_SET_CONTROL 5 #define _CLIENT_NOTIFY_LINESTATE 6 #define _CLIENT_NOTIFY_MODEMSTATE 7 #define _CLIENT_FLOWCONTROL_SUSPEND 8 #define _CLIENT_FLOWCONTROL_RESUME 9 #define _CLIENT_SET_LINESTATE_MASK 10 #define _CLIENT_SET_MODEMSTATE_MASK 11 #define _CLIENT_PURGE_DATA 12 #define CONTROL_GET_OUTBOUND_FLOW_CONTROL 0 #define CONTROL_SET_NO_OUTBOUND_FLOW_CONTROL 1 #define CONTROL_SET_XON_XOFF_OUTBOUND_FLOW_CONTROL 2 #define CONTROL_SET_HARDWARE_OUTBOUND_FLOW_CONTROL 3 #define CONTROL_GET_BREAK_STATE 4 #define CONTROL_SET_BREAK_STATE_ON 5 #define CONTROL_SET_BREAK_STATE_OFF 6 #define CONTROL_GET_DTR_STATE 7 #define CONTROL_SET_DTR_STATE_ON 8 #define CONTROL_SET_DTR_STATE_OFF 9 #define CONTROL_GET_RTS_STATE 10 #define CONTROL_SET_RTS_STATE_ON 11 #define CONTROL_SET_RTS_STATE_OFF 12 #define CONTROL_GET_INBOUND_FLOW_CONTROL 13 #define CONTROL_SET_NO_INBOUND_FLOW_CONTROL 14 #define CONTROL_SET_XON_XOFF_INBOUND_FLOW_CONTROL 15 #define CONTROL_SET_HARDWARE_INBOUND_FLOW_CONTROL 16 #define CONTROL_SET_DCD_OUTBOUND_FLOW_CONTROL 17 #define CONTROL_SET_DTR_INBOUND_FLOW_CONTROL 18 #define CONTROL_SET_DSR_OUTBOUND_FLOW_CONTROL 19 ////////////////////////////////////////////////////////////// static const unsigned char IAC = 255; static const unsigned char DO = 253; static const unsigned char DONT = 254; static const unsigned char WILL = 251; static const unsigned char WONT = 252; static const unsigned char SB = 250; static const unsigned char SE = 240; static const unsigned char COM_PORT_OPTION = 44; //SET-MODEMSTATE-MASK /* 7 128 Receive Line Signal Detect (also known as Carrier Detect) 6 64 Ring Indicator 5 32 Data-Set-Ready Signal State 4 16 Clear-To-Send Signal State 3 8 Delta Receive Line Signal Detect 2 4 Trailing-edge Ring Detector 1 2 Delta Data-Set-Ready 0 1 Delta Clear-To-Send */ static const unsigned char MODEMSTATE_MASK_CHANGED_CTS =0x01; static const unsigned char MODEMSTATE_MASK_CHANGED_DSR =0x02; static const unsigned char MODEMSTATE_MASK_TRAIL_EDGE_RING =0x04; static const unsigned char MODEMSTATE_MASK_CHANGED_RLSD =0x08; static const unsigned char MODEMSTATE_MASK_CTS_SET =0x10; static const unsigned char MODEMSTATE_MASK_DSR_SET =0x20; static const unsigned char MODEMSTATE_MASK_RING_INDICATION =0x40; static const unsigned char MODEMSTATE_MASK_RLSD_SET =0x80; //SET-LINESTATE-MASK /* Bit Position Value Meaning 7 128 Time-out Error 6 64 Transfer Shift Register Empty 5 32 Transfer Holding Register Empty 4 16 Break-detect Error 3 8 Framing Error 2 4 Parity Error 1 2 Overrun Error 0 1 Data Ready */ static const unsigned char LINESTATE_MASK_DATA_READY =0x01; static const unsigned char LINESTATE_MASK_OVERRUN_ERR =0x02; static const unsigned char LINESTATE_MASK_PARITY_ERR =0x04; static const unsigned char LINESTATE_MASK_FRAMING_ERR =0x08; static const unsigned char LINESTATE_MASK_BREAK_ERR =0x10; static const unsigned char LINESTATE_MASK_THR_EMPTY =0x20; static const unsigned char LINESTATE_MASK_TSR_EMPTY =0x40; static const unsigned char LINESTATE_MASK_TIMEOUT_ERR =0x80; /* IAC SB COM-PORT-OPTION SET-CONTROL IAC SE This command is sent by the client to the access server to set special com port options. The command can also be sent to query the current option value. The value is one octet (byte). The value is an index into the following value table: Value Control Commands 0 Request Com Port Flow Control Setting (outbound/both) 1 Use No Flow Control (outbound/both) 2 Use XON/XOFF Flow Control (outbound/both) 3 Use HARDWARE Flow Control (outbound/both) 4 Request BREAK State 5 Set BREAK State ON 6 Set BREAK State OFF 7 Request DTR Signal State 8 Set DTR Signal State ON 9 Set DTR Signal State OFF 10 Request RTS Signal State 11 Set RTS Signal State ON 12 Set RTS Signal State OFF 13 Request Com Port Flow Control Setting (inbound) 14 Use No Flow Control (inbound) 15 Use XON/XOFF Flow Control (inbound) 16 Use HARDWARE Flow Control (inbound) 17 Use DCD Flow Control (outbound/both) 18 Use DTR Flow Control (inbound) 19 Use DSR Flow Control (outbound/both) 20-127 Available for Future Use */ static const unsigned char SET_CONTROL_GET_OUTBOUND_FLOW_CONTROL =0; static const unsigned char SET_CONTROL_SET_NO_OUTBOUND_FLOW_CONTROL =1; static const unsigned char SET_CONTROL_SET_XON_XOFF_OUTBOUND_FLOW_CONTROL =2; static const unsigned char SET_CONTROL_SET_HARDWARE_OUTBOUND_FLOW_CONTROL =3; static const unsigned char SET_CONTROL_GET_BREAK_STATE =4; static const unsigned char SET_CONTROL_SET_BREAK_STATE_ON =5; static const unsigned char SET_CONTROL_SET_BREAK_STATE_OFF =6; static const unsigned char SET_CONTROL_GET_DTR_STATE =7; static const unsigned char SET_CONTROL_SET_DTR_STATE_ON =8; static const unsigned char SET_CONTROL_SET_DTR_STATE_OFF =9; static const unsigned char SET_CONTROL_GET_RTS_STATE =10; static const unsigned char SET_CONTROL_SET_RTS_STATE_ON =11; static const unsigned char SET_CONTROL_SET_RTS_STATE_OFF =12; static const unsigned char SET_CONTROL_GET_INBOUND_FLOW_CONTROL =13; static const unsigned char SET_CONTROL_SET_NO_INBOUND_FLOW_CONTROL =14; static const unsigned char SET_CONTROL_SET_XON_XOFF_INBOUND_FLOW_CONTROL =15; static const unsigned char SET_CONTROL_SET_HARDWARE_INBOUND_FLOW_CONTROL =16; static const unsigned char SET_CONTROL_SET_DCD_OUTBOUND_FLOW_CONTROL =17; static const unsigned char SET_CONTROL_SET_DTR_INBOUND_FLOW_CONTROL =18; static const unsigned char SET_CONTROL_SET_DSR_OUTBOUND_FLOW_CONTROL =19; #endif //__COMMDEFINES_H_