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

📄 chap.h

📁 基于单片机的 snmp协议解析的一些原代码 给有用的 同行
💻 H
字号:
//---------------------------------------------------------------------------
#ifndef chapH
#define chapH
//#include <string>
#include "md5.h"
//---------------------------------------------------------------------------
enum Authenticate_State {AUTHENTICATED, CHALLENGING, BEING_CHALLENGED, INSECURE};
class CHAP
{
	public:
    	CHAP();
        ~CHAP();
    	void SetSecret(string theSecret);
        void GetSecret(string &theSecret);
        unsigned char GetIdentifier();
        long DecodeCHAP();
        Authenticate_State GetAuthenticateState();

    	void FillCHAP(string &data);
        void AssignChallenge();
        void AssignChallengeResponse(CHAP challengeCHAP);
        void AssignSuccess(CHAP receivedCHAP);
        void AssignFailure(CHAP receivedCHAP);

        long DetermineSuccessFailure(CHAP sentCHAP);

        void GetResponseValue(string &theValue);
        long GetPacket(string &packet);
        void SetPacketTime();
        unsigned long GetPacketTime();
        void SetChallengeValue();
        void GetChallengeValue(string &theChallengeValue);
        void SetName(string theName);
        void GetName(string &theName);

        void Test();

        string GetHash(const char *theHash, unsigned int len);
        long GetLength();
        
    private:
    	unsigned char code;
        unsigned short length;
		string data;
        unsigned char identifier;

        static unsigned char identifierCounter;

    	string secret;
    	string challengeValue;
        string name;

        unsigned long timeOfPacket;

        unsigned char hash[16];
		Authenticate_State	authState; //overall authentication state
};
unsigned char CHAP::identifierCounter=0;
#endif

⌨️ 快捷键说明

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