|
1 /* |
|
2 * Copyright (c) 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <es_prot.h> |
|
20 #include <e32test.h> |
|
21 #include "es_ptest.h" |
|
22 #include <comms-infras/nifif.h> |
|
23 #include <es_mbuf.h> |
|
24 #include "ss_std.h" |
|
25 #include <ss_pman.h> |
|
26 #include <ss_glob.h> |
|
27 #include <es_mbman.h> |
|
28 #include <e32math.h> |
|
29 #include <dns_qry.h> |
|
30 #include <agenterrors.h> |
|
31 #include <e32property.h> |
|
32 |
|
33 #include "proxyprotocol.h" |
|
34 #include "protocolfamily.h" |
|
35 |
|
36 extern "C" |
|
37 { |
|
38 IMPORT_C CProtocolFamilyBase* InstallProxy(void); // Force export |
|
39 |
|
40 EXPORT_C CProtocolFamilyBase * InstallProxy(void) |
|
41 // |
|
42 // Create a new protocol family |
|
43 // |
|
44 { |
|
45 CTestIntSocketProtocolFamily* protocolFamily = NULL; |
|
46 TRAP_IGNORE(protocolFamily = CTestIntSocketProtocolFamily::NewL()); |
|
47 return protocolFamily; |
|
48 } |
|
49 } |
|
50 |
|
51 CTestIntSocketProtocolFamily* CTestIntSocketProtocolFamily::NewL() |
|
52 // |
|
53 // |
|
54 // |
|
55 { |
|
56 CTestIntSocketProtocolFamily* pf=new(ELeave) CTestIntSocketProtocolFamily(); |
|
57 CleanupStack::PushL(pf); |
|
58 pf->ConstructL(); |
|
59 CleanupStack::Pop(); |
|
60 return pf; |
|
61 } |
|
62 |
|
63 void CTestIntSocketProtocolFamily::ConstructL() |
|
64 // |
|
65 // |
|
66 // |
|
67 { |
|
68 // Force a fail on Memory tests |
|
69 char* ptr=new(ELeave) char; |
|
70 delete ptr; |
|
71 |
|
72 } |
|
73 |
|
74 CTestIntSocketProtocolFamily::CTestIntSocketProtocolFamily() : CProtocolFamilyBase() |
|
75 { |
|
76 iProtocolDescs[0].iAddrFamily=KProxyAddrFamily; |
|
77 iProtocolDescs[0].iSockType=KSockDatagram; // not important whether datagram or stream for proxy |
|
78 iProtocolDescs[0].iProtocol=KProxy; |
|
79 iProtocolDescs[0].iVersion=TVersion(KPTestIntSocketMajor,KPTestIntSocketMinor,KPTestIntSocketBuild); |
|
80 iProtocolDescs[0].iByteOrder=EBigEndian; |
|
81 iProtocolDescs[0].iServiceInfo=kDDatagramServiceInfo|KSIPeekData; |
|
82 iProtocolDescs[0].iSecurity=KSocketNoSecurity; |
|
83 iProtocolDescs[0].iMessageSize=0x300; |
|
84 iProtocolDescs[0].iName=KProxyName; |
|
85 iProtocolDescs[0].iServiceTypeInfo=ESocketSupport|ECantProcessMBufChains; |
|
86 iProtocolDescs[0].iNamingServices=KNSNameResolution|KNSServiceResolution|KNSInfoDatabase; |
|
87 iProtocolDescs[0].iNumSockets=100; |
|
88 /* |
|
89 iProtocolDescs[1].iAddrFamily=KProxyAddrFamily; |
|
90 iProtocolDescs[1].iSockType=KSockDatagram; |
|
91 iProtocolDescs[1].iProtocol=KTargetDatagram; |
|
92 iProtocolDescs[1].iVersion=TVersion(KPTestIntSocketMajor,KPTestIntSocketMinor,KPTestIntSocketBuild); |
|
93 iProtocolDescs[1].iByteOrder=EBigEndian; |
|
94 iProtocolDescs[1].iServiceInfo=kDDatagramServiceInfo|KSIPeekData; |
|
95 iProtocolDescs[1].iSecurity=KSocketNoSecurity; |
|
96 iProtocolDescs[1].iMessageSize=0x300; |
|
97 iProtocolDescs[1].iName=KTargetDatagramName; |
|
98 iProtocolDescs[1].iServiceTypeInfo=ESocketSupport|ECantProcessMBufChains; |
|
99 iProtocolDescs[1].iNamingServices=KNSNameResolution|KNSServiceResolution|KNSInfoDatabase; |
|
100 iProtocolDescs[1].iNumSockets=100; |
|
101 |
|
102 iProtocolDescs[2].iAddrFamily=KProxyAddrFamily; |
|
103 iProtocolDescs[2].iSockType=KSockStream; |
|
104 iProtocolDescs[2].iProtocol=KTargetStream; |
|
105 iProtocolDescs[2].iVersion=TVersion(KPTestIntSocketMajor,KPTestIntSocketMinor,KPTestIntSocketBuild); |
|
106 iProtocolDescs[2].iByteOrder=EBigEndian; |
|
107 iProtocolDescs[2].iServiceInfo=KDStreamServiceInfo; |
|
108 iProtocolDescs[2].iSecurity=KSocketNoSecurity; |
|
109 iProtocolDescs[2].iMessageSize=KSocketMessageSizeIsStream; |
|
110 iProtocolDescs[2].iName=KTargetStreamName; |
|
111 iProtocolDescs[2].iServiceTypeInfo=ESocketSupport|ECantProcessMBufChains; |
|
112 iProtocolDescs[2].iNamingServices=0; |
|
113 iProtocolDescs[2].iNumSockets=100; |
|
114 */ |
|
115 __DECLARE_NAME(_S("CTestIntSocketProtocolFamily")); |
|
116 } |
|
117 |
|
118 #pragma warning( disable : 4100 ) |
|
119 |
|
120 TInt CTestIntSocketProtocolFamily::Install() |
|
121 { |
|
122 // Force a fail on Memory tests |
|
123 char* ptr=new char; |
|
124 if (!ptr) |
|
125 return KErrNoMemory; |
|
126 delete ptr; |
|
127 // TAppProtIntfMessage::RegisterL (); |
|
128 return KErrNone; |
|
129 } |
|
130 |
|
131 TInt CTestIntSocketProtocolFamily::Remove() |
|
132 { |
|
133 //TAppProtIntfMessage::DeRegister (); |
|
134 return KErrNone; |
|
135 } |
|
136 |
|
137 TUint CTestIntSocketProtocolFamily::ProtocolList(TServerProtocolDesc *& aProtocolDescPointer) |
|
138 { |
|
139 |
|
140 aProtocolDescPointer=new TServerProtocolDesc[KPTestIntSocketNumProtocols]; |
|
141 if (!aProtocolDescPointer) |
|
142 return 0; |
|
143 |
|
144 Mem::Copy(aProtocolDescPointer, iProtocolDescs, sizeof(TServerProtocolDesc)*KPTestIntSocketNumProtocols); |
|
145 |
|
146 TRAP_IGNORE(Nif::CheckInstalledMBufManagerL();) |
|
147 |
|
148 return KPTestIntSocketNumProtocols; |
|
149 }; |
|
150 |
|
151 CProtocolBase * CTestIntSocketProtocolFamily::NewProtocolL(TUint /* aSockType */,TUint aProtocol) |
|
152 { |
|
153 |
|
154 CProtocolBase* p=CProxyProtocol::NewL(aProtocol, &iProtocolDescs[aProtocol-1]); |
|
155 return p; |
|
156 } |
|
157 |
|
158 |