|
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 // pingmodel.h - icmp echo client engine |
|
15 // |
|
16 |
|
17 |
|
18 |
|
19 /** |
|
20 @internalComponent |
|
21 */ |
|
22 #ifndef __ENGINE_H |
|
23 #define __ENGINE_H |
|
24 |
|
25 #include <es_sock.h> |
|
26 #include <in_sock.h> |
|
27 |
|
28 //#include <nifmbuf.h> |
|
29 |
|
30 const TInt KHostNameLimit = 80; |
|
31 |
|
32 class CNslookupContainer; |
|
33 |
|
34 const TUint KPingQuiet = 0x01; |
|
35 const TUint KPingVerbose = 0x02; |
|
36 const TUint KPingPackLimit = 0x04; |
|
37 const TUint KPingDebug = 0x08; |
|
38 |
|
39 //Contains engine's saved preferences |
|
40 class TPreferences |
|
41 { |
|
42 public: |
|
43 TBuf<80> iHostname; |
|
44 }; |
|
45 |
|
46 |
|
47 class CNslookup : public CActive |
|
48 { |
|
49 public: |
|
50 CNslookup(); |
|
51 ~CNslookup(); |
|
52 |
|
53 void ConstructL(const TPreferences& aPref); |
|
54 |
|
55 //return the current preferences |
|
56 void GetPreferences(TPreferences &aPref) const; |
|
57 static void DefaultPreferences(TPreferences &aPref); |
|
58 void SetConsole(CNslookupContainer *aConsole); |
|
59 const TDesC* GetHostName() const; |
|
60 void SetHostName(const TDes& ahostname); |
|
61 |
|
62 void EndNslookup(); |
|
63 TBool IsRunning() const; |
|
64 void BeginL(); |
|
65 |
|
66 protected: |
|
67 void RunL(); //Segment of code to execute |
|
68 void DoCancel(); //Stops Execution of Ping |
|
69 |
|
70 private: |
|
71 void DisableRemoteLink(); |
|
72 void Error(const TDesC& string, TInt error); |
|
73 void Stop(); |
|
74 |
|
75 /** |
|
76 * Outputs some text about the Resolver Query() response to the console |
|
77 */ |
|
78 void QueryResponse(); |
|
79 |
|
80 private: |
|
81 |
|
82 CNslookupContainer *iConsole; |
|
83 RSocketServ iSockServ; // Socket Server |
|
84 RHostResolver iHostResolv; // Resolver |
|
85 TBuf<KHostNameLimit> iHostname; // Contains name to resolve |
|
86 TInetAddr iAddress; // Address to reverse |
|
87 TInt iCount; // Successful resolves. |
|
88 TNameEntry iEntry; //contains address resolution data |
|
89 TBuf8<1024> iResult; |
|
90 |
|
91 public: |
|
92 TInetAddr iHostAddr; //Address to Ping |
|
93 TUint iQueryType; //< Query type select from the dialog choice list. |
|
94 TBool iShowSource; //< Show source address for each resolved address. |
|
95 }; |
|
96 |
|
97 #endif |