applayerprotocols/telnetengine/SRC/TELRESOL.H
changeset 0 b16258d2340f
equal deleted inserted replaced
-1:000000000000 0:b16258d2340f
       
     1 /*
       
     2 * Copyright (c) 2003 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 _TELRESOL_H_
       
    20 #define _TELRESOL_H_
       
    21 
       
    22 #include <telsess.h>
       
    23 
       
    24 class MTelnetResolver
       
    25 /**
       
    26 @internalComponent
       
    27 */
       
    28 	{
       
    29  public:
       
    30 	virtual void ResolverConnectedL() = 0;
       
    31 	virtual void ResolverDisconnected() = 0;
       
    32 	virtual void ResolverError(TInt aError) = 0;
       
    33 	};
       
    34 
       
    35 NONSHARABLE_CLASS(CTelnetResolver) : public CActive
       
    36 /**
       
    37 @internalComponent
       
    38 */
       
    39 	{
       
    40  public:
       
    41 	enum TResolverState 
       
    42         {
       
    43 		EDisconnected,ELookingUp,EConnecting,EConnected,EShuttingDown,EDisconnecting,EErrorState
       
    44         };
       
    45 	enum TEvent
       
    46         {
       
    47 		ENone,EDoDisconnect,EEofDetected,EErrorEvent
       
    48         };
       
    49  public:
       
    50 	static CTelnetResolver* NewL(MTelnetResolver* aNotifier);
       
    51 	void ConstructL(MTelnetResolver* aNotifier);
       
    52 
       
    53 	TInt	 State(){return(iState);}
       
    54 	RSocket* Socket(){return(&iSocket);}
       
    55 	
       
    56 	TInt IssueConnect(const TDesC& aServerName, TUint aPort);
       
    57 	TInt IssueConnect(const TInetAddr& aInetAddr, TUint aPort);
       
    58 	TInt IssueDisconnect();
       
    59 	void HandleEof();
       
    60 
       
    61 	void DoCancel();
       
    62 	void RunL();
       
    63 	void Event();
       
    64 
       
    65 	CTelnetResolver();
       
    66 	~CTelnetResolver();
       
    67 
       
    68 	void TriggerActive(const TEvent aEvent);
       
    69 
       
    70  private:
       
    71 	RSocketServ iSocketServ;
       
    72 	RHostResolver iResolver;
       
    73 	RSocket iSocket;
       
    74 
       
    75 	TInetAddr iHostAddr;
       
    76 	TNameEntry iNameEntry;
       
    77 	TNameRecord iNameRecord;
       
    78 	TBuf<256> iServerName;
       
    79 
       
    80 	TResolverState iState;
       
    81 	TEvent iEvent;
       
    82 
       
    83 	MTelnetResolver* iNotify;
       
    84 	};
       
    85 
       
    86 #endif