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