|
1 // Copyright (c) 1998-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 // Test Enviroment for protocol code |
|
15 // |
|
16 // |
|
17 |
|
18 #ifndef _TESTENV_H_ |
|
19 #define _TESTENV_H_ |
|
20 |
|
21 #include <e32std.h> |
|
22 #include <e32test.h> |
|
23 #include <c32comm.h> |
|
24 #include <in_sock.h> |
|
25 |
|
26 extern RTest Test; |
|
27 extern RSocketServ SocketServer; |
|
28 extern RHeap* TestHeap; |
|
29 |
|
30 const TInt KEchoPort = 7; |
|
31 const TInt KChargenPort = 19; |
|
32 const TInt KDiscardPort = 9; |
|
33 const TInt KTestPort = 9; |
|
34 |
|
35 const TInt KSmallBufSize = 256; |
|
36 const TInt KLargeBufSize = 2048; |
|
37 const TInt KHugeBufSize = 16384; |
|
38 |
|
39 typedef TBuf8<KSmallBufSize> TSmallBuf; |
|
40 typedef TBuf8<KLargeBufSize> TLargeBuf; |
|
41 typedef TBuf8<KHugeBufSize> THugeBuf; |
|
42 |
|
43 |
|
44 void CommInitL(TBool aEnhanced); |
|
45 TInt AsyncStart(); |
|
46 |
|
47 #define TEST(a) DoTest((a), __FILE__, __LINE__, 0) |
|
48 #define TESTE(a,b) DoTest((a), __FILE__, __LINE__, b) |
|
49 void WaitKey(); |
|
50 void DoTest(TBool aCondition, char* aFile, TInt aLine, TInt aErr); |
|
51 |
|
52 void SockStart(); |
|
53 void SockClose(); |
|
54 |
|
55 #define IPADDR(a,b,c,d) (TUint32)(((a)<<24)|((b)<<16)|((c)<<8)|(d)) |
|
56 |
|
57 |
|
58 void StripeMem(TUint8 *aBuf, TInt aStartPos, TInt anEndPos, TUint aStartChar, TUint anEndChar, TInt aOffset=0); |
|
59 void StripeDes(TDes8 &aBuf, TInt aStartPos, TInt anEndPos, TUint aStartChar, TUint anEndChar, TInt aOffset=0); |
|
60 TBool CheckMem(TUint8 *aBuf, TInt aStartPos, TInt anEndPos, TUint aStartChar, TUint anEndChar, TInt aOffset=0); |
|
61 TBool CheckDes(TDes8 &aBuf, TInt aStartPos, TInt anEndPos, TUint aStartChar, TUint anEndChar, TInt aOffset=0); |
|
62 void StripeMem32(TUint *aBuf, TInt aStartPos, TInt aEndPos); |
|
63 void StripeDes32(TDes8 &aBuf, TInt aStartPos, TInt anEndPos); |
|
64 |
|
65 |
|
66 class TIoBuf : public TPtr8 |
|
67 { |
|
68 public: |
|
69 TIoBuf(); |
|
70 ~TIoBuf(); |
|
71 TInt Alloc(TUint aSize); |
|
72 }; |
|
73 |
|
74 void OutputInetAddr(TDes& aBuf, TUint32 aAddr); |
|
75 void GetHostByName(TNameRecord& aRecord, const TDesC& aHost); |
|
76 void GetHostByAddr(TNameRecord& aRecord, const TInetAddr& aAddr); |
|
77 void GetHostName(THostName& aName); |
|
78 void GetHostAddr(TInetAddr& aAddr); |
|
79 |
|
80 #endif |