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

📄 linkdefs.h

📁 基于单片机的 snmp协议解析的一些原代码 给有用的 同行
💻 H
字号:
#ifndef LINK_DEFS_H
#define LINK_DEFS_H

const unsigned char DELIMITER_BYTE = 0x7e;

const unsigned char UNUMBERED_INFO_NOPOLL = 0x03; // Unnumbered Info frame no poll
const unsigned char UNNUMBERED_INFO = 0x13;		  // Unnumbered Info with poll
const unsigned char UNNUMBERED_POLL = 0x33;		  // Unnumbered Poll Frame
const unsigned char FRAME_FLAG1 = 0x7e;		// Frame beginning & ending flag
const unsigned char FRAME_FLAG2 = 0x7d;		// Frame begin and end flag mask
const unsigned char MASK_FRAME_7E = 0x5e;		// Mask to Eliminate flag 7E
const unsigned char MASK_FRAME_7D = 0x5d;		// Mask to Eliminate 7D
const unsigned char BROAD_ADDR = 0xff;			// Broadcast Address

const int BAD_CRC_IN_MESSAGE = 2;	// mask for detecting CRC error
const int BAD_ADDRESS_IN_MESSAGE = 4;	// mask for detecting address error
const int BAD_CONTROL_IN_MESSAGE = 8;	// mask for detecting control error
const int BAD_IPI_IN_MESSAGE = 16;
const long PPP_STATE_INITIAL=0;
const long PPP_STATE_STARTING=1;
const long PPP_STATE_CLOSED=2;
const long PPP_STATE_STOPPED=3;
const long PPP_STATE_CLOSING=4;
const long PPP_STATE_STOPPING=5;
const long PPP_STATE_REQUEST_SENT=6;
const long PPP_STATE_ACK_RECEIVED=7;
const long PPP_STATE_ACK_SENT=8;
const long PPP_STATE_OPENED=9;

const unsigned char PPP_LCP_CONFIGURE_REQUEST=0x01;
const unsigned char PPP_LCP_CONFIGURE_ACK=0x02;
const unsigned char PPP_LCP_CONFIGURE_NAK=0x03;
const unsigned char PPP_LCP_CONFIGURE_REJECT=0x04;
const unsigned char PPP_LCP_TERMINATE_REQUEST=0x05;
const unsigned char PPP_LCP_TERMINATE_ACK=0x06;
const unsigned char PPP_LCP_CODE_REJECT=0x07;
const unsigned char PPP_LCP_PROTOCOL_REJECT=0x08;
const unsigned char PPP_LCP_ECHO_REQUEST=0x09;
const unsigned char PPP_LCP_ECHO_REPLY=0x10;
const unsigned char PPP_LCP_DISCARD_REQUEST=0x11;

const long LCP_INVALID_CODE=-1;
const long END_OF_OPTION_LIST=-1;
const long LCP_CONFIGURE_REQUEST_OPTION_REJECT=1;
const long LCP_CONFIGURE_REQUEST_OPTION_FORCE_DEFAULT=2;
const long LCP_CONFIGURE_REQUEST_OPTION_ACCEPT=4;

const char PPP_OPTION_RESERVED=0;
const char PPP_OPTION_MAXIMUM_RECEIVE_UNIT=1;
const char PPP_OPTION_ASYNC_CONTROL_CHARACTER_MAP=2;
const char PPP_OPTION_AUTHENTICATION_PROTOCOL=3;
const char PPP_OPTION_QUALITY_PROTOCOL=4;
const char PPP_OPTION_MAGIC_NUMBER=5;
const char PPP_OPTION_PROTOCOL_FIELD_COMPRESSION=7;
const char PPP_OPTION_ADDRESS_AND_CONTROL_FIELD_COMPRESSION=8;
const char PPP_OPTION_FCS_ALTERNATIVE=9;
const char PPP_OPTION_SELF_DESCRIBING_PAD=10;
const char PPP_OPTION_NUMBERED_MODE=11;
const char PPP_OPTION_CALLBACK=13;
const char PPP_OPTION_MULTILINK_OPTIONS=16;

const long PPP_EVENT_NONE=0;
const long PPP_EVENT_UP=1;
const long PPP_EVENT_DOWN=2;
const long PPP_EVENT_OPEN=3;
const long PPP_EVENT_CLOSE=4;
const long PPP_EVENT_TO_PLUS=5;
const long PPP_EVENT_TO_MINUS=6;
const long PPP_EVENT_RECEIVE_CONFIGURE_REQUEST_PLUS=7;
const long PPP_EVENT_RECEIVE_CONFIGURE_REQUEST_MINUS_NAK=8;
const long PPP_EVENT_RECEIVE_CONFIGURE_REQUEST_MINUS_REJECT=21;
const long PPP_EVENT_RECEIVE_CONFIGURE_ACK=9;
const long PPP_EVENT_RECEIVE_CONFIGURE_NAK_REJ=10;
const long PPP_EVENT_RECEIVE_TERMINATION_REQUEST=11;
const long PPP_EVENT_RECEIVE_TERMINATE_ACK=12;
const long PPP_EVENT_RECEIVE_UNKNOWN_CODE=13;
const long PPP_EVENT_RECEIVE_CODE_REJECT_PLUS=14;
const long PPP_EVENT_RECEIVE_PROTOCOL_REJECT_PLUS=15;
const long PPP_EVENT_RECEIVE_CODE_REJECT_MINUS=16;
const long PPP_EVENT_RECEIVE_PROTOCOL_REJECT_MINUS=17;
const long PPP_EVENT_ECHO_REQUEST=18;
const long PPP_EVENT_ECHO_REPLY=19;
const long PPP_EVENT_DISCARD_REQUEST=20;

