realtimenetprots/sipfw/SIP/SIPSec/DigestPlugin/inc/sipsecplugincontext.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 * Name          : sipsecplugincontext.h
       
    16 * Part of       : SIPSec/DigestPlugin
       
    17 * Version       : SIP/6.0
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef __SIPSEC_PLUGINCONTEXT_H__
       
    29 #define __SIPSEC_PLUGINCONTEXT_H__
       
    30 
       
    31 // INCLUDES
       
    32 #include "Lwtimer.h"
       
    33 #include "SipStackServerDefs.h"
       
    34 #include <e32std.h>
       
    35 #include <in_sock.h>
       
    36 
       
    37 // FORWARD DECLARATIONS
       
    38 class CUri8;
       
    39 class MSIPSecSecurityMechanismObserver;
       
    40 class MSIPSecUser;
       
    41 class CSIPSecDigestCache;
       
    42 class CSIPRequest;
       
    43 class CSIPResponse;
       
    44 class CSIPSecurityVerifyHeader;
       
    45 class CSIPSecurityServerHeader;
       
    46 class CSIPAuthenticationInfoHeader;
       
    47 class CSIPSecDigestPlugin;
       
    48 class CSIPHeaderBase;
       
    49 
       
    50 // CLASS DECLARATION
       
    51 /**
       
    52  * @brief Class is base class for plugin context
       
    53  * 
       
    54  * @class TSIPSecPluginContext sipsecplugincontext.h "sipsecplugincontext.h"
       
    55  *
       
    56  * Class provides common context data of response or request
       
    57  */
       
    58 class TSIPSecPluginContext
       
    59 	{	
       
    60 public: // Constructors and destructor
       
    61 
       
    62     /**
       
    63     * Constructor
       
    64     * @param aPlugin Digest plugin    
       
    65     * @param aRemoteTarget Remote target
       
    66     * @param aOutboundProxy outbound proxy
       
    67     * @param aUser SIPSec user
       
    68     * @param aRegistrationId Registration id
       
    69     * @param aTransactionId Transaction id
       
    70     */
       
    71     TSIPSecPluginContext( CSIPSecDigestPlugin& aPlugin,                          
       
    72                           const CUri8& aRemoteTarget,
       
    73                           const TDesC8& aOutboundProxy,
       
    74                           MSIPSecUser& aUser,
       
    75                           TRegistrationId aRegistrationId,
       
    76                           TTransactionId aTransactionId );
       
    77 
       
    78 	/**
       
    79     * Destructor
       
    80     */
       
    81     inline virtual ~TSIPSecPluginContext()
       
    82         {
       
    83         }
       
    84 
       
    85 public: // New functions
       
    86 
       
    87 	virtual TBool AlsoTrustedUser();
       
    88 
       
    89 public: // SIP related functions
       
    90 
       
    91     /**
       
    92     * Returns the remote target
       
    93     * @return remote target
       
    94     */
       
    95     const CUri8& RemoteTarget() const;
       
    96 
       
    97     /**
       
    98     * Returns the outbound proxy
       
    99     * @return outbound proxy
       
   100     */
       
   101     const TDesC8& OutboundProxy() const;
       
   102 
       
   103     /**
       
   104     * Returns the SIPSec user
       
   105     * @return SIPSec user
       
   106     */
       
   107     MSIPSecUser& SIPSecUser();
       
   108 
       
   109     /**
       
   110     * Returns plugin
       
   111     * @return plugin
       
   112     */
       
   113     CSIPSecDigestPlugin& Plugin() const;
       
   114 
       
   115 	/**
       
   116     * Returns registration id.
       
   117     * @return Registration id
       
   118     */
       
   119     TRegistrationId RegistrationId() const;
       
   120 
       
   121     /**
       
   122     * Returns transaction id.
       
   123     * @return Transaction id
       
   124     */
       
   125     TTransactionId TransactionId() const;
       
   126 
       
   127 private: // Data
       
   128 
       
   129     CSIPSecDigestPlugin& iPlugin;
       
   130 
       
   131 	//Remote target
       
   132     const CUri8& iRemoteTarget;
       
   133 
       
   134     const TDesC8& iOutboundProxy;
       
   135     MSIPSecUser& iUser;
       
   136 	TRegistrationId iRegistrationId;
       
   137     TTransactionId iTransactionId;
       
   138     };
       
   139 
       
   140 
       
   141 
       
   142 /**
       
   143  * @brief Class is plugin context with response
       
   144  * 
       
   145  * @class TSIPSecPluginCtxResponse sipsecplugincontext.h "sipsecplugincontext.h"
       
   146  *
       
   147  * Class provides, in addition to common context, SIP response
       
   148  */
       
   149 class TSIPSecPluginCtxResponse : public TSIPSecPluginContext
       
   150 	{	
       
   151 public: // Constructor
       
   152 
       
   153     /**
       
   154     * Constructor
       
   155     * @param aPlugin Digest plugin    
       
   156     * @param aRemoteTarget Remote target
       
   157     * @param aOutboundProxy Outbound proxy
       
   158     * @param aSIPResponse SIP response
       
   159     * @param aCache Cache
       
   160     * @param aObserver Mechanism observer
       
   161     * @param aUser SIPSec user
       
   162     * @param aRegistrationId Registration id
       
   163     * @param aTransactionId Transaction id
       
   164     */
       
   165     TSIPSecPluginCtxResponse( CSIPSecDigestPlugin& aPlugin,
       
   166                               const CUri8& aRemoteTarget,
       
   167                               const TDesC8& aOutboundProxy,
       
   168                               CSIPResponse& aSIPResponse,
       
   169                               CSIPSecDigestCache& aCache,
       
   170                               MSIPSecSecurityMechanismObserver& aObserver,
       
   171                               MSIPSecUser& aUser,
       
   172                               TRegistrationId aRegistrationId,
       
   173                               TTransactionId aTransactionId );
       
   174 
       
   175 public: // SIP related functions
       
   176 
       
   177     /**
       
   178     * Returns cache
       
   179     * @return cache
       
   180     */
       
   181     CSIPSecDigestCache& Cache();
       
   182 
       
   183     /**
       
   184     * Returns observer
       
   185     * @return observer
       
   186     */
       
   187     MSIPSecSecurityMechanismObserver& Observer();
       
   188 
       
   189     /**
       
   190     * Returns SIP response
       
   191     * @return SIP response
       
   192     */
       
   193     CSIPResponse& SIPResponse();
       
   194 
       
   195 private: // Data
       
   196 
       
   197     CSIPSecDigestCache& iCache;
       
   198 
       
   199     MSIPSecSecurityMechanismObserver& iObserver;
       
   200 
       
   201     CSIPResponse& iSIPResponse;
       
   202     };
       
   203 	
       
   204 
       
   205 
       
   206 
       
   207 /**
       
   208  * @brief Class is plugin context with request
       
   209  * 
       
   210  * @class TSIPSecPluginCtxRequest sipsecplugincontext.h "sipsecplugincontext.h"
       
   211  *
       
   212  * Class provides, in addition to common context, SIP request
       
   213  */
       
   214 class TSIPSecPluginCtxRequest : public TSIPSecPluginContext
       
   215 	{
       
   216 	
       
   217 public: // Constructor
       
   218 
       
   219     /**
       
   220     * Constructor
       
   221     * @param aPlugin Digest plugin    
       
   222     * @param aRemoteTarget remote target
       
   223     * @param aOutboundProxy outbound proxy
       
   224     * @param aSIPRequest SIP request
       
   225     * @param aUser SIPSec user
       
   226     * @param aRegistrationId Registration id
       
   227     * @param aTransactionId Transaction id
       
   228     */
       
   229     TSIPSecPluginCtxRequest( CSIPSecDigestPlugin& aPlugin,                             
       
   230                              const CUri8& aRemoteTarget,
       
   231                              const TDesC8& aOutboundProxy,
       
   232                              CSIPRequest& aSIPRequest,
       
   233                              MSIPSecUser& aUser,
       
   234                              TRegistrationId aRegistrationId,
       
   235                              TTransactionId aTransactionId );                             
       
   236 
       
   237 public: // SIP related functions
       
   238 
       
   239     /**
       
   240     * Returns the SIP request
       
   241     * @return SIP request
       
   242     */
       
   243     CSIPRequest& SIPRequest();
       
   244 
       
   245 private: // Data
       
   246     
       
   247     CSIPRequest& iSIPRequest;
       
   248     };
       
   249 
       
   250 
       
   251 
       
   252 
       
   253 /**
       
   254  * @brief Class is plugin context with sec-agree related data
       
   255  * 
       
   256  * @class TSIPSecPluginCtxVerify sipsecplugincontext.h "sipsecplugincontext.h"
       
   257  *
       
   258  * Class provides, in addition to request context, security verify and server
       
   259  * header
       
   260  */
       
   261 class TSIPSecPluginCtxVerify : public TSIPSecPluginCtxRequest
       
   262 	{	
       
   263 public: // Constructor
       
   264 
       
   265     /**
       
   266     * Constructor
       
   267     * @param aPlugin Digest plugin
       
   268     * @param aRemoteTarget remote target
       
   269     * @param aOutboundProxy outbound proxy
       
   270     * @param aSIPRequest SIP request
       
   271     * @param aVerifyHeader security verify header
       
   272     * @param aServerHeader security server header
       
   273     * @param aUser SIPSec user
       
   274     * @param aRegistrationId Registration id
       
   275     */
       
   276     TSIPSecPluginCtxVerify( CSIPSecDigestPlugin& aPlugin,
       
   277                    const CUri8& aRemoteTarget,
       
   278                    const TDesC8& aOutboundProxy,
       
   279                    CSIPRequest& aSIPRequest, 
       
   280                    CSIPSecurityVerifyHeader& aVerifyHeader,
       
   281                    RPointerArray<CSIPSecurityServerHeader>& aServerHeaders,
       
   282                    MSIPSecUser& aUser,
       
   283                    TRegistrationId aRegistrationId );
       
   284 
       
   285 public: // SIP related functions
       
   286 
       
   287     /**
       
   288     * Returns SIP Security-Verify header
       
   289     * @return Security-Verify header
       
   290     */
       
   291     CSIPSecurityVerifyHeader& SecurityVerifyHeader();
       
   292 
       
   293     /**
       
   294     * Returns SIP Security-Server headers
       
   295     * @return Queue of Security-Server headers
       
   296     */
       
   297     TSglQue<CSIPHeaderBase>& SecurityServerHeaders();
       
   298 
       
   299 private: // Data
       
   300 
       
   301    	CSIPSecurityVerifyHeader& iVerifyHeader;
       
   302    	TSglQue<CSIPHeaderBase> iServerHeaders;
       
   303 	};
       
   304 
       
   305 
       
   306 /**
       
   307  * @brief Class is plugin context with authentication info related data
       
   308  * 
       
   309  * @class TSIPSecPluginCtxInfo sipsecplugincontext.h "sipsecplugincontext.h"
       
   310  *
       
   311  * Class provides, in addition to request context, authentication info header
       
   312  */
       
   313 class TSIPSecPluginCtxInfo : public TSIPSecPluginCtxResponse
       
   314 	{	
       
   315 public: // Constructor
       
   316 
       
   317     /**
       
   318     * Constructor
       
   319     * @param aPlugin Digest plugin    
       
   320     * @param aRemoteTarget Remote target
       
   321     * @param aOutboundProxy Outbound proxy
       
   322     * @param aSIPResponse SIP response
       
   323     * @param aAuthInfo Authorization-Info header
       
   324     * @param aCache Cache
       
   325     * @param aObserver Mechanism observer
       
   326     * @param aUser SIPSec user
       
   327     * @param aRegistrationId Registration id
       
   328     */
       
   329     TSIPSecPluginCtxInfo( CSIPSecDigestPlugin& aPlugin,    
       
   330                           const CUri8& aRemoteTarget,
       
   331                           const TDesC8& aOutboundProxy,
       
   332                           CSIPResponse& aSIPResponse,
       
   333                           CSIPAuthenticationInfoHeader& aAuthInfo,
       
   334                           CSIPSecDigestCache& aCache,
       
   335                           MSIPSecSecurityMechanismObserver& aObserver,
       
   336                           MSIPSecUser& aUser,
       
   337                           TRegistrationId aRegistrationId );
       
   338 
       
   339 public: // From TSIPSecPluginContext
       
   340 
       
   341 	TBool AlsoTrustedUser();
       
   342 
       
   343 public: // SIP related functions
       
   344 
       
   345     /**
       
   346     * Returns SIP Authentication-Info header
       
   347     * @return Authentication-Info header
       
   348     */
       
   349     CSIPAuthenticationInfoHeader& AuthenticationInfoHeader();	
       
   350 
       
   351 private: // Data
       
   352 
       
   353 	CSIPAuthenticationInfoHeader& iAuthInfo;
       
   354 	};
       
   355 
       
   356 #endif //end of __SIPSEC_PLUGINCONTEXT_H__
       
   357 
       
   358 // End of File