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

📄 diameter_eap_client_fsm.cxx

📁 Diameter协议栈
💻 CXX
📖 第 1 页 / 共 2 页
字号:
/* BEGIN_COPYRIGHT                                                        *//*                                                                        *//* Open Diameter: Open-source software for the Diameter and               *//*                Diameter related protocols                              *//*                                                                        *//* Copyright (C) 2002-2004 Open Diameter Project                          *//*                                                                        *//* This library is free software; you can redistribute it and/or modify   *//* it under the terms of the GNU Lesser General Public License as         *//* published by the Free Software Foundation; either version 2.1 of the   *//* License, or (at your option) any later version.                        *//*                                                                        *//* This library is distributed in the hope that it will be useful,        *//* but WITHOUT ANY WARRANTY; without even the implied warranty of         *//* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU      *//* Lesser General Public License for more details.                        *//*                                                                        *//* You should have received a copy of the GNU Lesser General Public       *//* License along with this library; if not, write to the Free Software    *//* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307    *//* USA.                                                                   *//*                                                                        *//* In addition, when you copy and redistribute some or the entire part of *//* the source code of this software with or without modification, you     *//* MUST include this copyright notice in each copy.                       *//*                                                                        *//* If you make any changes that are appeared to be useful, please send    *//* sources that include the changed part to                               *//* diameter-developers@lists.sourceforge.net so that we can reflect your  *//* changes to one unified version of this software.                       *//*                                                                        *//* END_COPYRIGHT                                                          */// $Id: diameter_eap_client_fsm.cxx,v 1.17 2004/08/16 16:17:25 vfajardo Exp $// diameter_eap_client_fsm.cxx:  EAP session handling// Written by Yoshihiro Ohba#include <ace/Singleton.h>#include <ace/Atomic_Op_T.h>#include "diameter_eap_client_session.hxx"#include "diameter_eap_client_fsm.hxx"#include "diameter_eap_parser.hxx"class DiameterEapClientAction   : public AAA_Action<DiameterEapClientStateMachine>{  virtual void operator()(DiameterEapClientStateMachine&)=0; protected:  DiameterEapClientAction() {}  ~DiameterEapClientAction() {}};/// State table used by DiameterEapClientStateMachine.class DiameterEapClientStateTable_S   : public AAA_StateTable<DiameterEapClientStateMachine>{  friend class   ACE_Singleton<DiameterEapClientStateTable_S, ACE_Recursive_Thread_Mutex>; private:  class AcSendEapRequest : public DiameterEapClientAction   {    void operator()(DiameterEapClientStateMachine& sm)    {      DiameterEapClientSession& session = sm.Session();      AAA_LOG(LM_DEBUG, "[%N] forwarding EAP Request to passthrough.\n");      session.SignalContinue(sm.DEA().EapPayload());      // Multi round timeout value is applied per EAP Request.      DEA_Data& dea = sm.DEA();      if (dea.MultiRoundTimeOut.IsSet())	sm.EnforceMultiRoundTimeOut(dea.MultiRoundTimeOut());    }  };  class AcSendDER : public DiameterEapClientAction   {    void operator()(DiameterEapClientStateMachine& sm)     {       ACE_DEBUG((LM_DEBUG, "[%N] sending DER.\n"));      DER_Data& der = sm.DER();      // Generate authorization AVPs.      sm.SetDestinationRealm(der.DestinationRealm);      if (!der.DestinationRealm.IsSet())	{	  AAA_LOG(LM_ERROR, "Failed to set destination realm.\n");	  sm.Event(DiameterEapClientStateMachine::EvSgDisconnect);	  return;	}      sm.SetAuthRequestType(der.AuthRequestType);      if (!der.AuthRequestType.IsSet())	{	  AAA_LOG(LM_ERROR, "Failed to set auth request type.\n");	  sm.Event(DiameterEapClientStateMachine::EvSgDisconnect);	  return;	}      sm.SetNasPort(der.NasPort);      sm.SetNasPortId(der.NasPortId);      sm.SetOriginStateId(der.OriginStateId);      sm.SetNasIdentifier(der.NasIdentifier);      sm.SetNasIpAddress(der.NasIpAddress);      sm.SetNasIpv6Address(der.NasIpv6Address);      sm.SetDestinationHost(der.DestinationHost);      sm.SetUserName(der.UserName);      sm.SetServiceType(der.ServiceType);      sm.SetIdleTimeout(der.IdleTimeout);      sm.SetState(der.State);      sm.SetAuthorizationLifetime(der.AuthorizationLifetime);      sm.SetAuthGracePeriod(der.AuthGracePeriod);      sm.SetAuthSessionState(der.AuthSessionState);      sm.SetSessionTimeout(der.SessionTimeout);      sm.SetClass(der.Class);      sm.SetPortLimit(der.PortLimit);      sm.SetCallbackNumber(der.CallbackNumber);      sm.SetCalledStationId(der.CalledStationId);      sm.SetCallingStationId(der.CallingStationId);      sm.SetOriginatingLineInfo(der.OriginatingLineInfo);      sm.SetConnectInfo(der.ConnectInfo);      sm.SetFramedCompression(der.FramedCompression);      sm.SetFramedInterfaceId(der.FramedInterfaceId);      sm.SetFramedIpAddress(der.FramedIpAddress);      sm.SetFramedIpv6Prefix(der.FramedIpv6Prefix);      sm.SetFramedIpNetmask(der.FramedIpNetmask);      sm.SetFramedMtu(der.FramedMtu);      sm.SetFramedProtocol(der.FramedProtocol);      sm.SetTunneling(der.Tunneling);      sm.SendDER();     }  };  class AcCheckDEA_ResultCode : public DiameterEapClientAction   {    void operator()(DiameterEapClientStateMachine& sm)    {      AAAResultCode resultCode = sm.DEA().ResultCode();      switch (resultCode)	{	case AAA_SUCCESS :	  AAA_LOG(LM_DEBUG, "[%N] AAA_SUCCESS received.\n");	  if (sm.DER().AuthRequestType == 	      AUTH_REQUEST_TYPE_AUTHORIZE_AUTHENTICATE)	    sm.Event(DiameterEapClientStateTable_S::EvSgSuccess);	  else	    sm.Event(DiameterEapClientStateTable_S::EvSgLimitedSuccess);	  break;	case AAA_MULTI_ROUND_AUTH :	  AAA_LOG(LM_DEBUG, "[%N] AAA_MULTI_ROUND_AUTH received.\n");	  sm.Event(DiameterEapClientStateTable_S::EvSgContinue);	  break;	default:	  AAA_LOG(LM_DEBUG, "[%N] Error was received.\n");	  AAA_LOG(LM_DEBUG, "[%N]   Result-Code=%d.\n", resultCode);	  sm.Event(DiameterEapClientStateTable_S::EvSgFailure);	  break;	}    }  };  class AcCheckAA_AnswerResultCode : public DiameterEapClientAction   {    void operator()(DiameterEapClientStateMachine& sm)    {      AAAResultCode resultCode = sm.DEA().ResultCode();      switch (resultCode)	{	case AAA_SUCCESS :	  AAA_LOG(LM_DEBUG, "[%N] AAA_SUCCESS received.\n");	  sm.Event(DiameterEapClientStateTable_S::EvSgSuccess);	  break;	case AAA_AUTHORIZATION_REJECTED :	  AAA_LOG(LM_DEBUG, 		       "[%N] AAA_AUTHORIZATION_REJECTED received.\n");	  sm.Event(DiameterEapClientStateTable_S::EvSgFailure);	  break;	default:	  AAA_LOG(LM_DEBUG, "[%N] Error was received.\n");	  AAA_LOG(LM_DEBUG, "[%N]   Result-Code=%d.\n", resultCode);	  sm.Event(DiameterEapClientStateTable_S::EvSgFailure);	  break;	}    }  };  class AcAccessAccept : public DiameterEapClientAction   {    void operator()(DiameterEapClientStateMachine& sm)    {      DiameterEapClientSession& session = sm.Session();      DEA_Data& dea = sm.DEA();      DER_Data& der = sm.DER();      sm.SignalSuccess(dea.EapPayload());      session.Update(AAASession::EVENT_AUTH_SUCCESS);        // Enforce authorization data.      if (dea.Class.IsSet())	{	  der.Class = dea.Class;	  sm.EnforceClass(dea.Class);	}      if (dea.AcctInterimInterval.IsSet())	sm.EnforceAcctInterimInterval(dea.AcctInterimInterval());      if (dea.ServiceType.IsSet())	{	  der.ServiceType = dea.ServiceType();	  sm.EnforceServiceType(dea.ServiceType());	}      if (dea.IdleTimeout.IsSet())	sm.EnforceIdleTimeout(dea.IdleTimeout());      if (dea.AuthorizationLifetime.IsSet())	sm.EnforceAuthorizationLifetime(dea.AuthorizationLifetime());      if (dea.AuthGracePeriod.IsSet())	sm.EnforceAuthGracePeriod(dea.AuthGracePeriod());      if (dea.AuthSessionState.IsSet())	sm.EnforceAuthSessionState(dea.AuthSessionState());      if (dea.ReAuthRequestType.IsSet())	sm.EnforceReAuthRequestType(dea.ReAuthRequestType());      if (dea.SessionTimeout.IsSet())	sm.EnforceSessionTimeout(dea.SessionTimeout());      if (dea.State.IsSet())	der.State = dea.State();      if (dea.FilterId.IsSet())	sm.EnforceFilterId(dea.FilterId);      if (dea.PortLimit.IsSet())	{

⌨️ 快捷键说明

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