natfw/natfwclient/inc/natfwcallbackinfo.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:   
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef NATFWCALLBACKINFO_H
       
    22 #define NATFWCALLBACKINFO_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32base.h>
       
    26 #include "mnatfwconnectivityobserver.h"
       
    27 
       
    28 // FORWARD DECLARATIONS
       
    29 class MNATFWRegistrationController;
       
    30 
       
    31 /**
       
    32  * This class contains the information to execute a single callback
       
    33  * function of MNATFWConnectivityObserver.
       
    34  */
       
    35 class CNatFwCallbackInfo : public CBase
       
    36     {
       
    37 public: // Enumerations
       
    38 
       
    39         /**
       
    40          * One entry for each function of MNATFWConnectivityObserver,
       
    41          * including all the different TNATFWPluginEvent values. In
       
    42          * addition error value, for error notifications.
       
    43          */
       
    44         enum TFunction
       
    45             {
       
    46             ECreatedSession         = 0x0001,
       
    47             ELocalCandidateFound    = 0x0002,
       
    48             EFetchingEnd            = 0x0004,
       
    49             EActiveReceiving        = 0x0008,
       
    50             EDeactiveReceiving      = 0x0010,
       
    51             EActiveSending          = 0x0020,
       
    52             EDeactiveSending        = 0x0040,
       
    53             ECandidatePairFound     = 0x0080,
       
    54             ECompletedConnChecks    = 0x0100,
       
    55             EError                  = 0x0200
       
    56             };
       
    57 
       
    58 public: // Constructors and destructor
       
    59 
       
    60     /**
       
    61      * Constructor
       
    62      *
       
    63      * @since   s60 3.2
       
    64      * @param   aController Registration controller
       
    65      * @param   aFunction   Identifies the function of
       
    66      *                      MNATFWConnectivityObserver to be called
       
    67      * @param   aSessionId  Session ID
       
    68      * @param   aStreamId   Stream ID
       
    69      * @param   aErrorCode  Error reason
       
    70      * @param   aEventData  Event data if any
       
    71      */
       
    72     CNatFwCallbackInfo( MNATFWRegistrationController& aController,
       
    73                         CNatFwCallbackInfo::TFunction aFunction,
       
    74                         TUint aSessionId,
       
    75                         TUint aStreamId,
       
    76                         TInt aErrorCode,
       
    77                         TAny* aEventData );
       
    78 
       
    79     /**
       
    80      * Checks that the selected callback function has required parameters
       
    81      * defined and that no unrelevant parameters have been specified.
       
    82      *
       
    83      * @since   s60 3.2
       
    84      * @return  Result of validation process as a boolean type
       
    85      */
       
    86     TBool Validate() const;
       
    87 
       
    88     /**
       
    89      * Calls a selected function of observer with the given parameters.
       
    90      * The function to call and the parameters were specified in the
       
    91      * constructor.
       
    92      *
       
    93      * @since   S60 v3.2
       
    94      * @return  void
       
    95      */
       
    96     void Execute() const;
       
    97 
       
    98 private: // Constructors, for internal use
       
    99 
       
   100     CNatFwCallbackInfo();
       
   101 
       
   102     CNatFwCallbackInfo( const CNatFwCallbackInfo& aCallbackInfo );
       
   103 
       
   104 private: // New functions, for internal use
       
   105 
       
   106     /**
       
   107      * Passes events to observer
       
   108      *
       
   109      * @since   S60 v3.2
       
   110      * @param   aEvent      Plugin event
       
   111      * @return  void
       
   112      */
       
   113     void PassEvent(
       
   114         MNATFWConnectivityObserver::TNATFWConnectivityEvent aEvent ) const;
       
   115 
       
   116 public: // Data
       
   117 
       
   118     /**
       
   119      * Que link
       
   120      */
       
   121     TSglQueLink iLink;
       
   122 
       
   123 
       
   124     /**
       
   125      * NAT FW Registration controller
       
   126      * Not own
       
   127      */
       
   128     MNATFWRegistrationController& iController;
       
   129 
       
   130     /**
       
   131      * Selected callback function
       
   132      */
       
   133     TFunction iFunction;
       
   134 
       
   135     /**
       
   136      * Session ID
       
   137      */
       
   138     TUint iSessionId;
       
   139 
       
   140     /**
       
   141      * Stream ID
       
   142      */
       
   143     TUint iStreamId;
       
   144 
       
   145     /**
       
   146      * Error code
       
   147      */
       
   148     TInt iErrorCode;
       
   149 
       
   150     /**
       
   151      * The event data
       
   152      */
       
   153     TAny* iEventData;
       
   154 
       
   155     };
       
   156 
       
   157 #endif // NATFWCALLBACKINFO_H