📄 diameter_mip4_parser.hxx
字号:
/* BEGIN_COPYRIGHT *//* *//* OpenDiameter: Open-source software for the Diameter protocol *//* *//* 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 *//* diameter_mip4_parser.hxx Parser Data Structure in Diameter MIP Application Written by Miriam Tauil Created May 25, 2004.*/#ifndef __DIAMETER_MIP4_PARSER_H__#define __DIAMETER_MIP4_PARSER_H__#include <vector>#include "diameter_parser_api.h"/*! * Windows specific export declarations */#ifdef WIN32 #if defined(DIAMETER_MIP4_PARSER_EXPORT) #define DIAMETER_MIP4_PARSER_EXPORTS __declspec(dllexport) #else #define DIAMETER_MIP4_PARSER_EXPORTS __declspec(dllimport) #endif#else #define DIAMETER_MIP4_PARSER_EXPORTS #define DIAMETER_MIP4_PARSER_EXPORTS#endif#define PRINT_MSG_CONTENT // for debugging informationconst diameter_unsigned32_t Mip4ApplicationId = 2;const AAACommandCode MipAmrCommandCode = 260;const AAACommandCode MipHarCommandCode = 262;/// Definition for MIP-MN-AAA-Auth-Info AVP internal structure.class mip_mn_aaa_auth_info_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (MipMnAaaSpi.IsSet()) { c = cm.acquire("MIP-MN-AAA-SPI"); MipMnAaaSpi.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (MipAuthInputDataLength.IsSet()) { c = cm.acquire("MIP-Auth-Input-Data-Length"); MipAuthInputDataLength.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (MipAuthenticatorLength.IsSet()) { c = cm.acquire("MIP-Authenticator-Length"); MipAuthenticatorLength.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (MipAuthenticatorOffset.IsSet()) { c = cm.acquire("MIP-Authenticator-Offset"); MipAuthenticatorOffset.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } } void CopyFrom(AAAAvpContainerList &cl) { AAAAvpContainer *c; if ((c = cl.search("MIP-MN-AAA-SPI"))) { MipMnAaaSpi.CopyFrom(*c); } if ((c = cl.search("MIP-Auth-Input-Data-Length"))) { MipAuthInputDataLength.CopyFrom(*c); } if ((c = cl.search("MIP-Authenticator-Length"))) { MipAuthenticatorLength.CopyFrom(*c); } if ((c = cl.search("MIP-Authenticator-Offset"))) { MipAuthenticatorOffset.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_unsigned32_t> MipMnAaaSpi; AAA_ScholarAttribute<diameter_unsigned32_t> MipAuthInputDataLength; AAA_ScholarAttribute<diameter_unsigned32_t> MipAuthenticatorLength; AAA_ScholarAttribute<diameter_unsigned32_t> MipAuthenticatorOffset;};/// Definition for MIP-Originating-Foreign-AAA-Info AVP internal structure.class mip_originating_foreign_aaa_info_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (OriginRealm.IsSet()) { c = cm.acquire("Origin-Realm"); OriginRealm.CopyTo(*c, AAA_AVP_DIAMID_TYPE); cl.add(c); } if (OriginHost.IsSet()) { c = cm.acquire("Origin-Host"); OriginHost.CopyTo(*c, AAA_AVP_DIAMID_TYPE); cl.add(c); } if (Avp.IsSet()) { c = cm.acquire("AVP"); Avp.CopyTo(*c, AAA_AVP_CUSTOM_TYPE); cl.add(c); } } void CopyFrom(AAAAvpContainerList &cl) { AAAAvpContainer *c; if ((c = cl.search("Origin-Realm"))) { OriginRealm.CopyFrom(*c); } if ((c = cl.search("Origin-Host"))) { OriginHost.CopyFrom(*c); } if ((c = cl.search("AVP"))) { Avp.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_unsigned32_t> OriginRealm; AAA_ScholarAttribute<diameter_unsigned32_t> OriginHost; // Optional AVPs AAA_VectorAttribute<avp_t> Avp;};/// Definition for MIP-Home-Agent-Host-Info AVP internal structure.class mip_home_agent_host_info_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (DestinationRealm.IsSet()) { c = cm.acquire("Destination-Realm"); DestinationRealm.CopyTo(*c, AAA_AVP_DIAMID_TYPE); cl.add(c); } if (DestinationHost.IsSet()) { c = cm.acquire("Destination-Host"); DestinationHost.CopyTo(*c, AAA_AVP_DIAMID_TYPE); cl.add(c); } if (Avp.IsSet()) { c = cm.acquire("AVP"); Avp.CopyTo(*c, AAA_AVP_CUSTOM_TYPE); cl.add(c); } } void CopyFrom(AAAAvpContainerList &cl) { AAAAvpContainer *c; if ((c = cl.search("Destination-Realm"))) { DestinationRealm.CopyFrom(*c); } if ((c = cl.search("Destination-Host"))) { DestinationHost.CopyFrom(*c); } if ((c = cl.search("AVP"))) { Avp.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_unsigned32_t> DestinationRealm; AAA_ScholarAttribute<diameter_unsigned32_t> DestinationHost; // Optional AVPs AAA_VectorAttribute<avp_t> Avp;};/// Definition for Proxy-Info AVP internal structure.class proxyinfo_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (ProxyHost.IsSet()) { c = cm.acquire("Proxy-Host"); ProxyHost.CopyTo(*c, AAA_AVP_DIAMID_TYPE); cl.add(c); } if (ProxyState.IsSet()) { c = cm.acquire("Proxy-State"); ProxyState.CopyTo(*c, AAA_AVP_STRING_TYPE); cl.add(c); } if (Avp.IsSet()) { c = cm.acquire("AVP"); Avp.CopyTo(*c, AAA_AVP_CUSTOM_TYPE); cl.add(c); } } void CopyFrom(AAAAvpContainerList &cl) { AAAAvpContainer *c; if ((c = cl.search("Proxy-Host"))) { ProxyHost.CopyFrom(*c); } if ((c = cl.search("Proxy-State"))) { ProxyState.CopyFrom(*c); } if ((c = cl.search("AVP"))) { Avp.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_identity_t> ProxyHost; AAA_ScholarAttribute<diameter_octetstring_t> ProxyState; // Optional AVPs AAA_VectorAttribute<avp_t> Avp;};/// Definition for AMR message contents internal structure.////// Definitions of classes for AMA /////////// Definition for MIP-MN-to-FA-MSA-Info AVP internal structure.class mip_mn_to_fa_msa_info_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (MipAlgorithmType.IsSet()) { c = cm.acquire("MIP-Algorithm-Type"); MipAlgorithmType.CopyTo(*c, AAA_AVP_ENUM_TYPE); cl.add(c); } if (MipNonce.IsSet()) { c = cm.acquire("MIP-Nonce"); MipNonce.CopyTo(*c, AAA_AVP_STRING_TYPE); cl.add(c); } if (MipMnAaaSpi.IsSet()) { c = cm.acquire("MIP-MN-AAA-SPI"); MipMnAaaSpi.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (Avp.IsSet()) { c = cm.acquire("AVP"); Avp.CopyTo(*c, AAA_AVP_CUSTOM_TYPE); cl.add(c); } } void CopyFrom(AAAAvpContainerList &cl) { AAAAvpContainer *c; if ((c = cl.search("MIP-Algorithm-Type"))) { MipAlgorithmType.CopyFrom(*c); } if ((c = cl.search("MIP-Nonce"))) { MipNonce.CopyFrom(*c); } if ((c = cl.search("MIP-MN-AAA-SPI"))) { MipMnAaaSpi.CopyFrom(*c); } if ((c = cl.search("AVP"))) { Avp.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_enumerated_t> MipAlgorithmType; AAA_ScholarAttribute<diameter_octetstring_t> MipNonce; AAA_ScholarAttribute<diameter_unsigned32_t> MipMnAaaSpi; // Optional AVPs AAA_VectorAttribute<avp_t> Avp;};// Definition for MIP-MN-to-HA-MSA-Info AVP internal structure.class mip_mn_to_ha_msa_info_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (MipAlgorithmType.IsSet()) { c = cm.acquire("MIP-Algorithm-Type"); MipAlgorithmType.CopyTo(*c, AAA_AVP_ENUM_TYPE); cl.add(c); } if (MipReplayMode.IsSet()) { c = cm.acquire("MIP-Replay-Mode"); MipReplayMode.CopyTo(*c, AAA_AVP_ENUM_TYPE); cl.add(c); } if (MipNonce.IsSet()) { c = cm.acquire("MIP-Nonce");
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -