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

📄 error_state.h

📁 基于单片机的 snmp协议解析的一些原代码 给有用的 同行
💻 H
字号:
#ifndef ERROR_STATE_H
#define ERROR_STATE_H
//-----------------------------------------------------------------
//
//-----------------------------------------------------------------
//#include <string>
const int PROTOCOL_ERROR=1;
const int DECODE_ERROR=2;
const int DATA_LINK_ERROR=4;
const int STATUS_ERROR=8;

const int ERROR_PROTOCOL_MISMATCH=1;
const int ERROR_PROTOCOL_INVALID_RESPONSE=2;

const int ERROR_NO_RESPONSE=16;

const int ERROR_DECODE_ENCODING_STYLE=32;
const int ERROR_DECODE_NO_INSTANCE=64;
const int ERROR_DECODE_OBJECT_MISMATCH=128;

const int ERROR_DATA_INVALID_SEQUENCE=1024;
const int ERROR_DATA_INVALID_LENGTH=2048;
const int ERROR_DATA_SCRAMBLED=4096;
const int ERROR_DATA_INVALID_ADDRESS=8192;
const int ERROR_DATA_INVALID_CONTROL=16384;
const int ERROR_DATA_INVALID_CRC=32768;
const int ERROR_DATA_INVALID_IPI=65536;

 /**# :[Description = "The error status for a given request.  There is a single instantiation of Error_State for each instantiation of Message_Content."] */ 

class Error_State
{
public:
	Error_State(bool saveResponse, unsigned long id);
	Error_State(bool saveResponse, unsigned long id, Error_State *ptr);
   ~Error_State();
	void SetNoResponseFlag();
	long GetErrorState(unsigned long id);
	long GetErrorState();
	void ResetErrors();
	void SetProtocolError(long error);
	void SetDecodeError(long error);
   void SetDataLinkError(long error);
   void SetSNMPErrors(unsigned long id, long status, long index);
	long GetSNMPErrors(unsigned long id, long *status, long *index);
   void SetError(unsigned long id, long type, long error);
	bool GetSaveState();
	void AddRequest(bool saveResponse, unsigned long id);
   void SetPrevious(Error_State *ptr);
   void SetNext(Error_State *ptr);
   void SetValid(unsigned long id);
	Error_State* GetErrorPtr(unsigned long theRequestID);
	unsigned long GetRequestID();
	Error_State* GetNext();
	void SetValue(unsigned long id, string *theValue);
	int GetValue(unsigned long id, string *theValue);
//   void SetOIDMatchFlag(bool theFlag);
private :
	/**# :[Description = "The SNMP error status of the response."] */ 
	long ErrorStatus;  // SNMP error status
   /**# :[Description = "The SNMP error index of the response."] */ 
	long ErrorIndex;
	/**# :[Description = "Protocol level error status of the response."] */ 
	long ProtocolError;
	/**# :[Description = "Decoding errors associated with the response."] */ 
	long DecodeError;
   /**# :[Description = "Problems associated with the decoding status of the response."] */ 
	long DataLinkError;
	/**# :[Description = "Whether or not a response has been received for the request."] */ 
	bool NoResponseFlag;
	/**# :[Description = "Pointer to next Error_State"] */ 
	Error_State * Next;
   /**# :[Description = "Pointer to previous Error_State"] */ 
	Error_State * Previous;
	/**# :[Description = "Request ID matching the one in Message_Content."] */ 
	unsigned long RequestID;
	string value;
	/**# :[Description = "Whether or not to maintain the Error_State once the request is deleted.  Most useful for the Macro language, which needs the Error_State."] */ 
	bool SaveState;
   /**# :[Description = "Whether or not the Error_State is yet valid; generally, after the timeout period or a response received, whichever comes first."] */ 
	bool Valid;
	/**# :[Description = "Object Value encoded in the response."] */ 
	string Value;
//   bool OIDMatchFlag;
};
#endif

⌨️ 快捷键说明

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