📄 diameter_nasreq_parser.hxx
字号:
/* 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_nasreq_parser.hxx,v 1.5 2005/04/22 16:34:04 vfajardo Exp $ *//* diameter_nasreq_parser.hxx Parser Data Structure in Diameter NASREQ Application Written by Yoshihiro Ohba Created April 8, 2004.*/#ifndef __DIAMETER_NASREQ_PARSER_H__#define __DIAMETER_NASREQ_PARSER_H__#include <vector>#include "diameter_parser_api.h"const diameter_unsigned32_t NasreqApplicationId = 1;const AAACommandCode AA_CommandCode = 265;/// Definition for Tunneling AVP internal structure.class tunneling_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (TunnelType.IsSet()) { c = cm.acquire("Tunnel-Type"); TunnelType.CopyTo(*c, AAA_AVP_ENUM_TYPE); cl.add(c); } if (TunnelMediumType.IsSet()) { c = cm.acquire("Tunnel-Medium-Type"); TunnelMediumType.CopyTo(*c, AAA_AVP_ENUM_TYPE); cl.add(c); } if (TunnelClientEndpoint.IsSet()) { c = cm.acquire("Tunnel-Client-Endpoint"); TunnelClientEndpoint.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE); cl.add(c); } if (TunnelServerEndpoint.IsSet()) { c = cm.acquire("Tunnel-Server-Endpoint"); TunnelServerEndpoint.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE); cl.add(c); } if (TunnelPreference.IsSet()) { c = cm.acquire("Tunnel-Preference"); TunnelPreference.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (TunnelClientAuthId.IsSet()) { c = cm.acquire("Tunnel-Client-Auth-Id"); TunnelClientAuthId.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (TunnelServerAuthId.IsSet()) { c = cm.acquire("Tunnel-Server-Auth-Id"); TunnelServerAuthId.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE); cl.add(c); } if (TunnelPassword.IsSet()) { c = cm.acquire("Tunnel-Password"); TunnelPassword.CopyTo(*c, AAA_AVP_STRING_TYPE); cl.add(c); } if (TunnelPrivateGroupId.IsSet()) { c = cm.acquire("Tunnel-Private-Group-Id"); TunnelPrivateGroupId.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE); cl.add(c); } } void CopyFrom(AAAAvpContainerList &cl) { AAAAvpContainer *c; if ((c = cl.search("Tunnel-Type"))) { TunnelType.CopyFrom(*c); } if ((c = cl.search("Tunnel-Medium-Type"))) { TunnelMediumType.CopyFrom(*c); } if ((c = cl.search("Tunnel-Client-Endpoint"))) { TunnelClientEndpoint.CopyFrom(*c); } if ((c = cl.search("Tunnel-Server-Endpoint"))) { TunnelServerEndpoint.CopyFrom(*c); } if ((c = cl.search("Tunnel-Preference"))) { TunnelPreference.CopyFrom(*c); } if ((c = cl.search("Tunnel-Client-Auth-Id"))) { TunnelClientAuthId.CopyFrom(*c); } if ((c = cl.search("Tunnel-Server-Auth-Id"))) { TunnelServerAuthId.CopyFrom(*c); } if ((c = cl.search("Tunnel-Password"))) { TunnelPassword.CopyFrom(*c); } if ((c = cl.search("Tunnel-Private-Group-Id"))) { TunnelPrivateGroupId.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_enumerated_t> TunnelType; AAA_ScholarAttribute<diameter_enumerated_t> TunnelMediumType; AAA_ScholarAttribute<diameter_utf8string_t> TunnelClientEndpoint; AAA_ScholarAttribute<diameter_utf8string_t> TunnelServerEndpoint; // Optional AVPs AAA_ScholarAttribute<diameter_unsigned32_t> TunnelPreference; AAA_ScholarAttribute<diameter_unsigned32_t> TunnelClientAuthId; AAA_ScholarAttribute<diameter_unsigned32_t> TunnelServerAuthId; AAA_ScholarAttribute<diameter_octetstring_t> TunnelPassword; AAA_ScholarAttribute<diameter_utf8string_t> TunnelPrivateGroupId;};/// 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 CHAP-Auth AVP internal structure (the ABNF is/// defined in NASREQ document).class chap_auth_t{ public: void CopyTo(AAAAvpContainerList &cl) { AAAAvpContainerManager cm; AAAAvpContainer *c; if (ChapAlgorithm.IsSet()) { c = cm.acquire("CHAP-Algorithm"); ChapAlgorithm.CopyTo(*c, AAA_AVP_ENUM_TYPE); cl.add(c); } if (ChapIdent.IsSet()) { c = cm.acquire("CHAP-Ident"); ChapIdent.CopyTo(*c, AAA_AVP_STRING_TYPE); cl.add(c); } if (ChapResponse.IsSet()) { c = cm.acquire("CHAP-Response"); ChapResponse.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("CHAP-Algorithm"))) { ChapAlgorithm.CopyFrom(*c); } if ((c = cl.search("CHAP-Ident"))) { ChapIdent.CopyFrom(*c); } if ((c = cl.search("CHAP-Response"))) { ChapResponse.CopyFrom(*c); } if ((c = cl.search("AVP"))) { Avp.CopyFrom(*c); } } // Required AVPs AAA_ScholarAttribute<diameter_enumerated_t> ChapAlgorithm;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -