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

📄 diameter_nasreq_aareq_parser.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_nasreq_aareq_parser.cxx,v 1.7 2006/03/16 17:01:47 vfajardo Exp $ *//*    diameter_nasrq_aareq_parser.cxx   Diameter AA-Request Parser   Written by Yoshihiro Ohba   Created May 1, 2004*/#include "diameter_nasreq_parser.hxx"template<> void AA_RequestParser::parseAppToRaw(){  AA_RequestData &data = *getAppData();  AAAMessage &aaaMessage = *getRawData();  AAADictionaryManager dm;  AAAAvpContainerManager cm;  AAAAvpContainer *c;                            AAACommandCode code;  AAAApplicationId appId;  // Obtain Command Code and Application Identifier.  if (!dm.getCommandCode("AA-Request", &code, &appId))    {      AAA_LOG(LM_ERROR, "[%N] Cannot find message in dictionary\n.");      throw (DictionaryError);    }  // Specify the header.  hdr_flag flag = {1,1,0};  aaaMessage.hdr = AAADiameterHeader(1, 0, flag, code, appId, 0, 0);  if (data.AuthApplicationId.IsSet())    {      c = cm.acquire("Auth-Application-Id");      data.AuthApplicationId.CopyTo(*c, AAA_AVP_INTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.OriginHost.IsSet())    {      c = cm.acquire("Origin-Host");      data.OriginHost.CopyTo(*c, AAA_AVP_DIAMID_TYPE);      aaaMessage.acl.add(c);    }  if (data.OriginRealm.IsSet())    {      c = cm.acquire("Origin-Realm");      data.OriginRealm.CopyTo(*c, AAA_AVP_DIAMID_TYPE);      aaaMessage.acl.add(c);    }  if (data.DestinationRealm.IsSet())    {      c = cm.acquire("Destination-Realm");      data.DestinationRealm.CopyTo(*c, AAA_AVP_DIAMID_TYPE);      aaaMessage.acl.add(c);    }  if (data.AuthRequestType.IsSet())    {      c = cm.acquire("Auth-Request-Type");      data.AuthRequestType.CopyTo(*c, AAA_AVP_ENUM_TYPE);      aaaMessage.acl.add(c);    }  if (data.DestinationHost.IsSet())    {       c = cm.acquire("Destination-Host");      data.DestinationHost.CopyTo(*c, AAA_AVP_DIAMID_TYPE);      aaaMessage.acl.add(c);    }  if (data.NasIdentifier.IsSet())    {       c = cm.acquire("Nas-Identifier");      data.NasIdentifier.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.NasIpAddress.IsSet())    {       c = cm.acquire("Nas-IP-Address");      data.NasIpAddress.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.NasIpv6Address.IsSet())    {       c = cm.acquire("Nas-IPv6-Address");      data.NasIpv6Address.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.NasPort.IsSet())    {       c = cm.acquire("Nas-Port");      data.NasPort.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.NasPortId.IsSet())    {       c = cm.acquire("Nas-Port-Id");      data.NasPortId.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.NasPortType.IsSet())    {       c = cm.acquire("Nas-Port-Type");      data.NasPortType.CopyTo(*c, AAA_AVP_ENUM_TYPE);      aaaMessage.acl.add(c);    }  if (data.OriginStateId.IsSet())    {       c = cm.acquire("Origin-State-Id");      data.OriginStateId.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.PortLimit.IsSet())    {       c = cm.acquire("Port-Limit");      data.PortLimit.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.UserName.IsSet())    {       c = cm.acquire("User-Name");      data.UserName.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.UserPassword.IsSet())    {       c = cm.acquire("User-Password");      data.UserPassword.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.ServiceType.IsSet())    {       c = cm.acquire("Service-Type");      data.ServiceType.CopyTo(*c, AAA_AVP_ENUM_TYPE);      aaaMessage.acl.add(c);    }  if (data.State.IsSet())    {       c = cm.acquire("State");      data.State.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.AuthorizationLifetime.IsSet())    {       c = cm.acquire("Authorization-Lifetime");      data.AuthorizationLifetime.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.AuthGracePeriod.IsSet())    {       c = cm.acquire("Auth-Grace-Period");      data.AuthGracePeriod.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.AuthSessionState.IsSet())    {       c = cm.acquire("Auth-Session-State");      data.AuthSessionState.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.CallbackNumber.IsSet())    {       c = cm.acquire("Callback-Number");      data.CallbackNumber.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.CalledStationId.IsSet())    {       c = cm.acquire("Called-Station-Id");      data.CalledStationId.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.CallingStationId.IsSet())    {       c = cm.acquire("Calling-Station-Id");      data.CallingStationId.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.OriginatingLineInfo.IsSet())    {       c = cm.acquire("Originating-Line-Info");      data.OriginatingLineInfo.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.ConnectInfo.IsSet())    {       c = cm.acquire("Connect-Info");      data.ConnectInfo.CopyTo(*c, AAA_AVP_UTF8_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.ChapAuth.IsSet())    {      c = cm.acquire("CHAP-Auth");      data.ChapAuth.CopyTo(*c);      aaaMessage.acl.add(c);    }  if (data.ChapChallenge.IsSet())    {       c = cm.acquire("CHAP-Challenge");      data.ChapChallenge.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedCompression.IsSet())    {       c = cm.acquire("Framed-Compression");      data.FramedCompression.CopyTo(*c, AAA_AVP_ENUM_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedInterfaceId.IsSet())    {       c = cm.acquire("Framed-Interface-Id");      data.FramedInterfaceId.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedIpAddress.IsSet())    {       c = cm.acquire("Framed-IP-Address");      data.FramedIpAddress.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedIpv6Prefix.IsSet())    {      c = cm.acquire("Framed-IPv6-Prefix");      data.FramedIpv6Prefix.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedIpNetmask.IsSet())    {       c = cm.acquire("Framed-IP-Netmask");      data.FramedIpNetmask.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedMtu.IsSet())    {       c = cm.acquire("Framed-MTU");      data.FramedMtu.CopyTo(*c, AAA_AVP_UINTEGER32_TYPE);      aaaMessage.acl.add(c);    }  if (data.FramedProtocol.IsSet())    {       c = cm.acquire("Framed-Protocol");      data.FramedProtocol.CopyTo(*c, AAA_AVP_ENUM_TYPE);      aaaMessage.acl.add(c);    }  if (data.ArapPassword.IsSet())    {       c = cm.acquire("ARAP-Password");      data.ArapPassword.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }  if (data.ArapChallengeResponse.IsSet())    {       c = cm.acquire("ARAP-Challenge-Response");      data.ArapChallengeResponse.CopyTo(*c, AAA_AVP_STRING_TYPE);      aaaMessage.acl.add(c);    }

⌨️ 快捷键说明

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