|
1 // Copyright (c) 2001-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 // Started by MWT, February 1998 |
|
15 // |
|
16 // |
|
17 |
|
18 #if !defined (__TraceRtENG_H__) |
|
19 #define __TraceRtENG_H__ |
|
20 |
|
21 #if !defined(__IN_SOCK_H__) |
|
22 #include <in_sock.h> |
|
23 #endif |
|
24 |
|
25 |
|
26 class MTraceRtNotificationHandler |
|
27 { |
|
28 public: |
|
29 virtual void Starting(const TNameRecord& aTo, TInt aTtl, TInt aDataLen)=0; |
|
30 virtual void Probe(TInt aTtl) = 0; |
|
31 virtual void Reply(TInt aNo, TInt aDelta, TUint aId) = 0; |
|
32 virtual void FromHost(const TNameRecord& aHost) = 0; |
|
33 virtual void Finished(TInt aError) =0; |
|
34 }; |
|
35 |
|
36 class TTraceRtOptions |
|
37 { |
|
38 public: |
|
39 IMPORT_C TTraceRtOptions(); |
|
40 TUint iMaxTtl; |
|
41 TBool iResolveAddress; |
|
42 TTimeIntervalMicroSeconds32 iWait; |
|
43 TUint iTos; |
|
44 THostName iDestname; |
|
45 TInt iNrProbes; |
|
46 TBool iPrompt; |
|
47 }; |
|
48 |
|
49 |
|
50 class CTraceRtTimer; |
|
51 class CTraceRtSender; |
|
52 class CTraceRtReceiver; |
|
53 class HTraceRtHeader; |
|
54 |
|
55 |
|
56 class CTraceRtEng : public CBase |
|
57 { |
|
58 friend class CTraceRtTimer; |
|
59 friend class CTraceRtSender; |
|
60 friend class CTraceRtReceiver; |
|
61 |
|
62 public: |
|
63 IMPORT_C static CTraceRtEng* NewL(MTraceRtNotificationHandler& aUi); |
|
64 IMPORT_C ~CTraceRtEng(); |
|
65 |
|
66 IMPORT_C void SetPriorities(TInt aTimerPriority, TInt aSenderPriority, TInt aReceiverPriority); |
|
67 IMPORT_C void Start(const TTraceRtOptions& aOptions); |
|
68 IMPORT_C void Cancel(); |
|
69 IMPORT_C void CancelAndFinished(); |
|
70 |
|
71 protected: |
|
72 IMPORT_C void ConstructL(MTraceRtNotificationHandler& aUi); |
|
73 IMPORT_C CTraceRtEng(); |
|
74 |
|
75 private: |
|
76 void TimerComplete(); |
|
77 void SendComplete(); |
|
78 void SendDoCancel(); |
|
79 void RecvComplete(); |
|
80 void RecvDoCancel(); |
|
81 void NextSend(); |
|
82 void ResolveReply(); |
|
83 void DoError(TInt aError); |
|
84 |
|
85 |
|
86 enum TState { EStopped, ELookingUpHost, ESending, ELookingUpReply }; |
|
87 |
|
88 TState iState; |
|
89 MTraceRtNotificationHandler* iUi; |
|
90 CTraceRtTimer *iTimer; |
|
91 CTraceRtSender *iSender; |
|
92 CTraceRtReceiver *iReceiver; |
|
93 TTraceRtOptions iOptions; |
|
94 RSocketServ iSocketServ; |
|
95 RSocket iIcmpSocket; |
|
96 RHostResolver iResolver; |
|
97 TNameEntry iNameEntry; |
|
98 TInetAddr iSrcAddr; |
|
99 TInetAddr iDstAddr; |
|
100 |
|
101 HTraceRtHeader *iRecvData; |
|
102 HTraceRtHeader *iSendData; |
|
103 |
|
104 TInt iProbeNr; |
|
105 TUint iTtl; |
|
106 TBool iGotThere; |
|
107 TInt iUnreachCount; |
|
108 TTime iSendTime; |
|
109 TUint iLastCode; |
|
110 |
|
111 RConnection iConnect; |
|
112 TBool iResolv; |
|
113 |
|
114 TInt iSeq; |
|
115 TInt iIdent; |
|
116 }; |
|
117 |
|
118 enum TTraceRtDefaultPriorites |
|
119 { |
|
120 ETraceRtTimerPriority=10, |
|
121 ETraceRtSenderPriority=20, |
|
122 ETraceRtReceiverPriority=30, |
|
123 }; |
|
124 |
|
125 // ICMP Type and Code values |
|
126 const TUint KTraceRtTypeEchoReply = 0; |
|
127 const TUint KTraceRtCodeEcho = 0; |
|
128 const TUint KTraceRtTypeEchoRequest = 8; |
|
129 const TUint KTraceRtTypeUnreachable = 3; |
|
130 const TUint KTraceRtCodeUnreachNet = 0; |
|
131 const TUint KTraceRtCodeUnreachHost = 1; |
|
132 const TUint KTraceRtCodeUnreachProtocol = 2; |
|
133 const TUint KTraceRtCodeUnreachPort = 3; |
|
134 const TUint KTraceRtCodeUnreachNeedFrag = 4; |
|
135 const TUint KTraceRtCodeUnreachSrcRouteFail = 5; |
|
136 const TUint KTraceRtCodeUnreachNetUnknown = 6; |
|
137 const TUint KTraceRtCodeUnreachHostUnknown = 7; |
|
138 const TUint KTraceRtCodeUnreachSrcHostIsolated = 8; |
|
139 const TUint KTraceRtCodeUnreachNetProhibited = 9; |
|
140 const TUint KTraceRtCodeUnreachHostProhibited = 10; |
|
141 const TUint KTraceRtCodeUnreachNetTOS = 11; |
|
142 const TUint KTraceRtCodeUnreachHostTOS = 12; |
|
143 const TUint KTraceRtCodeUnreachProhibited = 13; |
|
144 const TUint KTraceRtCodeUnreachPrecVolation = 14; |
|
145 const TUint KTraceRtCodeUnreachPrecCutoff = 15; |
|
146 const TUint KTraceRtTypeTimeExceeded = 11; |
|
147 const TUint KTraceRtCodeExceedInTransit = 0; |
|
148 const TUint KTraceRtCodeExceedInReasm = 1; |
|
149 const TUint KTraceRtCodeTimeout = KMaxTUint; |
|
150 const TUint KTraceRtCodeTimedOutInTransit = KMaxTUint-1; |
|
151 const TUint KTraceRtCodeEchoReply = KMaxTUint-2; |
|
152 |
|
153 #endif |
|
154 |