📄 diameter_eap_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_eap_parser.hxx,v 1.13 2005/04/22 16:34:04 vfajardo Exp $ *//* diameter_eap_parser.hxx Parser Data Structure in Diameter EAP Application Written by Yoshihiro Ohba Created December 5, 2003.*/#ifndef __DIAMETER_EAP_PARSER_H__#define __DIAMETER_EAP_PARSER_H__#include <vector>#include "diameter_parser_api.h"#include "diameter_nasreq_parser.hxx"const diameter_unsigned32_t EapApplicationId = 2000;const AAACommandCode EapCommandCode = 268;#if 0/// 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;};#endif/// Definition for DER message contents internal structure.class DER_Data{ public: DER_Data() { EapPayload.Set(std::string()); } void Clear() { SessionId.Clear(); AuthApplicationId.Clear(); OriginHost.Clear(); OriginRealm.Clear(); DestinationRealm.Clear(); AuthRequestType.Clear(); NasPort.Clear(); NasPortId.Clear(); OriginStateId.Clear(); DestinationHost.Clear(); NasIdentifier.Clear(); NasIpAddress.Clear(); NasIpv6Address.Clear(); NasPortType.Clear(); PortLimit.Clear(); UserName.Clear(); EapPayload.Clear(); ServiceType.Clear(); IdleTimeout.Clear(); State.Clear(); AuthorizationLifetime.Clear(); AuthGracePeriod.Clear(); AuthSessionState.Clear(); SessionTimeout.Clear(); CallbackNumber.Clear(); CalledStationId.Clear(); CallingStationId.Clear(); Class.Clear(); OriginatingLineInfo.Clear(); ConnectInfo.Clear(); FramedCompression.Clear(); FramedInterfaceId.Clear(); FramedIpAddress.Clear(); FramedIpv6Prefix.Clear(); FramedIpNetmask.Clear(); FramedMtu.Clear(); FramedProtocol.Clear(); Tunneling.Clear(); ProxyInfo.Clear(); RouteRecord.Clear(); Avp.Clear(); } /// DER AVPs AAA_ScholarAttribute<diameter_utf8string_t> SessionId; AAA_ScholarAttribute<diameter_unsigned32_t> AuthApplicationId; AAA_ScholarAttribute<diameter_identity_t> OriginHost; AAA_ScholarAttribute<diameter_identity_t> OriginRealm; AAA_ScholarAttribute<diameter_identity_t> DestinationRealm; /* In RFC3588: "8.7. Auth-Request-Type AVP The Auth-Request-Type AVP (AVP Code 274) is of type Enumerated and is included in application-specific auth requests to inform the peers whether a user is to be authenticated only, authorized only or both. Note any value other than both MAY cause RADIUS interoperability issues. The following values are defined: AUTHENTICATE_ONLY 1 The request being sent is for authentication only, and MUST contain the relevant application specific authentication AVPs that are needed by the Diameter server to authenticate the user. AUTHORIZE_ONLY 2 The request being sent is for authorization only, and MUST contain the application specific authorization AVPs that are necessary to identify the service being requested/offered. AUTHORIZE_AUTHENTICATE 3 The request contains a request for both authentication and authorization. The request MUST include both the relevant application specific authentication information, and authorization information necessary to identify the service being requested/offered." */ AAA_ScholarAttribute<diameter_enumerated_t> AuthRequestType; AAA_ScholarAttribute<diameter_unsigned32_t> NasPort; AAA_ScholarAttribute<diameter_utf8string_t> NasPortId; AAA_ScholarAttribute<diameter_unsigned32_t> OriginStateId; AAA_ScholarAttribute<diameter_identity_t> DestinationHost; AAA_ScholarAttribute<diameter_utf8string_t> NasIdentifier; AAA_ScholarAttribute<diameter_octetstring_t> NasIpAddress; AAA_ScholarAttribute<diameter_octetstring_t> NasIpv6Address; AAA_ScholarAttribute<diameter_enumerated_t> NasPortType; /* In draft-ietf-aaa-diameter-nasreq-13.txt: "6.5. Port-Limit AVP The Port-Limit AVP (AVP Code 62) is of type Unsigned32 and sets the maximum number of ports to be provided to the user by the NAS. It MAY be used in an authentication and/or authorization request as a hint to the server that multilink PPP [PPPMP] service is desired, but the server is not required to honor the hint in the corresponding response." */ AAA_ScholarAttribute<diameter_unsigned32_t> PortLimit; AAA_ScholarAttribute<diameter_utf8string_t> UserName; AAA_ScholarAttribute<diameter_octetstring_t> EapPayload; /* In RFC2865: "5.6. Service-Type Description This Attribute indicates the type of service the user has requested, or the type of service to be provided. It MAY be used in both Access-Request and Access-Accept packets. A NAS is not required to implement all of these service types, and MUST treat unknown or unsupported Service-Types as though an Access-Reject had been received instead." Value The Value field is four octets. 1 Login 2 Framed 3 Callback Login 4 Callback Framed 5 Outbound 6 Administrative 7 NAS Prompt 8 Authenticate Only 9 Callback NAS Prompt 10 Call Check 11 Callback Administrative */ AAA_ScholarAttribute<diameter_enumerated_t> ServiceType; AAA_ScholarAttribute<diameter_unsigned32_t> IdleTimeout; /* In Section 5.24 of RFC 2865: "5.24. State Description
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -