realtimenetprots/sipfw/SIP/ServerResolver/src/CSIPQueryA_AAAA.cpp
changeset 0 307788aac0a8
equal deleted inserted replaced
-1:000000000000 0:307788aac0a8
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Name          : CSIPQueryA_AAAA.cpp
       
    15 // Part of       : ServerResolver
       
    16 // Version       : SIP/4.0 
       
    17 //
       
    18 
       
    19 
       
    20 
       
    21 #include <utf.h>
       
    22 #include "CSIPQueryA_AAAA.h"
       
    23 #include "MSIPResolvingResult.h"
       
    24 #include "MSIPHostResolver.h"
       
    25 
       
    26 // ----------------------------------------------------------------------------
       
    27 // CSIPQueryA_AAAA::CSIPQueryA_AAAA
       
    28 // ----------------------------------------------------------------------------
       
    29 //
       
    30 CSIPQueryA_AAAA::CSIPQueryA_AAAA()
       
    31 :CSIPQueryBase()
       
    32 	{
       
    33 	}
       
    34 
       
    35 // ----------------------------------------------------------------------------
       
    36 // CSIPQueryA_AAAA::ConstructL
       
    37 // ----------------------------------------------------------------------------
       
    38 //
       
    39 void CSIPQueryA_AAAA::ConstructL( const TDesC8& aTarget )
       
    40 	{
       
    41 	SetTargetL( aTarget );
       
    42 	}
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // CSIPQueryA_AAAA::NewL
       
    46 // ----------------------------------------------------------------------------
       
    47 //
       
    48 CSIPQueryA_AAAA* CSIPQueryA_AAAA::NewL( const TDesC8& aTarget )
       
    49 	{
       
    50 	CSIPQueryA_AAAA* self = new ( ELeave ) CSIPQueryA_AAAA();
       
    51 	CleanupStack::PushL( self );
       
    52 	self->ConstructL( aTarget );
       
    53 	CleanupStack::Pop( self );
       
    54 	return self;
       
    55 	}
       
    56 
       
    57 // ----------------------------------------------------------------------------
       
    58 // CSIPQueryA_AAAA::~CSIPQueryA_AAAA
       
    59 // ----------------------------------------------------------------------------
       
    60 //
       
    61 CSIPQueryA_AAAA::~CSIPQueryA_AAAA()
       
    62 	{
       
    63 	delete iTarget;
       
    64 	}
       
    65 
       
    66 // ----------------------------------------------------------------------------
       
    67 // CSIPQueryA_AAAA::SetTargetL
       
    68 // ----------------------------------------------------------------------------
       
    69 //
       
    70 void CSIPQueryA_AAAA::SetTargetL( const TDesC8& aTarget )
       
    71 	{
       
    72 	__ASSERT_ALWAYS ( aTarget.Length() > 0, User::Leave( KErrArgument ) );
       
    73 	HBufC* temp = HBufC::NewL( aTarget.Length() );
       
    74 	TPtr targetPtr( temp->Des() );
       
    75 	CleanupStack::PushL( temp );
       
    76 	User::LeaveIfError(
       
    77 		CnvUtfConverter::ConvertToUnicodeFromUtf8( targetPtr, aTarget ) );
       
    78 	delete iTarget;
       
    79 	iTarget = temp;
       
    80 	CleanupStack::Pop( temp );
       
    81 	}
       
    82 
       
    83 // ----------------------------------------------------------------------------
       
    84 // CSIPQueryA_AAAA::QueryResultBuf
       
    85 // ----------------------------------------------------------------------------
       
    86 //
       
    87 TInetAddr CSIPQueryA_AAAA::QueryResultBuf()
       
    88 	{
       
    89 	return iResult = TInetAddr::Cast( iNResult().iAddr );
       
    90 	}
       
    91 		
       
    92 // ----------------------------------------------------------------------------
       
    93 // CSIPQueryA_AAAA::Query
       
    94 // ----------------------------------------------------------------------------
       
    95 //
       
    96 void CSIPQueryA_AAAA::Query( MSIPHostResolver& aResolver )
       
    97 	{
       
    98 	aResolver.Resolver().GetByName( *iTarget,
       
    99 									 iNResult, 
       
   100 									 aResolver.RequestStatus() );		
       
   101 	}
       
   102 
       
   103 // ----------------------------------------------------------------------------
       
   104 // CSIPQueryA_AAAA::QueryNext
       
   105 // ----------------------------------------------------------------------------
       
   106 //
       
   107 TBool CSIPQueryA_AAAA::QueryNext( MSIPHostResolver& aResolver )
       
   108 	{	
       
   109 	TBool result = EFalse;
       
   110 	if( aResolver.Resolver().Next( iNResult ) == KErrNone	)
       
   111 		{
       
   112 		result = ETrue;
       
   113 		}
       
   114 	return result;
       
   115 	}
       
   116 
       
   117 // ----------------------------------------------------------------------------
       
   118 // CSIPQueryA_AAAA::HandleQueryResultL
       
   119 // ----------------------------------------------------------------------------
       
   120 //
       
   121 void CSIPQueryA_AAAA::HandleQueryResultL( MSIPHostResolver& /*aResolver*/ )
       
   122 	{
       
   123 	__ASSERT_ALWAYS ( EFalse, User::Leave( KErrNotSupported ) );	
       
   124 	}
       
   125 
       
   126 // ----------------------------------------------------------------------------
       
   127 // CSIPQueryA_AAAA::DnsNoRoute
       
   128 // ----------------------------------------------------------------------------
       
   129 //
       
   130 TBool CSIPQueryA_AAAA::DnsNoRoute() const
       
   131 	{
       
   132 	TInt flags = iNResult().iFlags;
       
   133 	return ( flags & EDnsNoRoute );
       
   134 	}
       
   135