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