|
1 // Copyright (c) 2004-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 // testhook.h - hook plugin for outbound packets |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef __TESTHOOK_H |
|
19 #define __TESTHOOK_H |
|
20 |
|
21 #include <in_bind.h> |
|
22 |
|
23 |
|
24 class CTestFlowInfo; |
|
25 |
|
26 class CTestProtocol : public CIp6Hook |
|
27 { |
|
28 public: |
|
29 CTestProtocol(); |
|
30 virtual ~CTestProtocol(); |
|
31 |
|
32 //CIp6Hook::CProtocolBase |
|
33 virtual void InitL(TDesC& aTag); |
|
34 virtual void StartL(); |
|
35 virtual void BindToL(CProtocolBase* aProtocol); |
|
36 virtual void BindL(CProtocolBase* /*aProtocol*/, TUint /*aId*/); |
|
37 virtual void Unbind(CProtocolBase* /*aProtocol*/, TUint /*aId*/); |
|
38 virtual void Identify(TServerProtocolDesc *aDesc) const; |
|
39 virtual TInt SetFlowOption(TUint aLevel, TUint aName, const TDesC8 &aOption, CFlowContext &aFlow); |
|
40 static void FillIdentification(TServerProtocolDesc& aDesc); |
|
41 |
|
42 //CIp6Hook::MIp6Hook |
|
43 // never called because binded only as outbound |
|
44 virtual TInt ApplyL(RMBufHookPacket& /*aPacket*/, RMBufRecvInfo& /*aInfo*/){ |
|
45 return KIp6Hook_PASS;} |
|
46 |
|
47 //Outbound Flow |
|
48 virtual MFlowHook *OpenL(TPacketHead& /*aHead*/, CFlowContext *aFlow); |
|
49 |
|
50 private: |
|
51 CProtocolInet6Binder* iIPProtocol; |
|
52 TDblQue<CTestFlowInfo> iFlowList; |
|
53 TInt iSessionId; |
|
54 }; |
|
55 |
|
56 class CTestFlowInfo : public CBase, public MFlowHook |
|
57 { |
|
58 public: |
|
59 void Open(); |
|
60 TInt ReadyL(TPacketHead &); |
|
61 TInt ApplyL(RMBufSendPacket &, RMBufSendInfo &); |
|
62 void Close(); |
|
63 |
|
64 CTestProtocol *iMgr; |
|
65 TInt iRefs; |
|
66 TDblQueLink iDLink; |
|
67 |
|
68 static const TInt iOffset; |
|
69 |
|
70 CFlowContext* iFlow; |
|
71 }; |
|
72 |
|
73 #endif |