|
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 // |
|
15 |
|
16 #if !defined(__PROXYPROTOCOL_H) |
|
17 #define __PROXYPROTOCOL_H |
|
18 |
|
19 #include "es_ptestinternalsocket.h" |
|
20 #include <es_prot.h> |
|
21 #include <comms-infras/nifif.h> |
|
22 #include <dns_qry.h> |
|
23 |
|
24 |
|
25 enum TDPanic |
|
26 { |
|
27 EBadProtocol = 1000, |
|
28 EBadCall = 1001, |
|
29 ENotBound = 1002, |
|
30 ENotStarted = 1003, |
|
31 EInterfaceNotDeleted = 1004, |
|
32 EIdAndNoHolder = 1005, |
|
33 EIfAndHolder = 1006, |
|
34 ETestPanic = 1007 |
|
35 }; |
|
36 |
|
37 void Panic(TDPanic aPanic); |
|
38 |
|
39 NONSHARABLE_CLASS(CProxyProtocol): public CProtocolBase |
|
40 { |
|
41 public: |
|
42 |
|
43 ~CProxyProtocol(); |
|
44 |
|
45 static CProxyProtocol *NewL(TInt aProtocol, TServerProtocolDesc* aProtoDesc); |
|
46 CServProviderBase *NewSAPL(TUint aProtocol); |
|
47 TBool CanCreateSockets(); |
|
48 void InitL(TDesC& aTag); |
|
49 void BindL(CProtocolBase *aProtocol, TUint anId); |
|
50 virtual void BindToL(CProtocolBase *protocol); |
|
51 void StartL(void); |
|
52 TInt Send(RMBufChain &,CProtocolBase* aSourceProtocol); |
|
53 void Process(RMBufChain &,CProtocolBase* aSourceProtocol); |
|
54 TInt Send(TDes8 &, TSockAddr *to,TSockAddr *from,CProtocolBase* aSourceProtocol); |
|
55 void Process(TDes8 & ,TSockAddr *from,TSockAddr *to,CProtocolBase* aSourceProtocol); |
|
56 void Identify(TServerProtocolDesc *)const; |
|
57 TInt GetOption(TUint level,TUint name,TDes8 &anOption,CProtocolBase* aSourceProtocol); |
|
58 TInt SetOption(TUint level,TUint name,const TDesC8& option,CProtocolBase* aSourceProtocol); |
|
59 void Error(TInt anError,CProtocolBase* aSourceProtocol); |
|
60 TBool IsStarted(){return iStarted;} |
|
61 private: |
|
62 CProxyProtocol(TServerProtocolDesc* aProtoDesc); |
|
63 |
|
64 private: |
|
65 TInt iType; |
|
66 TServerProtocolDesc* iProtoDesc; |
|
67 TBool iStarted; |
|
68 CArrayFixFlat<CProtocolBase *> iProtocols; |
|
69 }; |
|
70 |
|
71 class MTestStepNotify |
|
72 { |
|
73 public: |
|
74 virtual void AboutToShutdown() = 0; |
|
75 }; |
|
76 |
|
77 NONSHARABLE_CLASS(CProxyProvd) : public CServProviderBase |
|
78 { |
|
79 public: |
|
80 static CProxyProvd *NewL(CProxyProtocol &aProtocol); |
|
81 virtual void Ioctl(TUint level,TUint name,TDes8 *anOption); |
|
82 void SetTestStepNotify(MTestStepNotify* aNotify) { iTestStepNotify = aNotify; } |
|
83 void TestComplete(TProxyProtocolTestResult result); |
|
84 |
|
85 void LocalName(TSockAddr &anAddr)const; |
|
86 virtual TInt SetLocalName(TSockAddr &anAddr); |
|
87 virtual void RemName(TSockAddr &anAddr)const; |
|
88 virtual TInt SetRemName(TSockAddr &anAddr); |
|
89 virtual TInt GetOption(TUint level,TUint name,TDes8 &anOption)const; |
|
90 virtual TInt SetOption(TUint level,TUint name,const TDesC8 &anOption); |
|
91 |
|
92 virtual void CancelIoctl(TUint aLevel,TUint aName); |
|
93 virtual TInt Write(RMBufChain& aData, TUint options, TSockAddr* anAddr=NULL); |
|
94 virtual TUint Write(const TDesC8& aDesc, TUint options, TSockAddr* anAddr); |
|
95 virtual TInt GetData(RMBufChain& aData, TUint aLength, TUint options,TSockAddr* anAddr=NULL); |
|
96 virtual void GetData(TDes8& aDesc,TUint options,TSockAddr* anAddr=NULL); |
|
97 virtual void ActiveOpen(void); |
|
98 virtual void ActiveOpen(const TDesC8 &aConnectionData); |
|
99 virtual TInt PassiveOpen(TUint aQue); |
|
100 virtual TInt PassiveOpen(TUint aQue,const TDesC8 &aConnectionData); |
|
101 virtual void AutoBind( void ); |
|
102 virtual void Shutdown(TCloseType option); |
|
103 virtual void Shutdown(TCloseType option,const TDesC8 &aDisconnectData); |
|
104 virtual void Start(); |
|
105 |
|
106 private: |
|
107 CProxyProvd(CProxyProtocol &aProtocol); |
|
108 |
|
109 private: |
|
110 TBool iIsBound; |
|
111 CProxyProtocol *iProtocol; |
|
112 MTestStepNotify *iTestStepNotify; |
|
113 TSockAddr iAddr; |
|
114 TBool iInputStopped; |
|
115 TInt iListenErrorCode; |
|
116 TBool iCancelIoctl; // Set when an IOCTL has been cancelled. |
|
117 |
|
118 TBool iBlockOnClose; //Used by and test Ioctl to cause the socket to hang on close |
|
119 TBool iCompleteIoctl; |
|
120 }; |
|
121 |
|
122 #endif //__PROXYPROTOCOL_H |
|
123 |