📄 aaa_application.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_APPLICATION_H__#define __AAA_APPLICATION_H__#include "framework.h"#include "aaa_session_server.h"#include "aaa_session_msg_rx.h"#include "aaa_peer_interface.h"// An application identifies itself to the diameter class library by// an instance of the application core. All other classes are services// that operates using an instance of the core. class DIAMETERBASEPROTOCOL_EXPORT AAA_Application : public AAA_JobData{ private: // General Timer hanlders class ReTransmissionTimerHandler : public ACE_Event_Handler { public: int handle_timeout(const ACE_Time_Value &tv, const void *arg) { AAA_MSG_ROUTER()->ReTransmitEvent(); return (0); } long &Handle() { return m_TimerHandle; } private: long m_TimerHandle; }; public: AAA_Application(AAA_Task &task, char *cfgfile = NULL) : m_Task(task) { if (cfgfile) { Open(cfgfile); } } ~AAA_Application() { Close(); } // Config file loading/un-loading AAAReturnCode Open(char *cfgfile); AAAReturnCode Close(); // Check for active peers int NumActivePeers() { return AAA_PeerConnector::GetNumOpenPeers(); } // Factory Registration AAAReturnCode RegisterServerSessionFactory (AAA_ServerSessionFactory &factory) { return m_SessionMsgRx.SessionFactoryMap().Add(factory) ? AAA_ERR_SUCCESS : AAA_ERR_FAILURE; } // Factory de-registration AAAReturnCode RemoveServerSessionFactory (diameter_unsigned32_t appId) { return m_SessionMsgRx.SessionFactoryMap().Remove(appId) ? AAA_ERR_SUCCESS : AAA_ERR_FAILURE; } // Proxy Handler Registration AAAReturnCode RegisterProxyHandler (AAA_ProxyHandler &handler) { return m_SessionMsgRx.ProxyHandlerMap().Add(handler) ? AAA_ERR_SUCCESS : AAA_ERR_FAILURE; } // Proxy Handler De-Registration AAAReturnCode RemoveProxyHandler (diameter_unsigned32_t appId) { return m_SessionMsgRx.ProxyHandlerMap().Remove(appId) ? AAA_ERR_SUCCESS : AAA_ERR_FAILURE; } // Framework task AAA_Task& Task() { return m_Task; } private: // Global Classes AAA_Task &m_Task; AAA_PeerAcceptor m_PeerAcceptor; AAA_SessionMsgRx m_SessionMsgRx; AAA_IO_SigMask m_IOSigMask; ReTransmissionTimerHandler m_ReTxHandler; };#endif // __AAA_APPLICATION_H__
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -