upnp/upnpstack/messagehandler/inc/upnpipfilteringdnsquery.h
changeset 0 f5a58ecadc66
equal deleted inserted replaced
-1:000000000000 0:f5a58ecadc66
       
     1 /** @file
       
     2 * Copyright (c) 2008-2008 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 #ifndef C_CUPNPIPFILTERINGDNSQUERY_H
       
    20 #define C_CUPNPIPFILTERINGDNSQUERY_H
       
    21 
       
    22 #include <e32cmn.h>
       
    23 #include <in_sock.h>
       
    24 #include <ES_SOCK.H>
       
    25 
       
    26 #include "upnpipfiltering.h"
       
    27 
       
    28  /**
       
    29  *  Encapsulates DNS query
       
    30  *
       
    31  *  @since S60 v3.2
       
    32  */
       
    33 class CUpnpIPFilteringDNSQuery : public CActive
       
    34     {
       
    35 
       
    36 private:
       
    37 
       
    38     enum TActionType
       
    39         {
       
    40         EAddAddress,
       
    41         ERemoveAddress,
       
    42         };
       
    43 
       
    44 public:
       
    45     /**
       
    46     * Two-phased constructor.
       
    47     * @param aMessage a messagy which will ber cmpleted when queris resoves name
       
    48     * @param aRemoteName a name to be resolved by DNS server
       
    49     */
       
    50     static CUpnpIPFilteringDNSQuery* NewL( const RMessage2& aMessage, 
       
    51                                            const TDesC8& aRemoteName );
       
    52      
       
    53     /**
       
    54     * Two-phased constructor.
       
    55     * @param aMessage a messagy which will ber cmpleted when queris resoves name
       
    56     * @param aRemoteName a name to be resolved by DNS server
       
    57     */
       
    58     static CUpnpIPFilteringDNSQuery* NewLC( const RMessage2& aMessage, 
       
    59                                             const TDesC8& aRemoteName );
       
    60 
       
    61     /**
       
    62     * Destructor.
       
    63     */
       
    64     virtual ~CUpnpIPFilteringDNSQuery();
       
    65     
       
    66     /**
       
    67     * Marks current query as addAddress
       
    68     */    
       
    69     void AddAddress( );
       
    70     
       
    71     /**
       
    72     * Marks current query as removeAddress
       
    73     */    
       
    74     void RemoveAddress( );
       
    75     
       
    76     /**
       
    77     * Starts to process current query
       
    78     * @param 
       
    79     * @param aConnection an network interface which will be used during queries
       
    80     * @param aListOwner here we store results of queries
       
    81     */    
       
    82     void StartDNSQuery( RSocketServ& aSockServ, RConnection& aConnection , 
       
    83                         CUpnpIPFiltering* aListOwner ); 
       
    84     
       
    85 public://from CActive
       
    86      
       
    87     /**
       
    88     * Completes with query result
       
    89     */
       
    90     void RunL();    
       
    91     
       
    92     /**
       
    93     * Handels leaves from RunL method
       
    94     */
       
    95     TInt RunError( TInt aError );
       
    96    
       
    97     
       
    98 private:
       
    99     /**
       
   100     * Constructor
       
   101     */
       
   102     CUpnpIPFilteringDNSQuery( const RMessage2& aMessage );
       
   103 
       
   104     /**
       
   105     * Two-phased constructor.
       
   106     */
       
   107     void ConstructL( const TDesC8& aRemoteName );
       
   108     
       
   109     void RequestCompleted( TInt aStatus );
       
   110     
       
   111     /**
       
   112     * Evaluates query result
       
   113     */
       
   114     TInt Status( TInt aStatus );
       
   115     
       
   116 private://from CActive
       
   117     
       
   118     void DoCancel();
       
   119 
       
   120 private: 
       
   121 
       
   122     RHostResolver iHostResolver;        //owned
       
   123     TActionType iAction;
       
   124     RBuf iRemoteName;                   //owned
       
   125     TNameEntry iAddrDetails;
       
   126     
       
   127     TInt iDNSStatus;
       
   128     const RMessage2 iMessage;           //not owned
       
   129     
       
   130     CUpnpIPFiltering* iIPListOwner;     //not owned
       
   131     };
       
   132 
       
   133 #endif // C_CUPNPIPFILTERINGDNSQUERY_H