|
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 |
|
20 #ifndef __TESTTCPSERVER_H_ |
|
21 #define __TESTTCPSERVER_H_ |
|
22 |
|
23 // System Includes |
|
24 #include <comms-infras/eintsock.h> |
|
25 #include <es_mbuf.h> |
|
26 #include <comms-infras/mbufchain.h> |
|
27 |
|
28 #include <rsockethandler.h> |
|
29 #include <csocketopener.h> |
|
30 |
|
31 class MTestServerObserver; |
|
32 class CTestServerSocketHandler; |
|
33 class MTcpClientTestCase; |
|
34 |
|
35 //----------------------------------------------------------// |
|
36 /////////////////// CTestTcpServer ///////////////////////// |
|
37 //----------------------------------------------------------// |
|
38 |
|
39 class CTestTcpServer : public CBase, |
|
40 public MSocketHandlerObserver |
|
41 { |
|
42 public: |
|
43 static CTestTcpServer* NewL ( MTestServerObserver& aObserver ); |
|
44 ~CTestTcpServer (); |
|
45 |
|
46 private: |
|
47 TInt OpenSocket (); |
|
48 TInt Startup (); |
|
49 void Shutdown (); |
|
50 void DoSendL ( RMBufChain& aData, TBool& aRecvAgain ); |
|
51 void DoAccept (); |
|
52 |
|
53 // From MSocketHandlerObserver |
|
54 void OpenComplete ( RInternalSocket& aSocket ) ; |
|
55 void ConnectComplete () |
|
56 { } |
|
57 void AcceptComplete ( RInternalSocket& aSocket ); |
|
58 void SendComplete ( TInt /*aLength*/ ) |
|
59 { } |
|
60 void SendToComplete ( TInt /*aLength*/ ) |
|
61 { } |
|
62 void RecvComplete ( RMBufChain& /*aData*/ ) |
|
63 { } |
|
64 void RecvFromComplete ( RMBufChain& /*aData*/, const TSockAddr& /*aAddr*/ ) |
|
65 { } |
|
66 void IoctlComplete () |
|
67 { } |
|
68 void Error ( TOperation /*aOperation*/, TInt /*aError*/ ) |
|
69 { } |
|
70 |
|
71 private: |
|
72 CTestTcpServer ( MTestServerObserver& aObserver ); |
|
73 void ConstructL (); |
|
74 |
|
75 private: |
|
76 MTestServerObserver& iObserver; |
|
77 RSocketHandler iSocketHandler; |
|
78 RInternalSocket iSocket; |
|
79 CSocketOpener* iSocketOpener; |
|
80 |
|
81 MTcpClientTestCase* iTestCase; // Not owned |
|
82 RPointerArray<CTestServerSocketHandler> iIncomingHandlers; |
|
83 }; |
|
84 |
|
85 #endif /*__TESTTCPSERVER_H_*/ |