|
1 // wsp_request.h |
|
2 // |
|
3 // Copyright (c) 2002 - 2010 Accenture. All rights reserved. |
|
4 // This component and the accompanying materials are made available |
|
5 // under the terms of the "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 // Accenture - Initial contribution |
|
11 // |
|
12 |
|
13 #ifndef __WSP_REQUEST_H__ |
|
14 #define __WSP_REQUEST_H__ |
|
15 |
|
16 #include <e32std.h> |
|
17 #include <e32base.h> |
|
18 #include "wsp_def.h" |
|
19 |
|
20 |
|
21 class TWin32Message |
|
22 { |
|
23 public: |
|
24 void Set(TInt aOppCode); |
|
25 void Set(TInt aOppCode, TRequestStatus& aCompletionStatus); |
|
26 void Set(TInt aOppCode, const TDesC8& aReadBuf); |
|
27 void Set(TInt aOppCode, const TDesC8& aReadBuf, TRequestStatus& aCompletionStatus); |
|
28 void Set(TInt aOppCode, TDes8& aWriteBuf); |
|
29 void Set(TInt aOppCode, TDes8& aWriteBuf, TRequestStatus& aCompletionStatus); |
|
30 void Set(TInt aOppCode, const TDesC8& aReadBuf, TDes8& aWriteBuf); |
|
31 void Set(TInt aOppCode, const TDesC8& aReadBuf, TDes8& aWriteBuf, TRequestStatus& aCompletionStatus); |
|
32 TInt OppCode() const; |
|
33 const TDesC8& ReadBuffer() const; |
|
34 TDes8& WriteBuffer(); |
|
35 void Complete(TInt aReason); |
|
36 private: |
|
37 friend class TWin32Request; |
|
38 void SetParentThreadHandle(RThread aParentThread); |
|
39 private: |
|
40 TInt iOppCode; |
|
41 const TDesC8* iReadBuf; |
|
42 TDes8* iWriteBuf; |
|
43 TRequestStatus* iCompletionStatus; |
|
44 RThread iParentThread; |
|
45 }; |
|
46 |
|
47 |
|
48 class TWin32Request |
|
49 { |
|
50 public: // Methods used by the ESock thread. |
|
51 TWin32Request(); |
|
52 TInt DuplicateParentThreadHandle(RThread aChildThread); |
|
53 TInt MakeRequest(TWin32Message& aMessage); |
|
54 TInt MakeRequest(TWin32Message& aMessage, TInt aSubSession); |
|
55 public: // Methods used by the WinSock thread. |
|
56 void SetEventHandle(WIN32_HANDLE aEvent); |
|
57 void Requested(TInt aReason); |
|
58 TInt SubSession() const; |
|
59 TWin32Message& Message(); |
|
60 private: |
|
61 TInt MakeRequestAndWait(); |
|
62 private: |
|
63 RThread iParentThread; |
|
64 WIN32_HANDLE iEvent; |
|
65 TRequestStatus iRequestStatus; |
|
66 TWin32Message* iMessage; |
|
67 TInt iSubSession; |
|
68 }; |
|
69 |
|
70 #endif // __WSP_REQUEST_H__ |