00001 /* BEGIN_COPYRIGHT */ 00002 /* */ 00003 /* OpenDiameter: Open-source software for the Diameter protocol */ 00004 /* */ 00005 /* Copyright (C) 2004 Open Diameter Project */ 00006 /* */ 00007 /* This library is free software; you can redistribute it and/or modify */ 00008 /* it under the terms of the GNU Lesser General Public License as */ 00009 /* published by the Free Software Foundation; either version 2.1 of the */ 00010 /* License, or (at your option) any later version. */ 00011 /* */ 00012 /* This library is distributed in the hope that it will be useful, */ 00013 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ 00014 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ 00015 /* Lesser General Public License for more details. */ 00016 /* */ 00017 /* You should have received a copy of the GNU Lesser General Public */ 00018 /* License along with this library; if not, write to the Free Software */ 00019 /* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 */ 00020 /* USA. */ 00021 /* */ 00022 /* In addition, when you copy and redistribute some or the entire part of */ 00023 /* the source code of this software with or without modification, you */ 00024 /* MUST include this copyright notice in each copy. */ 00025 /* */ 00026 /* If you make any changes that are appeared to be useful, please send */ 00027 /* sources that include the changed part to */ 00028 /* diameter-developers@lists.sourceforge.net so that we can reflect your */ 00029 /* changes to one unified version of this software. */ 00030 /* */ 00031 /* END_COPYRIGHT */ 00032 /* 00033 diameter_mip_fa_client_interface.hxx 00034 Diameter MIP FA client interfacece 00035 Written by Miriam Tauil 00036 Created January 19, 2005. 00037 */ 00038 00039 #ifndef __DIAMETER_MIP_FA_CLIENT_INTERFACE_H__ 00040 #define __DIAMETER_MIP_FA_CLIENT_INTERFACE_H__ 00041 #include "diameter_parser_api.h" 00042 #include "diameter_mip4_fa_client_session.hxx" 00043 #include "mip4_diameter_fa_client_interface.hxx" 00044 00045 /************************************************************************* 00046 The FA Client class specifies an interface of a MIP Foreign Agent 00047 implementation. 00048 Once the FA implementation is implemented with the following interface, 00049 the Diameter MIP FA sample application, will provide a FA implementation 00050 supporting the Diameter MIP Application. 00051 00052 **************************************************************************/ 00053 00054 00055 class FaClientSession { 00056 private: 00057 00058 Mip4DiameterFaClientInterface &_session; 00059 00060 public: 00061 00062 FaClientSession( Mip4DiameterFaClientInterface &s):_session(s){} 00063 00064 virtual ~FaClientSession(){} 00065 00066 // SendMipRegReplay will be called by the diameter-mip4 lib and MUST be 00067 // implemented by the MIP fa implementation. 00068 // diameter lib will provide the information from AMA reply to 00069 // the MIP FA client implementation. MIP FA will use this info to 00070 // send the Mip replay and act upon the AMA response ( positive - will 00071 // setup the relevant filters for the user, and process his packets 00072 // appropriely 00073 virtual void SendMipRegReply( diameter_unsigned32_t &amaResultCode)=0; 00074 00075 virtual void SendMipRegReply(diameter_unsigned32_t &amaResultCode, 00076 diameter_octetstring_t &mipRegReply )=0; 00077 00078 00079 // the user implementation MUST 00080 // call LocalRxMipRegReq() when it accepts the MIP registration request 00081 // with the content of the request. 00082 // This is a callback function that will notify the diameter library 00083 // about the event and will propagate the content of the received message 00084 //void LocalRxMipRegReq( diameter_octetstring_t &mipRegReq) 00085 void RxMipRegReq( diameter_octetstring_t &mipRegReq) 00086 { 00087 _session.RxMipRegReq( mipRegReq); 00088 } 00089 00090 // The derrived class will use this interface function to reset any local 00091 // variables, so the specificMipFaClient object can be reuse, 00092 //for a different future mip session. 00093 // Note: the reference to the Mip4DiameterFaClientInterface does not 00094 // need to be reset, since it will be reuse as well. 00095 virtual AAAReturnCode Reset(){ return AAA_ERR_SUCCESS; } 00096 00103 /*** mandatory AMR attributes ***/ 00104 00105 // UserName: if "Home Address" from MIP Registration is not 0.0.0.0 -> 00106 // Home address 00107 // - otherwise NAI extension should be in MIP REgistration and ... 00108 virtual int SetUserName ( diameter_utf8string_t &UserName) = 0; 00109 00110 // SetDestinationRealm based on Home AAA server NAI 00111 virtual int SetDestinationRealm ( diameter_utf8string_t &DestinationRealm ) = 0; 00112 00113 00114 // the following are used to set MipMnAaaAuth 00115 virtual int SetMipMnAaaSpi( diameter_unsigned32_t *mnAaaSpi)=0; 00116 virtual int SetMipAuthInputDataLength( 00117 diameter_unsigned32_t *authInputDataLength)=0; 00118 virtual int SetMipAuthenticatorLength( 00119 diameter_unsigned32_t *authenticatorLength)=0; 00120 virtual int SetMipAuthenticatorOffset( 00121 diameter_unsigned32_t *authenticatorOffset)=0; 00122 00123 /*** optional AMR attributes - start here ***/ 00124 00125 // From Home AAA server NAI 00126 virtual int SetDestinationHost (diameter_identity_t &DestinationHost )=0; 00127 //"Home Address" mobile node's home IP address = type address 00128 virtual int SetMipMobileNodeAddress( diameter_address_t &MipMobileNodeAddress)=0; 00129 // "Home Agent" mobile node's home agent IP address = type address 00130 virtual int SetMipHomeAgentAddress( diameter_address_t &MipHomeAgentAddress)=0; 00131 00132 // IsMnHaKeyRequested() needed to setup flags for MipFeatureVector 00133 // return 1 if MN_HA keye was requested in MIP reg req 00134 // return 0 - otherwise 00135 virtual int IsMnHaKeyRequested()=0; 00136 00137 virtual int IsMnFaKeyRequested() =0; 00138 virtual int IsFaHaKeyRequested() =0; 00139 virtual int IsMnHomeAddrRequested() =0; 00140 virtual int IsMnHomeAgentRequested() =0; 00141 00142 // dynamic host AVP 00143 00144 //"Lifetime" in MIP reg header 00145 virtual int SetAuthorizationLifetime( 00146 diameter_unsigned32_t *AuthorizationLifetime) 00147 { 00148 return 0; 00149 } 00150 00151 virtual int SetMipFaChallenge( diameter_octetstring_t &mipFaChallenge)=0; 00152 00153 // dynamic host AVP 00154 // virtual int SetMipCandidateHomeAgentHost( diameter_identity_t CandidateHomeAgentHost)=0; 00155 00156 // Home Agent NAI Or 00157 // Home Agent field provides IP address+DNS host name lookup ?? 00158 virtual int SetMipHomeAgentHost(diameter_identity_t &HomeAgentHost)=0; 00159 00160 virtual int SetMipHaToFaSpi(diameter_unsigned32_t *mipHaToFaSpi)=0; 00161 00162 // Enforce/Propagate parameters that are coming back in the AMA message 00163 // to the MIP Agent 00164 00165 virtual void EnforceAuthorizationLifetime 00166 (const diameter_unsigned32_t &authorizationLifetime)=0; 00167 00168 void EnforceAuthSessionState( const diameter_enumerated_t &authSessionState) 00169 {} 00170 00171 void EnforceReAuthRequestType( const diameter_enumerated_t &reAuthReqType){} 00172 00173 00174 //If the MH supports security features, it should implement the following 00175 // virtual function, in order to make use of the security parameters 00176 // generated for this session. 00177 virtual void EnforceMipMnToFaMsa 00178 (const mip_mn_to_fa_msa_info_t &mipMnToFaMsa){} 00179 00180 virtual void EnforceMipMnToHaMsa 00181 ( const mip_mn_to_ha_msa_info_t &mipMnToHaMsa){} 00182 00183 virtual void EnforceMipFaToMnMsa 00184 ( const mip_fa_to_mn_msa_info_t &mipFaToMnMsa){} 00185 00186 virtual void EnforceMipFaToHaMsa 00187 ( const mip_fa_to_ha_msa_info_t &mipFaToHaMsa){} 00188 00189 virtual void EnforceMipHaToMnMsa 00190 ( const mip_ha_to_mn_msa_info_t &mipHaToMnMsa){} 00191 00192 virtual void EnforceMipMsaLifetime 00193 ( const diameter_unsigned32_t &mipMsaLifetime){} 00194 00195 // FA to get the AMA error message 00196 virtual void EnforceErrorMessage(const diameter_utf8string_t &errorMessage){} 00197 00198 virtual void EnforceMipFilterRule ( 00199 const AAA_VectorAttribute<diameter_ipfilter_rule_t> &mipFilterRule)=0; 00200 00201 00202 }; 00203 00204 #endif // __DIAMETER_MIP_FA_CLIENT_INTERFACE_H__ 00205 00206