natfw/natfwstunturnclient/inc/mstunbindingobserver.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     1 /*
       
     2 * Copyright (c) 2005 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 M_STUNBINDINGOBSERVER_H
       
    22 #define M_STUNBINDINGOBSERVER_H
       
    23 
       
    24 // INCLUDES
       
    25 #include <e32def.h>
       
    26 #include "natfwunsaftransactionid.h"
       
    27 #include "tstuncallbackinfo.h"
       
    28 #include "natfwstunclientdefs.h"
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 class CSTUNClient;
       
    32 class CBinding;
       
    33 
       
    34 // CLASS DECLARATION
       
    35 
       
    36 /**
       
    37  *  Defines the services that CSTUNClientImplementation provides to
       
    38  *  CSTUNBinding.
       
    39  */
       
    40 class MSTUNBindingObserver
       
    41     {
       
    42 public: // Destructor
       
    43 
       
    44     /**
       
    45       * Destructor
       
    46      */
       
    47     virtual ~MSTUNBindingObserver() {}
       
    48 
       
    49 public: // New pure virtual functions
       
    50 
       
    51     /**
       
    52     * Returns the associated CSTUNClient instance.
       
    53     *
       
    54     * @return CSTUNClient
       
    55     */
       
    56     virtual const CSTUNClient& STUNClient() const = 0;
       
    57 
       
    58     /**
       
    59      * Retrieves the user timer service provider.
       
    60      * @return CDeltaTimer& Timer services
       
    61      */
       
    62     virtual CDeltaTimer& TimerProvider() = 0;
       
    63     
       
    64     /**
       
    65      * Retrieves the retransmission interval to use with Binding Requests.
       
    66      * @return Retransmission interval
       
    67      */
       
    68     virtual TInt RetransmitInterval() const = 0;
       
    69 
       
    70     /**
       
    71      * Retrieves the transport protocol to use with Binding Requests.
       
    72      * @return Transport protocol
       
    73      */
       
    74     virtual TTransportProtocol TransportProtocol() const = 0;
       
    75     
       
    76     /**
       
    77      * Binding has obtained a public IP address.
       
    78      * @param aBinding Binding for which the address was obtained
       
    79      */
       
    80     virtual void AddressResolvedL( const CBinding& aBinding ) const = 0;
       
    81 
       
    82     /**
       
    83      * Requests a shared secret (username and password).
       
    84      * STUN client provides the username and password to binding with
       
    85      * SharedSecretObtainedL function. If STUN client is currently retrieving a
       
    86      * new shared secret after the previous one expired, it may take some time
       
    87      * until it calls SharedSecretObtainedL.
       
    88      * @param aBinding Binding requesting the information
       
    89      */
       
    90     virtual void ObtainSharedSecretL( CBinding& aBinding ) = 0;
       
    91 
       
    92     /**
       
    93      * Inform the STUN client that a remote server has rejected certain
       
    94      * username and password.
       
    95      * @param aBinding Binding that was using the username and password.
       
    96      * @param aUsername Username that was rejected. Can be empty (zero length)
       
    97      *          descriptor, if STUN server provided such a value.
       
    98      * @param aPassword Password that was rejected. Can be empty (zero length)
       
    99      *          descriptor, if STUN server provided such a value.
       
   100      * @return ETrue if the Binding should retry, EFalse if binding should
       
   101      *           terminate.
       
   102      */
       
   103     virtual TBool SharedSecretRejectedL( const CBinding& aBinding,
       
   104                                          const TDesC8& aUsername,
       
   105                                          const TDesC8& aPassword ) = 0;
       
   106 
       
   107     /**
       
   108      * Requests the UDP address of a STUN server, where the Binding Request
       
   109      * will be sent.
       
   110      * @param aAddress IN: The address that this binding has already tried but
       
   111      *                       failed because the STUN server did not respond, or
       
   112      *                       there was a UNSAF transport layer error.
       
   113      *                       If the binding has not yet sent a Binding Request,
       
   114      *                       then aAddress should contain an unspecified address
       
   115      *                       (for IPv4 it means address 0.0.0.0, and for IPv6 an
       
   116      *                       address of ::).
       
   117      *                   OUT: The address that binding should try next.
       
   118      * @return ETrue  Address successfully obtained
       
   119      *           EFalse No address available
       
   120      */
       
   121     virtual TBool ObtainServerAddress( TInetAddr& aAddress ) = 0;
       
   122 
       
   123     /**
       
   124      * Requests a new UNSAF transaction ID.
       
   125      * @param aTransactionID OUT: New TransactionID
       
   126      */
       
   127     virtual void
       
   128         ObtainTransactionIDL( TNATFWUNSAFTransactionID& aTransactionID ) = 0;
       
   129     
       
   130     /**
       
   131      * A new binding has been created and it is associated with the STUN
       
   132      * client.
       
   133      * @param aBinding Binding to attach
       
   134      */
       
   135     virtual void AttachBindingL( const CBinding& aBinding ) = 0;
       
   136 
       
   137     /**
       
   138      * CSTUNBinding is being deleted, all references to it must be cleared,
       
   139      * including any pending callbacks referring to it.
       
   140      * @param aBinding Binding to detach
       
   141      */
       
   142     virtual void DetachBinding( const CBinding& aBinding ) = 0;
       
   143 
       
   144     /**
       
   145      * CSTUNBinding has terminated because an error occurred.
       
   146      * @param aBinding Binding that encountered the error
       
   147      * @param aError Error reason
       
   148      * @param aIsFatal ETrue if error is unrecoverable
       
   149      */
       
   150     virtual void BindingErrorL( const CBinding& aBinding,
       
   151                                 TInt aError, TBool aIsFatal ) = 0;
       
   152     
       
   153     /**
       
   154      * Binding event occurred, client must be notified
       
   155      * 
       
   156      * @since   s60 3.2
       
   157      * @param   aBinding Binding
       
   158      * @param   aEvent  event
       
   159      * @return  void
       
   160      */
       
   161     virtual void BindingEventOccurred( 
       
   162         const CBinding& aBinding, TSTUNCallbackInfo::TFunction aEvent ) = 0;
       
   163     
       
   164     /**
       
   165      * Get username for indication
       
   166      * 
       
   167      * @since   s60 3.2
       
   168      * @return  username
       
   169      */
       
   170     virtual const TDesC8& UsernameForIndication() = 0;
       
   171     
       
   172     /**
       
   173      * Get password for indication
       
   174      * 
       
   175      * @since   s60 3.2
       
   176      * @return  password
       
   177      */
       
   178     virtual const TDesC8& PasswordForIndication() = 0;
       
   179     };
       
   180 
       
   181 #endif // M_STUNBINDINGOBSERVER_H