|
1 /* |
|
2 * Copyright (c) 2007-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: ICMPv4 receiver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef C_CNCMICMPV4RECEIVER_H |
|
22 #define C_CNCMICMPV4RECEIVER_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <in_sock.h> |
|
27 |
|
28 // FORWARD DECLARATIONS |
|
29 class MNcmSessionObserver; |
|
30 class CNcmIcmpSender; |
|
31 class MNcmIcmpObserver; |
|
32 |
|
33 /** |
|
34 * Receives and handles ICMPv4 errors. |
|
35 * |
|
36 * @lib connectionmux.lib |
|
37 * @since S60 v3.2 |
|
38 */ |
|
39 NONSHARABLE_CLASS( CNcmIcmpV4Receiver ): public CActive |
|
40 { |
|
41 |
|
42 friend class UT_CNcmIcmpReceiver; |
|
43 |
|
44 public: // Constructors and destructor |
|
45 |
|
46 /** |
|
47 * Two-phased constructor |
|
48 * @param aServer Socket server |
|
49 * @param aConnection RConnection |
|
50 * @param aObserver ICMP error observer |
|
51 */ |
|
52 static CNcmIcmpV4Receiver* NewL( RSocketServ& aServer, |
|
53 RConnection& aConnection, MNcmIcmpObserver& aObserver ); |
|
54 |
|
55 virtual ~CNcmIcmpV4Receiver(); |
|
56 |
|
57 public: // From CActive |
|
58 |
|
59 void RunL(); |
|
60 |
|
61 void DoCancel(); |
|
62 |
|
63 private: // Constructors, for internal use |
|
64 |
|
65 CNcmIcmpV4Receiver( RSocketServ& aServer, |
|
66 RConnection& aConnection, MNcmIcmpObserver& aObserver ); |
|
67 |
|
68 void ConstructL(); |
|
69 |
|
70 private: // New functions, for internal use |
|
71 |
|
72 void Receive(); |
|
73 |
|
74 void CheckError(); |
|
75 |
|
76 private: // Data |
|
77 |
|
78 /** |
|
79 * Socket server |
|
80 */ |
|
81 RSocketServ& iServer; |
|
82 |
|
83 /** |
|
84 * RConnection |
|
85 */ |
|
86 RConnection& iConnection; |
|
87 |
|
88 /** |
|
89 * Socket |
|
90 */ |
|
91 RSocket iSocket; |
|
92 |
|
93 /** |
|
94 * ICMP sender |
|
95 * Own. |
|
96 */ |
|
97 CNcmIcmpSender* iIcmpSender; |
|
98 |
|
99 /** |
|
100 * Buffer where data is received from the socket |
|
101 */ |
|
102 TBuf8<64> iData; |
|
103 |
|
104 /** |
|
105 * Address |
|
106 */ |
|
107 TInetAddr iAddress; |
|
108 |
|
109 /** |
|
110 * Observer interface used to receive ICMP error notifies |
|
111 */ |
|
112 MNcmIcmpObserver& iObserver; |
|
113 |
|
114 }; |
|
115 |
|
116 #endif // end of C_CNCMICMPV4RECEIVER_H |
|
117 |
|
118 |