|
1 // Copyright (c) 2003-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 // tunnelnif.h |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent |
|
21 */ |
|
22 |
|
23 #if (!defined TUNNELBINDERS_H__) |
|
24 #define TUNNELBINDERS_H__ |
|
25 |
|
26 #include <comms-infras/nifif.h> |
|
27 #include <in6_if.h> |
|
28 #include <eui_addr.h> // TE64Addr |
|
29 #include <comms-infras/ss_flowbinders.h> |
|
30 #include <comms-infras/ss_nodemessages.h> |
|
31 #include "tunnelFlow.h" // for CTunnelNcp::Info() |
|
32 |
|
33 using namespace ESock; |
|
34 |
|
35 const TInt KTunnelMtu = 1500; |
|
36 |
|
37 class CTunnelFlow; |
|
38 |
|
39 NONSHARABLE_CLASS(CTunnelNcp) : public CBase, public ESock::MLowerDataSender, public ESock::MLowerControl |
|
40 { |
|
41 public: |
|
42 // from MLowerControl |
|
43 virtual TInt GetName(TDes& aName); |
|
44 virtual TInt BlockFlow(ESock::MLowerControl::TBlockOption /*aOption*/); |
|
45 |
|
46 // from MLowerDataSender |
|
47 virtual ESock::MLowerDataSender::TSendResult Send(RMBufChain& aPdu); |
|
48 |
|
49 // Utility functions called from CTunnelFlow |
|
50 ESock::MLowerDataSender* Bind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl); |
|
51 void Unbind(ESock::MUpperDataReceiver* aUpperReceiver, ESock::MUpperControl* aUpperControl); |
|
52 TBool MatchesUpperControl(const ESock::MUpperControl* aUpperControl); |
|
53 void StartSending(); |
|
54 |
|
55 protected: |
|
56 CTunnelNcp(CTunnelFlow& aFlow); |
|
57 inline const TTunnelInfo* Info(); |
|
58 |
|
59 protected: |
|
60 CTunnelFlow* iFlow; |
|
61 |
|
62 TInetAddr iNameSer1; |
|
63 TInetAddr iNameSer2; |
|
64 |
|
65 ESock::MUpperControl* iUpperControl; |
|
66 ESock::MUpperDataReceiver* iUpperReceiver; |
|
67 }; |
|
68 |
|
69 // ====================================================================================== |
|
70 |
|
71 NONSHARABLE_CLASS(CTunnelNcp4) : public CTunnelNcp |
|
72 { |
|
73 public: |
|
74 static CTunnelNcp4* ConstructL(CTunnelFlow& aLink); |
|
75 |
|
76 // from MLowerDataSender |
|
77 virtual TInt GetConfig(TBinderConfig& aConfig); |
|
78 virtual TInt Control(TUint, TUint, TDes8&); |
|
79 // |
|
80 |
|
81 virtual TInt Notification(TTunnelAgentMessage::TTunnelSetAddress& aMessage); |
|
82 |
|
83 private: |
|
84 CTunnelNcp4(CTunnelFlow& aLink); |
|
85 |
|
86 TUint32 iLocalAddress; |
|
87 }; |
|
88 |
|
89 // ====================================================================================== |
|
90 |
|
91 NONSHARABLE_CLASS(CTunnelNcp6) : public CTunnelNcp |
|
92 { |
|
93 public: |
|
94 static CTunnelNcp6* ConstructL(CTunnelFlow& aLink); |
|
95 |
|
96 // from MLowerDataSender |
|
97 virtual TInt GetConfig(TBinderConfig& aConfig); |
|
98 virtual TInt Control(TUint, TUint, TDes8&); |
|
99 // |
|
100 |
|
101 virtual TInt Notification(TTunnelAgentMessage::TTunnelSetAddress& aMessage); |
|
102 |
|
103 private: |
|
104 CTunnelNcp6(CTunnelFlow& aLink); |
|
105 |
|
106 TInetAddr iLocalAddress; |
|
107 }; |
|
108 |
|
109 // ====================================================================================== |
|
110 |
|
111 class CTunnelNcpLog : public CBase |
|
112 { |
|
113 public: |
|
114 static void Write(const TDesC& aDes); |
|
115 static void Printf(TRefByValue<const TDesC> aFmt, ...); |
|
116 }; |
|
117 |
|
118 // |
|
119 // Inline functions |
|
120 // |
|
121 |
|
122 inline const TTunnelInfo* CTunnelNcp::Info() |
|
123 { |
|
124 return iFlow->Info(); |
|
125 } |
|
126 |
|
127 #endif |