|
1 /* |
|
2 * Copyright (c) 2008-2009 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: Sender of UDP datagrams |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_IKEV1SENDER_H |
|
20 #define C_IKEV1SENDER_H |
|
21 |
|
22 #include <e32base.h> |
|
23 |
|
24 // FORWARD DECLARATIONS |
|
25 class MIkeDataInterface; |
|
26 class MIkeDebug; |
|
27 class TInetAddr; |
|
28 |
|
29 /** |
|
30 * IKEv1 sender callback interface. |
|
31 * Callback interface which is used by CIkev1Sender object to notify |
|
32 * about completion of sending. |
|
33 * |
|
34 * @lib internal (ikev1lib.lib) |
|
35 */ |
|
36 NONSHARABLE_CLASS(MIkev1SenderCallback) |
|
37 { |
|
38 public: |
|
39 /** |
|
40 * Notifies about completion of sending. |
|
41 * @param aStatus Completion status |
|
42 */ |
|
43 virtual void SendUdpDataCompleted( TInt aStatus ) = 0; |
|
44 |
|
45 }; |
|
46 |
|
47 /** |
|
48 * IKEv1 sender. |
|
49 * Active object provides functionality for sending UDP datagrams. |
|
50 * |
|
51 * @lib internal (ikev1lib.lib) |
|
52 */ |
|
53 NONSHARABLE_CLASS(CIkev1Sender) : public CActive |
|
54 { |
|
55 public: |
|
56 /** |
|
57 * Two-phased constructor. |
|
58 * @param aDataInterface IKE data interface |
|
59 * @param aCallback Callback interface |
|
60 * @param aDebug Debug trace interface |
|
61 */ |
|
62 static CIkev1Sender* NewL( MIkeDataInterface& aDataInterface, |
|
63 MIkev1SenderCallback& aCallback, |
|
64 MIkeDebug& aDebug ); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 ~CIkev1Sender(); |
|
70 |
|
71 /** |
|
72 * Sends UDP data. |
|
73 * @param aUdpData UDP data. Ownership transferred. |
|
74 * @param aDestAddr Destination IP address/port |
|
75 * @param aLocalPort Local port |
|
76 * @param aDscp DSCP value |
|
77 */ |
|
78 void SendUdpData( HBufC8* aUdpData, |
|
79 const TInetAddr& aDestAddr, |
|
80 TInt aLocalPort, |
|
81 TUint8 aDscp ); |
|
82 |
|
83 private: |
|
84 |
|
85 CIkev1Sender( MIkeDataInterface& aDataInterface, |
|
86 MIkev1SenderCallback& aCallback, |
|
87 MIkeDebug& aDebug ); |
|
88 |
|
89 // from base class CActive |
|
90 |
|
91 /** |
|
92 * From CActive |
|
93 * Handles completion of asynchronous sending. |
|
94 */ |
|
95 void RunL(); |
|
96 |
|
97 /** |
|
98 * From CActive |
|
99 * Handles cancellation of asynchronous sending. |
|
100 */ |
|
101 void DoCancel(); |
|
102 |
|
103 private: // data |
|
104 |
|
105 /** |
|
106 * UDP data. |
|
107 * Own. |
|
108 */ |
|
109 HBufC8* iUdpData; |
|
110 |
|
111 /** |
|
112 * IKE data interface. |
|
113 * Not own. |
|
114 */ |
|
115 MIkeDataInterface& iDataInterface; |
|
116 |
|
117 /** |
|
118 * Callback interface. |
|
119 * Not own. |
|
120 */ |
|
121 MIkev1SenderCallback& iCallback; |
|
122 |
|
123 /** |
|
124 * Debug trace interface. |
|
125 * Not own. |
|
126 */ |
|
127 MIkeDebug& iDebug; |
|
128 }; |
|
129 |
|
130 #endif // C_IKEV1SENDER_H |