natplugins/natpnatfwsdpprovider/inc/nspinterface.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2007 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:  Plugin interface implementation, class description.
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef NSPINTERFACE_H
       
    19 #define NSPINTERFACE_H
       
    20 
       
    21 #include "nspplugin.h"
       
    22 #include "nsputdefinitions.h"
       
    23 
       
    24 class CNSPController;
       
    25 
       
    26 /**
       
    27  *  NAT FW Sdp plugin interface implementation.
       
    28  *
       
    29  *  This class implements 'CNSPPlugin' ECOM interface.
       
    30  *
       
    31  *  @lib natfwsdpprovider.dll
       
    32  *  @since S60 3.2
       
    33  */
       
    34 class CNSPInterface : public CNSPPlugin
       
    35     {
       
    36 public: // Constructors and destructor
       
    37 
       
    38     /**
       
    39      * A two-phase constructor.
       
    40      */
       
    41     static CNSPInterface* NewL();
       
    42     
       
    43     /**
       
    44      * Destructor.
       
    45      */
       
    46     virtual ~CNSPInterface();
       
    47 
       
    48 
       
    49 private: // Constructors and destructor
       
    50 
       
    51     CNSPInterface();
       
    52     
       
    53     void ConstructL();
       
    54 
       
    55 
       
    56 public: // From CNSPPlugin
       
    57 
       
    58     /**
       
    59      * Creates session object, and returns a handle to that object.
       
    60      * Client of the class uses services via this handle.
       
    61      *
       
    62      * @since       S60 3.2
       
    63      * @param       aSessionObserver    Observer for created session, 
       
    64      *                                  for async callbacks.
       
    65      * @param       aIapId              Internet access point identifier, unique.
       
    66      * @param       aProtocol           Used transport protocol, values are:
       
    67      *                                  1 = TCP
       
    68      *                                  2 = UDP
       
    69      * @return      Session identifier, via this handle session is used.
       
    70      */
       
    71     TUint NewSessionL( MNSPSessionObserver& aSessionObserver,
       
    72             TUint32 aIapId, const TDesC8& aDomain, TUint aProtocol );
       
    73     
       
    74     /**
       
    75      * With this call NAT FW session is terminated.
       
    76      *
       
    77      * @since       S60 3.2
       
    78      * @param       aSessionId          Session unique identier.
       
    79      */
       
    80     void CloseSessionL( TUint aSessionId );
       
    81     
       
    82     /**
       
    83      * Sets the value of a session parameter.
       
    84      * 
       
    85      * @param       aSessionId          The ID identifying session.
       
    86      * @param       aParamKey           identifies the parameter.
       
    87      * @param       aParamValue         value of the parameter.
       
    88      * @return      KErrNotFound if the key is not found or
       
    89      *              other system wide error code on failure.
       
    90      */
       
    91     TInt SetSessionParam( TUint aSessionId, TNSPSessionParamKey aParamKey,
       
    92             TUint aParamValue );
       
    93     
       
    94     /**
       
    95      * Gets the value of a session parameter.
       
    96      * 
       
    97      * @param       aSessionId          The ID identifying session.
       
    98      * @param       aParamKey           identifies the parameter.
       
    99      * @return      value of the parameter or
       
   100      *              KErrNotFound if the value is not available or
       
   101      *              other system wide error code on failure.
       
   102      */
       
   103     TInt GetSessionParam( TUint aSessionId, TNSPSessionParamKey aParamKey );
       
   104     
       
   105     /**
       
   106      * Initial NAT FW specific SDP content added in here.
       
   107      *
       
   108      * @since       S60 3.2
       
   109      * @param       aSessionId          Session unique identier.
       
   110      * @param       aOffer              Sdp offer document
       
   111      */
       
   112     TNatReturnStatus CreateOfferL( TUint aSessionId, CSdpDocument*& aOffer );
       
   113     
       
   114     /**
       
   115      * NAT FW specific SDP content is added to both Offer and Answer.
       
   116      *
       
   117      * @since       S60 3.2
       
   118      * @param       aSessionId          Session unique identier.
       
   119      * @param       aOffer              Sdp offer document
       
   120      * @param       aAnswer             Sdp answer document
       
   121      */
       
   122     TNatReturnStatus ResolveL( TUint aSessionId,
       
   123             CSdpDocument*& aOffer, CSdpDocument*& aAnswer );
       
   124     
       
   125     /**
       
   126      * Answer to initial Answer interpred in here.
       
   127      *
       
   128      * @since       S60 3.2
       
   129      * @param       aSessionId          Session unique identier.
       
   130      * @param       aAnswer             Sdp answer document.
       
   131      */
       
   132     TNatReturnStatus DecodeAnswerL( TUint aSessionId, CSdpDocument*& aAnswer );
       
   133     
       
   134     /**
       
   135      * Offer can be updated while ResolveL is still ongoing, i.e.
       
   136      * OfferReady callback is not yet received.
       
   137      *
       
   138      * @since       S60 3.2
       
   139      * @param       aSessionId          Session unique identier.
       
   140      * @param       aOffer              Sdp offer document.
       
   141      */
       
   142     void UpdateL( TUint aSessionId, CSdpDocument*& aOffer );
       
   143     
       
   144     /**
       
   145      * Empty INVITE, with certain NAT protocols, can be interpret as request
       
   146      * to restart connection checks. This method must be called if such
       
   147      * a message is received.
       
   148      *
       
   149      * @since       S60 3.2
       
   150      * @param       aSessionId          Session unique identier.
       
   151      * @return      NAT status, if async signaling expected.
       
   152      */
       
   153     TNatReturnStatus RestartL( TUint aSessionId );
       
   154 
       
   155 
       
   156 private: // data
       
   157 
       
   158     /**
       
   159      * Controller object, which is used to find sessions and check Sdp.
       
   160      * Own.
       
   161      */
       
   162     CNSPController* iController;
       
   163     
       
   164     /**
       
   165      * Definitions for unit testing.
       
   166      */
       
   167     NSP_UT_DEFINITIONS
       
   168 
       
   169     };
       
   170 
       
   171 #endif // NSPINTERFACE_H
       
   172 
       
   173 // end of file