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

📄 eap_fsm.hxx

📁 Diameter协议栈
💻 HXX
📖 第 1 页 / 共 2 页
字号:
  /// typically called by methods.  inline void DeleteRxMessage() { SetRxMessage(0); }  /// Call this function to get the pointer to txMessage.  This  /// function is typically called by switches.  inline AAAMessageBlock* GetTxMessage() { return txMessage; }  /// Call this function to set the pointer to txMessage.  This  /// function is typically called by methods.  inline void SetTxMessage(AAAMessageBlock *p) {     if (txMessage) txMessage->release();     txMessage=p;   }  /// Call this function to delete txMessage.  This function is  /// typically called by methods.  inline void DeleteTxMessage() { SetTxMessage(0); }  /// Call this function to get the pointer to the identity of the EAP peer.  inline std::string& PeerIdentity() { return peerIdentity; }   /// Call this function to get the pointer to the identity of the EAP  /// authenticator.  inline std::string& AuthenticatorIdentity()   { return authenticatorIdentity; }   /// Call this function to check the availability of the key.  inline bool& KeyAvailable() { return keyAvailable; }    /// Call this function to retrieve the key.  inline std::string& KeyData() { return keyData; }     /// Call this function to check whether this is a tunneled session.  bool IsEapTunneled() { return eapTunneled; }  /// Call this function to get the pointer to policy.  inline EapPolicy& Policy(void) { return policy; }   /// Call this function to create a method state mechine in the  /// session.  void CreateMethodStateMachine(EapType t, EapRole role);  /// Call this function to delete the method state mechine in the  /// session.  void DeleteMethodStateMachine();  /// Call this function to get the pointer to method state machine.  inline EapMethodStateMachine& MethodStateMachine()   { return *methodStateMachine; }  /// Call this function to get the reference to receiving message queue.  EapMessageQueue& RxQueue() { return rxQueue; }  /// Use this function to obtain the reference to discardCount.  int& DiscardCount() { return discardCount; }  ACE_Reactor& Reactor() { return reactor; }protected:  EapSwitchStateMachine(ACE_Reactor &r, EapJobHandle &h) :     EapJobMultiplexor(h),    currentMethod(EapType(0)),    txMessage(0), rxMessage(0), eapTunneled(false),     methodStateMachine(0), discardCount(0), keyAvailable(false),    reactor(r)  {    keyData.resize(0);  }  virtual ~EapSwitchStateMachine()   {    DeleteMethodStateMachine();    DeleteRxMessage();    DeleteTxMessage();  }  /// This indicates the currently processed EAP Type.  EapType currentMethod;  /// This is used for passing an outgoing EAP message from methods to  /// the switch.  For peers, txMessage is equivalent to eapRespData  /// and lastRespData.  For authenticators, txMessage is equivalent  /// to eapReqData and lastReqData.  AAAMessageBlock *txMessage;  /// This is used for passing an incoming EAP message from the switch  /// to methods.  AAAMessageBlock *rxMessage;  /// This is used for queueing incoming EAP messages to process.  EapMessageQueue rxQueue;  /// This variable indicates the Identifier of the last valid Request  /// (for Peer) or the outstanding Request (for Authenticator).  ACE_Byte currentIdentifier;  /// This stores the Identity payload (e.g., username) of the EAP  /// peer.  The string may or may not be null-terminated.  When the  /// string is null-terminated, the terminating null charactor must  /// not be included in the Identity payload.  std::string peerIdentity;  /// This stores the Identity payload of the EAP authenticator.  The  /// string may or may not be null-terminated.  When the string is  /// null-terminated, the terminating null charactor must not be  /// included in the Identity payload.  std::string authenticatorIdentity;  /// This variable is set true if this session is created within  /// another session.  bool eapTunneled;  /// This is the policy used for the session.  EapPolicy policy;  /// This stores the pointer to a method state machine.  EapMethodStateMachine* methodStateMachine;  /// This variable is incremented when a received message is discarded.  int discardCount;  /// This variable indicates whether the key is available or not.  bool keyAvailable;  /// This variable stores the key.  std::string keyData;  ACE_Reactor &reactor;};class EapPeerSwitchStateMachine;class EapAuthSwitchStateMachine;/*! \page methodStateMachine Method State MachineA method state machine is an implementation of a particular EAPmethod.  A method state machine is created by a switch state machinewhen the authentication policy indicates that there is an EAPauthentication method that needs to be performed before an EAPauthentication result is obtained.  Method state machines areimplemented in class EapMethodStateMachine from which a distinct class is derived for handling each EAP method.When an EAP method is capable of deriving a key, the key is set tokeyData variable.  A zero-sized keyData means that the key is notavailable, otherwise the key is available.  The keyData size must beset to zero when (re)starting the EAP method.  The key data must notbe available until the method completes successfully.The following methods are defined in the library by default.- Identity (implemented in EapPeerIdentityStateMachine andEapAuthIdentityStateMachine classes)- Notification (implemented in EapPeerNotificationStateMachine andEapAuthNotificationStateMachine classes)- MD5-Challenge (implemented in EapPeerMD5ChallengeStateMachine andEapAuthMD5ChallengeStateMachine classes)Note that Nak is implemented in switch state machines.*//// The base class for method state machines.class EAP_EXPORTS EapMethodStateMachine{public:  virtual ~EapMethodStateMachine() {}  /// This pure virtual function is called when starting any method  /// state machine.  virtual void Start() throw(AAA_Error)=0;  /// This pure virtual function is called when scheduling a method  /// event.  virtual void Notify(AAA_Event)=0;  /// Call this function to check the availability of the key.  inline bool KeyAvailable() { return (keyData.size()>0); }    /// Call this function to retrieve the key.  inline std::string& KeyData() { return keyData; }     /// Call this function to obtain the job data.  inline AAA_JobData& JobData() { return switchStateMachine.JobData(); }  template <class T> inline T& JobData(Type2Type<T> t)   { return switchStateMachine.JobData(t); }  /// Call this function to check whether the method is done.  bool& IsDone() { return isDone; }  /// Call this function to get the pointer to method state machine.  inline EapSwitchStateMachine& SwitchStateMachine()   { return switchStateMachine; }  /// Override this function to implement differnet next identifier  /// allocation policies.  virtual ACE_Byte GetNextIdentifier(ACE_Byte id) { return id + 1; }  /// External event passed from switch.  enum event {    EvSgIntegrityCheck=-1, // Integrity check  };  /// Call this function to get the reference to peer switch state  /// machine.  inline EapPeerSwitchStateMachine& PeerSwitchStateMachine()   {     return (EapPeerSwitchStateMachine&)switchStateMachine;  }  /// Call this function to get the reference to authenticator switch  /// state machine.  inline EapAuthSwitchStateMachine& AuthSwitchStateMachine()   {     return (EapAuthSwitchStateMachine&)switchStateMachine;  }  template <class T>   inline T& SwitchStateMachine(Type2Type<T>)   { return (T&)switchStateMachine; }protected:  EapMethodStateMachine(EapSwitchStateMachine &s)    : switchStateMachine(s), isDone(false)  {    keyData.resize(0);  }  /// This contains the pointer to the switch state machine.  EapSwitchStateMachine& switchStateMachine;    /// This variable indicates whether the method is done.  It is the  /// responsibility of each EAP method implementation to set this  /// variable to an appropriate value when the method is done.  bool isDone;  /// This variable stores the key.  It is the  /// responsibility of each EAP method implementation to initialize  /// and set this variable.  std::string keyData; private:};#endif // __EAP_FSM_HXX__

⌨️ 快捷键说明

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