📄 aaa_session_auth_client_fsm.h
字号:
/* 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 */#ifndef __AAA_SESSION_AUTH_CLIENT_FSM_H__#define __AAA_SESSION_AUTH_CLIENT_FSM_H__#include "aaa_session_auth_fsm.h"class DIAMETERBASEPROTOCOL_EXPORT AAA_AuthSessionClientStateMachine : public AAA_AuthSessionStateMachine<AAA_AuthSessionClientStateMachine>{ public: AAA_AuthSessionClientStateMachine(AAA_Task &t, AAA_AuthSession &a); virtual ~AAA_AuthSessionClientStateMachine() { } void TxSTR(diameter_unsigned32_t cause); void TxASA(diameter_unsigned32_t rcode); void TxRAA(diameter_unsigned32_t rcode); void RxASR(AAAMessage &msg); void RxSTA(AAAMessage &msg); void RxRAR(AAAMessage &msg);};class AAA_SessAuthClient_TxSSAR : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { std::auto_ptr<AAAMessage> msg = fsm.PendingMsg(); fsm.Session().TxDelivery(msg); }};class AAA_SessAuthClient_TxSSAR_Discard : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { std::auto_ptr<AAAMessage> msg = fsm.PendingMsg(); AAA_LOG(LM_INFO, "(%P|%t) Message sent in invalid session state, discarding\n"); AAA_MsgDump::Dump(*msg); }};class AAA_SessAuthClient_RxSSA : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { std::auto_ptr<AAAMessage> msg = fsm.PendingMsg(); fsm.Session().RxDelivery(msg); }};class AAA_SessAuthClient_RxSSAA_Discard : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { std::auto_ptr<AAAMessage> msg = fsm.PendingMsg(); AAA_LOG(LM_INFO, "(%P|%t) Message received in invalid session state, discarding\n"); AAA_MsgDump::Dump(*msg); }};class AAA_SessAuthClient_RxSSAA_GrantAccess : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.CancelAllTimer(); if (fsm.Attributes().AuthSessionState()() == AAA_SESSION_STATE_MAINTAINED) { fsm.ScheduleTimer(AAA_SESSION_AUTH_EV_SESSION_TOUT_ST, fsm.Attributes().SessionTimeout()(), 0, AAA_TIMER_TYPE_SESSION); fsm.ScheduleTimer(AAA_SESSION_AUTH_EV_LIFETIME_TOUT, fsm.Attributes().AuthLifetime()() + fsm.Attributes().AuthGrace()(), 0, AAA_TIMER_TYPE_AUTH); } else { fsm.ScheduleTimer(AAA_SESSION_AUTH_EV_SESSION_TOUT_NOST, fsm.Attributes().SessionTimeout()(), 0, AAA_TIMER_TYPE_SESSION); } AAA_LOG(LM_INFO, "(%P|%t) Client session in open state\n"); AAA_LOG(LM_INFO, "(%P|%t) Session Timeout: %d\n", fsm.Attributes().SessionTimeout()()); AAA_LOG(LM_INFO, "(%P|%t) Auth Lifetime : %d\n", fsm.Attributes().AuthLifetime()()); AAA_LOG(LM_INFO, "(%P|%t) Grace Period : %d\n", fsm.Attributes().AuthGrace()()); fsm.Session().Success(); }};class AAA_SessAuthClient_RxRAR : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { diameter_unsigned32_t rcode = AAA_SUCCESS; if (fsm.Attributes().ReAuthRequestValue().IsSet()) { rcode = (diameter_unsigned32_t)fsm.Session().ReAuthenticate (fsm.Attributes().ReAuthRequestValue()().reAuthType); } fsm.TxRAA(rcode); }};class AAA_SessAuthClient_TxSTR_NoSvc : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.TxSTR(AAA_REALM_NOT_SERVED); }};class AAA_SessAuthClient_TxSTR_ProcError : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.TxSTR(AAA_AVP_UNSUPPORTED); }};class AAA_SessAuthClient_TxSTR_Fail : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.TxSTR(AAA_AUTHORIZATION_REJECTED); }};class AAA_SessAuthClient_SessionTimeout : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.CancelAllTimer(); fsm.Session().SessionTimeout(); fsm.Session().Reset(); }};class AAA_SessAuthClient_SessionTimeoutState : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.CancelAllTimer(); fsm.TxSTR(AAA_AUTHORIZATION_REJECTED); fsm.Session().SessionTimeout(); }};class AAA_SessAuthClient_AuthTimeout : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.CancelAllTimer(); fsm.TxSTR(AAA_AUTHORIZATION_REJECTED); fsm.Session().AuthorizationTimeout(); }};class AAA_SessAuthClient_UserAbort : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.CancelAllTimer(); fsm.TxSTR(AAA_AUTHORIZATION_REJECTED); }};class AAA_SessAuthClient_TxASA_Success : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.TxASA(AAA_SUCCESS); }};class AAA_SessAuthClient_TxASA_TxSTR_Success : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.TxASA(AAA_SUCCESS); fsm.TxSTR(AAA_SUCCESS); }};class AAA_SessAuthClient_TxASA_Fail : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) { fsm.TxASA(AAA_UNABLE_TO_COMPLY); }};class AAA_SessAuthClient_Disconnect : public AAA_Action<AAA_AuthSessionClientStateMachine> { public: virtual void operator()(AAA_AuthSessionClientStateMachine &fsm) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -