inc/nspplugin.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 description.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef NSPPLUGIN_H
       
    21 #define NSPPLUGIN_H
       
    22 
       
    23 #include <e32base.h>
       
    24 #include "nsppluginreturndef.h"
       
    25 
       
    26 class CSdpDocument;
       
    27 class MNSPSessionObserver;
       
    28 
       
    29 /** Interface UID of this ECOM interface */
       
    30 const TUid KNSPPluginIFUid = { 0x102832F0 };
       
    31 
       
    32 /**
       
    33  *  Plugin interface.
       
    34  *
       
    35  *  ECOM Plugin interface.
       
    36  *
       
    37  *  @lib
       
    38  *  @since S60 3.2
       
    39  */
       
    40 class CNSPPlugin : public CBase
       
    41     {
       
    42 public: // Enumerations
       
    43 
       
    44     /** Session parameter keys */
       
    45     enum TNSPSessionParamKey
       
    46         {
       
    47         ENSPResourseReservationStatusKey=0, /*read-only*/
       
    48         ENSPMediaTypeOfServiceKey=1
       
    49         };
       
    50 
       
    51     /** NAT traversal resource reservation status */
       
    52     enum TNSPResourseReservationStatus
       
    53         {
       
    54         ENSPResourcesNotReserved=0,
       
    55         ENSPResourcesReserved=1
       
    56         };
       
    57 
       
    58 public: // Constructors and destructor
       
    59 
       
    60     /**
       
    61      * Ecom plugin initialization.
       
    62      */
       
    63     static inline CNSPPlugin* NewL( TUid aUid );
       
    64     
       
    65     /**
       
    66      * Default destructor. Any remaining NAT sessions are deleted.
       
    67      */
       
    68     inline ~CNSPPlugin();
       
    69 
       
    70 
       
    71 public: // New functions
       
    72 
       
    73     /**
       
    74      * Creates session object, and returns a handle to that object.
       
    75      * Client of the class uses services via this handle.
       
    76      *
       
    77      * @since       S60 3.2
       
    78      * @param       aSessionObserver    Observer for created session,
       
    79      *                                  for async callbacks.
       
    80      * @param       aIapId              Internet access point identifier.
       
    81      * @param       aDomain             Used domain for settings query.
       
    82      * @param       aProtocol           Used transport protocol, values:
       
    83      *                                  1 = TCP,
       
    84      *                                  2 = UDP.
       
    85      * @return      Session ID, via this handle the session is used.
       
    86      */
       
    87     virtual TUint NewSessionL( MNSPSessionObserver& aSessionObserver,
       
    88             TUint32 aIapId, const TDesC8& aDomain, TUint aProtocol ) = 0;
       
    89     
       
    90     /**
       
    91      * With this call NAT session is terminated.
       
    92      *
       
    93      * @since       S60 3.2
       
    94      * @param       aSessionId          The ID identifying session.
       
    95      */
       
    96     virtual void CloseSessionL( TUint aSessionId ) = 0;
       
    97     
       
    98     /**
       
    99      * Sets the value of a session parameter.
       
   100      * 
       
   101      * @param       aSessionId          The ID identifying session.
       
   102      * @param       aParamKey           identifies the parameter.
       
   103      * @param       aParamValue         value of the parameter.
       
   104      * @return      KErrNotFound if the key is not found or
       
   105      *              other system wide error code on failure.
       
   106      */
       
   107     virtual TInt SetSessionParam( TUint aSessionId,
       
   108             TNSPSessionParamKey aParamKey, TUint aParamValue );
       
   109     
       
   110     /**
       
   111      * Gets a value of a session parameter.
       
   112      * 
       
   113      * @param       aSessionId          The ID identifying session.
       
   114      * @param       aParamKey           identifies the parameter.
       
   115      * @return      value of the parameter or
       
   116      *              KErrNotFound if the value is not available or
       
   117      *              other system wide error code on failure.
       
   118      */
       
   119     virtual TInt GetSessionParam( TUint aSessionId,
       
   120             TNSPSessionParamKey aParamKey );
       
   121     
       
   122     /**
       
   123      * Initial NAT specific Sdp content is added to Offer in here.
       
   124      * If 'KNatAsync' return value is used, then async callback
       
   125      * OfferReady is expected.
       
   126      *
       
   127      * @since       S60 3.2
       
   128      * @param       aSessionId          The ID identifying session.
       
   129      * @param       aOffer              Sdp offer document.
       
   130      * @return      NAT status, if async signaling expected.
       
   131      */
       
   132     virtual TNatReturnStatus CreateOfferL( TUint aSessionId,
       
   133             CSdpDocument*& aOffer ) = 0;
       
   134     
       
   135     /**
       
   136      * NAT FW specific Sdp content is added both Offer and Answer.
       
   137      * If 'KNatAsync' return value is used, then async callbacks
       
   138      * AnswerReady and OfferReady are expected.
       
   139      *
       
   140      * @since       S60 3.2
       
   141      * @param       aSessionId          The ID identifying session.
       
   142      * @param       aOffer              Sdp offer document.
       
   143      * @param       aAnswer             Sdp answer document.
       
   144      * @return      NAT status, if async signaling expected.
       
   145      */
       
   146     virtual TNatReturnStatus ResolveL( TUint aSessionId,
       
   147             CSdpDocument*& aOffer, CSdpDocument*& aAnswer ) = 0;
       
   148     
       
   149     /**
       
   150      * Answer to initial Offer interpred in here.
       
   151      * If 'KNatAsync' return value is used, then async callback
       
   152      * AnswerReady is expected.
       
   153      *
       
   154      * @since       S60 3.2
       
   155      * @param       aSessionId          The ID identifying session.
       
   156      * @param       aAnswer             Sdp answer document.
       
   157      * @return      NAT status, if async signaling expected.
       
   158      */
       
   159     virtual TNatReturnStatus DecodeAnswerL( TUint aSessionId,
       
   160             CSdpDocument*& aAnswer ) = 0;
       
   161     
       
   162     /**
       
   163      * Offer can be updated while ResolveL is still ongoing, i.e.
       
   164      * OfferReady callback is not yet received. Operation does not
       
   165      * affect on state, hence only synchronous update.
       
   166      *
       
   167      * @since       S60 3.2
       
   168      * @param       aSessionId          Session unique identier.
       
   169      * @param       aOffer              Sdp offer document.
       
   170      */
       
   171     virtual void UpdateL( TUint aSessionId, CSdpDocument*& aOffer ) = 0;
       
   172     
       
   173     /**
       
   174      * Empty INVITE, with certain NAT protocols, can be interpret as request
       
   175      * to restart connection checks. This method must be called is such
       
   176      * a message is received. If 'KNatAsync' return value is used,
       
   177      * then async callbacks OfferReady and AnswerReady are expected.
       
   178      *
       
   179      * @since       S60 3.2
       
   180      * @param       aSessionId          Session unique identier.
       
   181      * @return      NAT status, if async signaling expected.
       
   182      */
       
   183     virtual TNatReturnStatus RestartL( TUint aSessionId ) = 0;
       
   184 
       
   185 
       
   186 public: // data
       
   187 
       
   188     /**
       
   189      * Unique instance identifier key
       
   190      */
       
   191     TUid iDtor_ID_Key;
       
   192     };
       
   193 
       
   194 #include "nspplugin.inl"
       
   195 
       
   196 #endif // NSPPLUGIN_H
       
   197 
       
   198 // end of file