|
1 /* |
|
2 * Copyright (c) 2006-2007 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: TCP receiver |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #include "cncmtcpreceiver.h" |
|
22 #include "ncmconnectionmultiplexerlogs.h" |
|
23 |
|
24 |
|
25 // --------------------------------------------------------------------------- |
|
26 // CNcmTcpReceiver::CNcmTcpReceiver |
|
27 // --------------------------------------------------------------------------- |
|
28 // |
|
29 CNcmTcpReceiver::CNcmTcpReceiver( RSocket& aSocket, |
|
30 MNcmReceiverSenderObserver& aObserver ) : |
|
31 CNcmReceiver( aSocket, aObserver ) |
|
32 { |
|
33 } |
|
34 |
|
35 |
|
36 // --------------------------------------------------------------------------- |
|
37 // CNcmTcpReceiver::NewL |
|
38 // --------------------------------------------------------------------------- |
|
39 // |
|
40 CNcmTcpReceiver* CNcmTcpReceiver::NewL( RSocket& aSocket, |
|
41 MNcmReceiverSenderObserver& aObserver ) |
|
42 { |
|
43 __CONNECTIONMULTIPLEXER( "CNcmTcpReceiver::NewL" ) |
|
44 |
|
45 CNcmTcpReceiver* self = CNcmTcpReceiver::NewLC( aSocket, aObserver ); |
|
46 CleanupStack::Pop( self ); |
|
47 return self; |
|
48 } |
|
49 |
|
50 |
|
51 // --------------------------------------------------------------------------- |
|
52 // CNcmTcpReceiver::NewLC |
|
53 // --------------------------------------------------------------------------- |
|
54 // |
|
55 CNcmTcpReceiver* CNcmTcpReceiver::NewLC( RSocket& aSocket, |
|
56 MNcmReceiverSenderObserver& aObserver ) |
|
57 { |
|
58 __CONNECTIONMULTIPLEXER( "CNcmTcpReceiver::NewLC start" ) |
|
59 |
|
60 CNcmTcpReceiver* self = new( ELeave ) CNcmTcpReceiver( |
|
61 aSocket, aObserver ); |
|
62 |
|
63 CleanupStack::PushL( self ); |
|
64 return self; |
|
65 } |
|
66 |
|
67 |
|
68 // --------------------------------------------------------------------------- |
|
69 // CNcmTcpReceiver::~CNcmTcpReceiver |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 CNcmTcpReceiver::~CNcmTcpReceiver() |
|
73 { |
|
74 __CONNECTIONMULTIPLEXER( "CNcmTcpReceiver::~CNcmTcpReceiver" ) |
|
75 } |
|
76 |
|
77 |
|
78 // --------------------------------------------------------------------------- |
|
79 // From class CNcmReceiver |
|
80 // |
|
81 // CNcmTcpReceiver::DoReceive |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 void CNcmTcpReceiver::DoReceive() |
|
85 { |
|
86 __CONNECTIONMULTIPLEXER( "CNcmTcpReceiver::DoReceive" ) |
|
87 |
|
88 if ( !IsActive() ) |
|
89 { |
|
90 iSocket.RecvOneOrMore( iBuffer, 0, iStatus, iSockDataLength ); |
|
91 SetActive(); |
|
92 } |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // CNcmTcpReceiver::SetDestination |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void CNcmTcpReceiver::SetDestination( const TInetAddr& aDestination ) |
|
101 { |
|
102 __CONNECTIONMULTIPLEXER( "CNcmTcpReceiver::SetDestination start" ) |
|
103 |
|
104 iFromAddr = aDestination; |
|
105 } |