realtimenetprots/sipfw/ProfileAgent/ProxyResolver/src/CProxyQuery.h
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 * Name          : CProxyQuery.h
       
    16 * Part of       : ProxyResolver
       
    17 * Version       : SIP/4.0 
       
    18 *
       
    19 */
       
    20 
       
    21 
       
    22 
       
    23 
       
    24 /**
       
    25  @internalComponent
       
    26 */
       
    27 
       
    28 #ifndef CPROXYQUERY_H
       
    29 #define CPROXYQUERY_H
       
    30 
       
    31 // INCLUDES
       
    32 #include <e32base.h>
       
    33 #include <es_sock.h>
       
    34 #include <comms-infras/es_config.h>
       
    35 #include <badesca.h>
       
    36 #include "MConnObserver.h"
       
    37 #include "CProxyConnectionContainer.h"
       
    38 
       
    39 // FROWARD DECLARATIONS
       
    40 class MQueryObserver;
       
    41 class MSIPProxyResolverObserver;
       
    42 class CProxyConnectionContainer;
       
    43 
       
    44 class CProxyQuery : 
       
    45         public CBase,
       
    46         public MConnObserver
       
    47     {
       
    48 public:
       
    49 
       
    50     static CProxyQuery* NewL(  TUint                      aRequestId, 
       
    51                                TUint32                    aIAPId,
       
    52                                MSIPProxyResolverObserver& aResolverObserver,
       
    53                                MQueryObserver&            aQueryObserver,
       
    54                                RSocketServ&               aServer );
       
    55 
       
    56     static CProxyQuery* NewLC( TUint                      aRequestId,
       
    57                                TUint32                    aIAPId,
       
    58                                MSIPProxyResolverObserver& aResolverObserver,
       
    59                                MQueryObserver&            aQueryObserver,
       
    60                                RSocketServ&               aServer );
       
    61     // destructor
       
    62     ~CProxyQuery ();
       
    63     
       
    64     // get the RConnection object
       
    65     RConnection & Connection();
       
    66     
       
    67     // flag for opening status
       
    68     TBool ConnectionOpened();
       
    69 
       
    70     // ioctl queries passed ok
       
    71     void ResolvingRequestComplete();
       
    72     
       
    73     // ioctl queries failed
       
    74     void ResolvingRequestFailed( TInt aError );
       
    75 
       
    76     //get the request id
       
    77     TUint RequestId() const;
       
    78 
       
    79     // get the IAP id
       
    80     TUint32 IAPId() const;
       
    81 
       
    82     // callback fron CProxyConnectionContainer indicating failure
       
    83     void ErrorOccured( TInt aError );
       
    84     
       
    85     // callback fron CProxyConnectionContainer: RConnection is opened
       
    86     void ConnectionReady();
       
    87             
       
    88     //Get the current query type
       
    89     TUint CurrentQueryType();
       
    90         
       
    91     // access to the current buffer (TSipServerAddrBuf/TSipServerDomainBuf)
       
    92     TDes8*  GetBuf();
       
    93 
       
    94     //Increase the index with one
       
    95     void SetNextIndex();
       
    96     
       
    97     // Set current query type
       
    98     void SetQueryType(const TUint aNewType);
       
    99     
       
   100     //Add results of ioctl query to result array
       
   101     void AddResultsL();
       
   102         
       
   103 public: // Data
       
   104     
       
   105     static const TInt iOffset;
       
   106     TSglQueLink iLink;  
       
   107 
       
   108 private: // Private methods
       
   109 
       
   110     void ConstructL();
       
   111     CProxyQuery( TUint                      aRequestId, 
       
   112                  TUint32                    aIAPId,
       
   113                  MSIPProxyResolverObserver& aResolverObserver,
       
   114                  MQueryObserver&            aQueryObserver,
       
   115                  RSocketServ&               aServer );
       
   116 
       
   117 private: // Data
       
   118 
       
   119     TUint                       iRequestId;             // request id 
       
   120     TUint32                     iIAPId;                 // IAP id
       
   121     MSIPProxyResolverObserver&  iResolverObserver;      // observer (user)
       
   122     MQueryObserver&             iQueryObserver;         // observer (CProxyResolveActor)
       
   123     CProxyConnectionContainer*  iConnCont;              // RConnection class
       
   124     TBool                       iConnectionOpened;      // flag for RConnection status
       
   125     RSocketServ&                iServer;                // socket server
       
   126     TUint                       iCurrentQueryType;      // current query type
       
   127     TSipServerAddrBuf           iSipServerAddrBuf;      //Address buffer        
       
   128     TSipServerDomainBuf         iSipServerDomainBuf;    //Domain name buffer
       
   129     CDesC8ArrayFlat*            iResultsArray;          // result array
       
   130        
       
   131 private:
       
   132 
       
   133 #ifdef CPPUNIT_TEST
       
   134     friend class CProxyQueryTest;    
       
   135     friend class CProxyResolvingQueueTest;
       
   136     friend class CProxyResolveActorTest;    
       
   137 #endif
       
   138     };
       
   139     
       
   140 #endif // CPROXYQUERY_H
       
   141 
       
   142 // End of File