inc/natfwstunclientobserver.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2006-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:    Provides STUN Client state information.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 
       
    21 #ifndef MSTUNCLIENTOBSERVER_H
       
    22 #define MSTUNCLIENTOBSERVER_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32std.h>
       
    26 
       
    27 class CSTUNClient;
       
    28 class CBinding;
       
    29 
       
    30 /**
       
    31  * An observer that must be realized by the client in order to
       
    32  * receive notifications about asynchronous STUN events.
       
    33  * This class supports also STUN relay usage.
       
    34  * 
       
    35  * @lib  natfwstunclient.lib
       
    36  */
       
    37 class MSTUNClientObserver
       
    38     {
       
    39 public:
       
    40     
       
    41     /**  All STUN/STUN relay binding events */
       
    42     enum TSTUNBindingEvent
       
    43         {
       
    44         /** 
       
    45          * A public address was obtained for a CSTUNBinding 
       
    46          * or for a CSTUNRelayBinding.
       
    47          * The resolved address(es) can be queried from the binding.
       
    48          * Those addresses are server reflexive IP address and
       
    49          * STUN relay IP address.
       
    50          */
       
    51         EPublicAddressResolved,
       
    52         
       
    53         /** 
       
    54          * STUN server rejected the credentials provided that were set with
       
    55          * CSTUNClient::SetCredentialsL. Application should obtain valid
       
    56          * credentials and then use CSTUNClient::SetCredentialsL.
       
    57          */
       
    58         ECredentialsRejected,
       
    59         
       
    60         EActiveDestinationSet,
       
    61         
       
    62         ETCPConnectOk
       
    63         };
       
    64 
       
    65     /**
       
    66      * Indicates that asynchronous initialization of the related
       
    67      * CSTUNClient has been completed and it can be used
       
    68      * for creating CSTUNBinding(s) or CSTUNRelayBinding(s).
       
    69      *
       
    70      * @param   aClient the client for which the initialization 
       
    71      *          was completed.
       
    72      * @param   aCompletionCode value KErrNone indicates that 
       
    73      *          the client instance is ready for creating CSTUNBinding(s)
       
    74      *          and/or CSTUNRelayBinding(s).
       
    75      *          Any other completion code indicates that 
       
    76      *          the client instance cannot be used and should be deleted.
       
    77      * @return  void
       
    78      */
       
    79     virtual void STUNClientInitCompleted( 
       
    80         const CSTUNClient& aClient, TInt aCompletionCode ) = 0;   
       
    81 
       
    82     /**
       
    83      * A STUN/STUN Relay binding related event occurred. After this callback
       
    84      * the aBinding can be used again by calling its SendRequestL or 
       
    85      * AllocateRequestL method.
       
    86      *
       
    87      * @param   aEvent the STUN/STUN relay binding related event
       
    88      * @param   aBinding the STUN binding that is the target for the event.
       
    89      * @return  void
       
    90      */
       
    91     virtual void STUNBindingEventOccurredL( 
       
    92         TSTUNBindingEvent aEvent, const CBinding& aBinding ) = 0;
       
    93 
       
    94     /**
       
    95      * Error occurred during IP address resolution.
       
    96      * This callback will also be called if STUNBindingEventOccuredL leaves.
       
    97      *
       
    98      * @param   aBinding a binding for which the error occured
       
    99      * @param   aError error code.
       
   100      * @errors  401: Client MUST set long term credentials and try again.
       
   101      *              Realm can be read from existing binding through 
       
   102      *              RealmFromResponse().
       
   103      *          300: Client should use alternate server address,
       
   104      *              which can be fetched from binding through 
       
   105      *              AlternateServer() -method. After fetching server binding
       
   106      *              must be destroyed.
       
   107      *          434: Client should use realm with long term credentials.
       
   108      *              Realm can be read from existing binding through 
       
   109      *              RealmFromResponse().
       
   110      *          487: ICE specific error code - role conflict occured.
       
   111      * @return  void
       
   112      */
       
   113     virtual void STUNBindingErrorOccurred( const CBinding& aBinding,
       
   114         TInt aError ) = 0;
       
   115     };
       
   116 
       
   117 #endif // MSTUNCLIENTOBSERVER_H
       
   118