|
1 // Copyright (c) 2006-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 __CSOCKET_H__ |
|
17 #define __CSOCKET_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <in_sock.h> |
|
21 |
|
22 // Forward declarations |
|
23 class MCommsInfoProvider; |
|
24 class CSecureSocketController; |
|
25 class TCertInfo; |
|
26 |
|
27 /** |
|
28 The CSocket class provides an implementation to encapsulate a socket. |
|
29 It provides a limited version of the RSocket API. |
|
30 |
|
31 @internalTechnology |
|
32 @prototype |
|
33 */ |
|
34 class CSocket: public CBase |
|
35 { |
|
36 public: |
|
37 /** |
|
38 The TSocketType enumerates the type of socket, e.g if the socket should be |
|
39 initiased for a specified protocol. |
|
40 */ |
|
41 enum TSocketType |
|
42 { |
|
43 EProtocolSocket = 0, |
|
44 EBlankSocket, |
|
45 }; |
|
46 |
|
47 public: |
|
48 static CSocket* NewL(MCommsInfoProvider& aCommsInfoProvider, TSocketType aSocketType); |
|
49 virtual ~CSocket(); |
|
50 |
|
51 void Connect(TInetAddr& aAddr, TRequestStatus& aStatus); |
|
52 void CancelConnect(); |
|
53 void RecvOneOrMore(TDes8& aBuffer, TRequestStatus& aStatus); |
|
54 void CancelRecv(); |
|
55 void Send(const TDesC8& aBuffer, TRequestStatus& aStatus); |
|
56 void CancelSend(); |
|
57 void RemoteName(TInetAddr& aAddr); |
|
58 void LocalName(TInetAddr& aAddr); |
|
59 void UpgradeToSecureL(TRequestStatus& aStatus, const TDesC8& aSSLDomainName); |
|
60 void CancelUpgradeToSecure(); |
|
61 |
|
62 private: |
|
63 CSocket(MCommsInfoProvider& aCommsInfoProvider); |
|
64 void ConstructL(TSocketType aSocketType); |
|
65 |
|
66 private: |
|
67 MCommsInfoProvider& iCommsInfoProvider; |
|
68 RSocket iSocket; |
|
69 TSockXfrLength iBytesReceived; |
|
70 CSecureSocketController* iSecureSocketController; |
|
71 }; |
|
72 |
|
73 #endif // __CSOCKET_H__ |