1 /* |
|
2 * Copyright (c) 2009 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: MSocket interface |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #ifndef MSOCKET_H |
|
21 #define MSOCKET_H |
|
22 |
|
23 // INCLUDES |
|
24 #include <es_sock.h> |
|
25 #include "MSocketWriter.h" |
|
26 |
|
27 // FORWARD DECLARATIONS |
|
28 class RSocket; |
|
29 class MSocketObserver; |
|
30 |
|
31 // CLASS DECLARATION |
|
32 |
|
33 /** |
|
34 * MSocket interface. |
|
35 */ |
|
36 NONSHARABLE_CLASS( MSocket ) : public MSocketWriter |
|
37 { |
|
38 public: |
|
39 virtual ~MSocket() {}; |
|
40 |
|
41 public: // Abstract functions |
|
42 |
|
43 /** |
|
44 * @return RSocket object |
|
45 */ |
|
46 virtual RSocket* GetRSocket() = 0; |
|
47 |
|
48 /** |
|
49 * @return Local TCP port. |
|
50 */ |
|
51 virtual TUint LocalPort() const = 0; |
|
52 |
|
53 /** |
|
54 * @return Remote TCP port. |
|
55 */ |
|
56 virtual TUint RemotePort() const = 0; |
|
57 |
|
58 /** |
|
59 * Sets observer. |
|
60 * @param aObserver Pointer to observer. |
|
61 */ |
|
62 virtual void SetObserver( MSocketObserver* aObserver ) = 0; |
|
63 |
|
64 /** |
|
65 * Sets the ownership mode of RSocket object. If set ETrue |
|
66 * the socket will be closed and RSocket object will be deleted |
|
67 * in the destruction. |
|
68 * @param aHasOwnership Ownership mode. |
|
69 */ |
|
70 virtual void SetSocketOwnershipMode( TBool aHasOwnership ) = 0; |
|
71 |
|
72 /** |
|
73 * Starts receiving data. |
|
74 */ |
|
75 virtual void IssueRead() = 0; |
|
76 |
|
77 /** |
|
78 * Cancels all pending requests. |
|
79 */ |
|
80 virtual void Cancel() = 0; |
|
81 |
|
82 /* |
|
83 * Returns the protocol information of the socket |
|
84 */ |
|
85 virtual void SocketInfo( TProtocolDesc& aDesc) const = 0; |
|
86 |
|
87 /* |
|
88 * Is this a UDP socket |
|
89 */ |
|
90 virtual TBool IsUDP() const = 0; |
|
91 |
|
92 public: // From MSocketWriter |
|
93 /** |
|
94 * Issues writing data to socket. |
|
95 * @param aData Data to be written. |
|
96 */ |
|
97 virtual void WriteL( const TDesC8& aData ) = 0; |
|
98 }; |
|
99 |
|
100 #endif // MSOCKET_H |
|
101 |
|
102 // End of File |
|