Main Page | Class List | Directories | File List | Class Members

diameter_mip4_aaas_server_interface.hxx

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_mip4_aaas_server_interface.hxx
00034    Diameter MIP AAA server, server session interfacece
00035    Written by Miriam Tauil
00036    Created October 1, 2004.
00037 */
00038 
00039 #ifndef __DIAMETER_MIP_AAAS_SERVER_INTERFACE_H__
00040 #define __DIAMETER_MIP_AAAS_SERVER_INTERFACE_H__
00041 #include <unistd.h>
00042 #include "diameter_parser_api.h"
00043 #include "diameter_mip4_aaas_server_session.hxx"
00044 
00045 
00046 
00047 
00048 /*************************************************************************
00049   The Mip4AaaSServer class specifies an interface for a MIP AAA Server
00050   (server session portion)  implementation.
00051   Once the AAA server implementation is implemented with the following 
00052   interface, the Diameter MIP AAA server sample application, will provide a 
00053   AAA server implementation supporting the Diameter MIP Application.
00054 
00055  **************************************************************************/
00056 
00057 
00058 class Mip4AaaSServer {
00059    private:
00060 
00061 
00062   AMR_Data _amrData;
00063    public:
00064 
00065       // amrData content is necessary for this object to operate
00066       // it is not passed on the constructor, since it will be created
00067       // by the AAAServerSessionFactoryClass, and the factory class
00068       // will create new sessions when an AMR arrives, which will cause
00069       // the call of the AMR_Handler in DiameterMip4AaaSServerSession,
00070       // which will call SetAmrData (AMR_Data &amrData)
00071 
00072       Mip4AaaSServer(){}
00073         
00074       virtual ~Mip4AaaSServer(){}
00075 
00076       void SetAmrData (AMR_Data &amrData)
00077       {
00078         _amrData = amrData;
00079       }
00080 
00094       // mnHaNonce => MIP-Mn-to-Ha-Msa
00095       virtual int SetMnHaNonce(diameter_octetstring_t &mnHaNonce)=0;  
00096  
00097       /* sent to the Ha in AMA or HAR in Mip-Ha-To-Mn-Msa */
00098       virtual int SetHaMnKey(diameter_octetstring_t &mipSessionKey)=0;
00099 
00100       virtual int SetMipMsaLifetime(diameter_unsigned32_t *mipMsaLifetime)=0;
00101 
00102       //virtual int SetResultCode( diameter_unsigned32_t &resultcode)=0;
00103       virtual int SetErrorMessage(diameter_utf8string_t &errorMessage){ return 0;}
00104 
00105       // The following fn will be called only in case MN is in a foreign 
00106       // network and SA with FA is requested (in MIP-Feature-Vector in AMR
00107       // MN-FA key request was set)
00108       // mnFaNonce => MIP-Mn-to-Fa-Msa
00109       virtual int SetMnFaNonce(diameter_octetstring_t &mnFaNonce)=0;  
00110       // sent to the Fa in AMA in Mip-Fa-To-Mn-Msa 
00111       virtual int SetMnFaKey(diameter_octetstring_t &mipSessionKey)=0;
00112       // sent to the Fa in AMA in Mip-Fa-To-Ha-Msa & to Ha in HAR
00113       virtual int SetFaHaKey(diameter_octetstring_t &mipSessionKey)=0;
00114   
00115   virtual void SetMipFilterRule(){} // need to be chaged ...
00116 
00117  // will return the Algorithm type associated with MIPv4 authorization 
00118   // extention. Currently defined (2) HMAC-SHA-1
00119   virtual void  SetAlgorithmType( diameter_unsigned32_t *mipAlgorithmType)
00120   {
00121     (*mipAlgorithmType) = 2;
00122   }
00123 
00124   // will set Replay-Mode according one of the values allowed in the I-Draft.
00125   // 1 None
00126   // 2 Timestamp
00127   // 3 Nonces
00128   virtual void SetReplayMode( diameter_enumerated_t *mipReplayMode)
00129   {
00130     (*mipReplayMode) = 1;
00131   }
00132 
00133   // returns 1, when the AAAS sets authLifetime
00134   // otherwisw returns 0 and this AVP will be set per the authLifetime
00135   // requested in AMR
00136   virtual int SetAuthorizationLifetime(diameter_unsigned32_t *authLifetime)=0;
00137 
00138   #define STATE_MAINTAINED 1
00139   #define NO_STATE_MAINTAINED 0
00140   virtual void  SetAuthState(diameter_enumerated_t *authState)
00141   {
00142     (*authState)  = STATE_MAINTAINED;
00143   }
00144   /* 
00145      AuthenticateUser() fn will use the AMR information (MIP-Mn-AAA-Auth) to 
00146      authorize the user will return 1 for authorize user or 0 otherwise.
00147   */
00148   virtual bool AuthenticateUser(std::string UserName, 
00149                              diameter_address_t MipMobileNodeAddress,
00150                              diameter_unsigned32_t MipMnAaaSpi,
00151                              diameter_unsigned32_t MipAuthInputDataLength,
00152                              diameter_unsigned32_t MipAuthenticatorLength,
00153                              diameter_unsigned32_t MipAuthenticatorOffset,
00154                              std::string MipRegRequest )=0;
00155 
00156 
00157   virtual int SetAaaSAllocatedHomeAgentHost(
00158                             AAA_ScholarAttribute<diameter_identity_t> &hostname)
00159   {
00160 #ifdef OPTION_1
00161     char _hostname[100];
00162     if ( ! gethostname( _hostname , 100) )
00163       {
00164         // assume HA is running on the AAAS host
00165         hostname.Set( _hostname); 
00166         return 1;
00167       }
00168     else
00169       return 0;
00170 #endif
00171 #ifdef OPTION_2
00172     // assume HA is running on the AAAS host - 
00173     // taken from config file
00174     hostname.Set( AAA_CFG_TRANSPORT()->host);
00175 
00176 #endif
00177     hostname.Set( "has.homedomain.com");
00178     return 1;
00179 
00180 
00181   }
00182 
00183 
00184   virtual AAAReturnCode Reset(){ return AAA_ERR_SUCCESS;}
00185  
00186   /* this fn will be call to release local resource allocated to a session
00187      will be called in the session fn: HandleAbort(), 
00188      HandleAuthGracePeriodTimeout(), HandleDisconnect, HandleSessiontimeout()
00189      STR received (where this is captured??)
00190   */
00191   virtual void ReleaseSessionResources(){}
00192 
00193   
00194 };
00195  
00196 #endif  // __DIAMETER_MIP_AAAS_SERVER_INTERFACE_H__
00197  
00198  

Generated on Thu Apr 7 09:08:51 2005 for Diameter Mobile IP v4 C++ API by  doxygen 1.4.2