const long PPP_ACTION_NONE=0;
const long PPP_ACTION_THIS_LAYER_UP=1;
const long PPP_ACTION_THIS_LAYER_DOWN=2;
const long PPP_ACTION_THIS_LAYER_STARTED=4;
const long PPP_ACTION_THIS_LAYER_FINISHED=8;
const long PPP_ACTION_INITIALIZE_RESTART_COUNT=16;
const long PPP_ACTION_ZERO_RESTART_COUNT=32;
const long PPP_ACTION_SEND_CONFIGURE_REQUEST=64;
const long PPP_ACTION_SEND_CONFIGURE_ACK=128;
const long PPP_ACTION_SEND_CONFIGURE_NAK=256;
const long PPP_ACTION_SEND_TERMINATE_REQUEST=512;
const long PPP_ACTION_SEND_TERMINATE_ACK=1024;
const long PPP_ACTION_SEND_CODE_REJECT=2048;
const long PPP_ACTION_SEND_ECHO_REPLY=4096;
const long PPP_ACTION_SEND_CONFIGURE_REJECT=8192;

const long PPP_PHASE_DEAD=0;
const long PPP_PHASE_ESTABLISH=1;
const long PPP_PHASE_AUTHENTICATE=2;
const long PPP_PHASE_NETWORK=3;
const long PPP_PHASE_TERMINATE=4;

const long PPP_SEND_PACKET_RESPONSE=1;
const long PPP_SEND_PACKET_REQUEST=2;
const long PPP_SEND_TWO_PACKETS=4;

const long PPP_FLAG_LENGTH=1;
const long PPP_ADDRESS_LENGTH=1;
const long PPP_CONTROL_LENGTH=1;
const long PPP_PROTOCOL_LENGTH=2;
const long PPP_FCS_LENGTH=2;
const long PPP_OVERHEAD_LENGTH=PPP_FLAG_LENGTH+
								PPP_ADDRESS_LENGTH+
                                PPP_CONTROL_LENGTH+
                                PPP_PROTOCOL_LENGTH+
                                PPP_FCS_LENGTH+
                                PPP_FLAG_LENGTH;

const unsigned char PPP_ADDRESS_FIELD_VALUE=0xff;
const unsigned char PPP_CONTROL_FIELD_VALUE=0x03;
const long PPP_LINK_CONTROL_PROTOCOL=0xc021;
const long PPP_PASSWORD_AUTHENTICATION_PROTOCOL=0xc023;
const long PPP_LINK_QUALITY_REPORT=0xc025;
const long PPP_CHALLENGE_HANDSHAKE_AUTHENTICATION_PROTOCOL=0xc223;
const long NTCIP_PROTOCOL=0x21;
const unsigned char PPP_CONTROL_ESCAPE_SEQUENCE=0x7d;
const unsigned char PPP_FLAG=0x7E;

const unsigned long TIMEOUT_PLUS=1024;
const unsigned long TIMEOUT_MINUS=2048;

const long PPP_AUTO_EVENT_TIMEOUT=64;

const unsigned long RESTART_COUNTER_MAX_CONFIGURE=10;
const unsigned long RESTART_COUNTER_MAX_TERMINATE=10;

const unsigned long PPP_RESTART_TIMER_DEFAULT_VALUE=30000;        //should be 3000, set this way for testing
                        // must implement configuration option for restart timer as well

const long PPP_CHAP_NOT_ALLOWED=800;
const long PPP_CHAP_UNKNOWN_ACTION=801;
const long PPP_CHAP_AUTHENTICATION_FAILED=802;
const long PPP_CHAP_CHALLENGED=803;
const long PPP_CHAP_AUTHENTICATED=804;
const long PPP_CHAP_RESPONSE=805;

const unsigned char PPP_CHAP_CODE_CHALLENGE=0x01;
const unsigned char PPP_CHAP_CODE_RESPONSE=0x02;
const unsigned char PPP_CHAP_CODE_SUCCESS=0x03;
const unsigned char PPP_CHAP_CODE_FAILURE=0x04;

const unsigned char PMPP_CONTROL_FIELD_VALUE=0x13;
const unsigned char PMPP_FLAG=0x7e;
const unsigned char PMPP_CONTROL_ESCAPE_SEQUENCE=0x7d;

const long SEND_GET_RESPONSE=2;
const long SEND_GETNEXT_RESPONSE=4;
const long SEND_SET_RESPONSE=8;


#endif

⌨️ 快捷键说明

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