author | Petteri Saari <petteri.saari@digia.com> |
Thu, 25 Nov 2010 13:59:42 +0200 | |
branch | MSRP_FrameWork |
changeset 58 | cdb720e67852 |
parent 25 | 505ad3f0ce5c |
permissions | -rw-r--r-- |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
1 |
/* |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
2 |
* Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
3 |
* All rights reserved. |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
5 |
* under the terms of "Eclipse Public License v1.0" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html." |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
8 |
* Initial Contributors: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
9 |
* Nokia Corporation - initial contribution. |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
10 |
* Contributors: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
11 |
* |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
12 |
* Description: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
13 |
* MSRP Implementation |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
14 |
* |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
15 |
*/ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
16 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
17 |
// CLASS HEADER |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
18 |
#include "CMSRPConnection.h" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
19 |
#include "MSRPCommon.h" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
20 |
// INTERNAL INCLUDES |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
21 |
#include "CMSRPConnector.h" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
22 |
#include "CMSRPReader.h" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
23 |
#include "CMSRPParser.h" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
24 |
#include "CMSRPWriter.h" |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
25 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
26 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
27 |
// Constructor |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
28 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
29 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
30 |
CMSRPConnection::CMSRPConnection( TInetAddr& aRemoteAddr, MMSRPConnectionManager& aConnMngr ): iHostAddress(aRemoteAddr), iConnMngr(aConnMngr) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
31 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
32 |
MSRPLOG( "CMSRPConnection::CMSRPConnection enter" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
33 |
MSRPLOG( "CMSRPConnection::CMSRPConnection exit" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
34 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
35 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
36 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
37 |
// CMSRPConnection::~CMSRPConnection |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
38 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
39 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
40 |
CMSRPConnection::~CMSRPConnection() |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
41 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
42 |
MSRPLOG( "CMSRPConnection::~CMSRPConnection enter" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
43 |
iSubsessions.Reset(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
44 |
iSubsessions.Close(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
45 |
delete iListenTimer; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
46 |
delete iConnector; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
47 |
delete iWriter; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
48 |
delete iParser; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
49 |
delete iReader; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
50 |
//delete iBufPool; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
51 |
if(iSocket) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
52 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
53 |
iSocket->Close(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
54 |
delete iSocket; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
55 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
56 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
57 |
MSRPLOG( "CMSRPConnection::~CMSRPConnection exit" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
58 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
59 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
60 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
61 |
// CMSRPConnection* CMSRPConnection::NewL |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
62 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
63 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
64 |
/*static*/ MMSRPConnection* CMSRPConnection::NewL( TInetAddr& aRemoteAddr, MMSRPConnectionManager& aConnMngr ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
65 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
66 |
MSRPLOG( "CMSRPConnection::NewL enter" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
67 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
68 |
// Perform construction. |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
69 |
CMSRPConnection* self = new ( ELeave ) CMSRPConnection(aRemoteAddr, aConnMngr); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
70 |
CleanupStack::PushL( self ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
71 |
self->ConstructL( ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
72 |
CleanupStack::Pop( self ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
73 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
74 |
MSRPLOG( "CMSRPConnection::NewL exit" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
75 |
return self; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
76 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
77 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
78 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
79 |
// CMSRPConnection::ConstructL |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
80 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
81 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
82 |
void CMSRPConnection::ConstructL( ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
83 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
84 |
MSRPLOG( "CMSRPConnection::ConstructL enter" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
85 |
iConnectionState = ENotConnected; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
86 |
iListenTimer = CMSRPTimeOutTimer::NewL( *this ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
87 |
MSRPLOG( "CMSRPConnection::ConstructL exit" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
88 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
89 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
90 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
91 |
// CMSRPConnection::CheckIfConnected |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
92 |
// listening state check for validating listener connections |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
93 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
94 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
95 |
TBool CMSRPConnection::CheckConnection(TInetAddr& aRemoteAddr, TBool aOnlyListen) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
96 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
97 |
MSRPLOG( "CMSRPConnection::CheckConnection enter" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
98 |
TUint port_stored = iHostAddress.Port(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
99 |
TUint port_connect = aRemoteAddr.Port(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
100 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
101 |
//if (iHostAddress.CmpAddr(aRemoteAddr))//v4, v6 issue |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
102 |
if (iHostAddress.Match(aRemoteAddr) && port_stored == port_connect) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
103 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
104 |
if (aOnlyListen && iConnectionState == EListening) //check if listening |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
105 |
return ETrue; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
106 |
else if (!aOnlyListen /*&& iConnectionState <= EConnected */) //not connected, connecting, listening, connected |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
107 |
return ETrue; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
108 |
/*else |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
109 |
return EFalse;*/ //timed out, disconnecting, disconnected, create a new conn object |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
110 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
111 |
MSRPLOG( "CMSRPConnection::CheckConnection exit" ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
112 |
return EFalse; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
113 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
114 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
115 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
116 |
// CMSRPConnection::ConnectL |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
117 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
118 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
119 |
TInt CMSRPConnection::ConnectL(MMSRPConnectionObserver& aSubsession) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
120 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
121 |
MSRPLOG("CMSRPConnection::ConnectL() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
122 |
//subsession to ensure it does not reissue |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
123 |
//connection does not check for pre-existent observers |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
124 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
125 |
iSubsessions.AppendL(&aSubsession); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
126 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
127 |
switch(iConnectionState) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
128 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
129 |
case ENotConnected: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
130 |
//create connector and issue connect |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
131 |
//delete iConnector; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
132 |
iConnector = CMSRPConnector::NewL( iConnMngr, *this ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
133 |
iConnector->Connect(iHostAddress); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
134 |
iConnectionState = EConnecting; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
135 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
136 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
137 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
138 |
case EConnecting: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
139 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
140 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
141 |
case EListening: //as of now, dont try to issue connect,complete when other party connects |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
142 |
//TBD |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
143 |
//later change state to connecting and issue connect |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
144 |
//if connect completes before listen, then change state to connected |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
145 |
// if at all listen completes on same conn object, then check if state == connected and drop listen conn |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
146 |
// do vice versa if listen completes before connect |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
147 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
148 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
149 |
case EConnected: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
150 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
151 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
152 |
case EListenTimedOut: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
153 |
case EConnectTimedOut: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
154 |
case EError: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
155 |
//shudn't reach here, if connect issued immediately after/within getConn |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
156 |
//User::Leave(MMSRPConnectionObserver::EConnectionStateUnexpected); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
157 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
158 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
159 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
160 |
MSRPLOG("CMSRPConnection::ConnectL() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
161 |
return iConnectionState; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
162 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
163 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
164 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
165 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
166 |
// CMSRPConnection::ListenL |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
167 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
168 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
169 |
TInt CMSRPConnection::ListenL(MMSRPConnectionObserver& aSubsession) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
170 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
171 |
MSRPLOG("CMSRPConnection::ListenL() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
172 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
173 |
iSubsessions.AppendL(&aSubsession); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
174 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
175 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
176 |
switch(iConnectionState) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
177 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
178 |
case ENotConnected: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
179 |
iConnectionState = EListening; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
180 |
iConnMngr.ListenL(this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
181 |
//iListenTimer->After( KListenTimeoutInSeconds * KSecondinMicroseconds ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
182 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
183 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
184 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
185 |
case EConnecting: //dont issue listen, drop conn if other party connects, change later |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
186 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
187 |
//added check if listening in check connection to prevent accepting conn, |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
188 |
//simply allowing will corrupt listen count, TBD: introduce another EListeningandConnecting state |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
189 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
190 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
191 |
case EListening: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
192 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
193 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
194 |
case EConnected: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
195 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
196 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
197 |
case EListenTimedOut: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
198 |
case EConnectTimedOut: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
199 |
case EError: |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
200 |
//shudn't reach here, if connect issued immediately after/within getConn |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
201 |
//User::Leave(MMSRPConnectionObserver::EConnectionStateUnexpected); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
202 |
break; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
203 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
204 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
205 |
MSRPLOG("CMSRPConnection::ListenL() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
206 |
return iConnectionState; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
207 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
208 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
209 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
210 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
211 |
// CMSRPConnection::ReleaseConnection |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
212 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
213 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
214 |
void CMSRPConnection::ReleaseConnection(MMSRPConnectionObserver& aSubsession) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
215 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
216 |
MSRPLOG("CMSRPConnection::ReleaseConnection() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
217 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
218 |
Remove(&aSubsession); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
219 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
220 |
if(iSubsessions.Count()) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
221 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
222 |
MSRPLOG("CMSRPConnection::ReleaseConnection() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
223 |
return; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
224 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
225 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
226 |
//if no subsessions (TBD : start timeout timer and disconnect on timeout) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
227 |
/*if(iConnectionState == EConnecting) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
228 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
229 |
//iConnector->CancelConnect(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
230 |
delete iConnector; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
231 |
iConnector = NULL; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
232 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
233 |
else if(iConnectionState == EConnected)*/ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
234 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
235 |
CloseConnection(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
236 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
237 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
238 |
//iConnectionState = ENotConnected; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
239 |
MSRPLOG("CMSRPConnection::ReleaseConnection() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
240 |
return; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
241 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
242 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
243 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
244 |
// CMSRPConnection::ConnectionEstablishedL |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
245 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
246 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
247 |
void CMSRPConnection::ConnectionEstablishedL( TInt aNewState, RSocket* aSocket, TInt aStatus ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
248 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
249 |
MSRPLOG("CMSRPConnection::ConnectionEstablishedL() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
250 |
iListenTimer->Cancel(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
251 |
//if not error |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
252 |
if(aNewState == EConnected) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
253 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
254 |
iConnectionState = aNewState; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
255 |
iSocket = aSocket; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
256 |
if(iConnector) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
257 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
258 |
iConnector->ConnectComplete(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
259 |
/*dont delete now,as in case of leave, connector needs 2 b available*/ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
260 |
//delete iConnector; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
261 |
//iConnector = NULL; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
262 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
263 |
iWriter = CMSRPWriter::NewL(*iSocket , *this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
264 |
iParser = CMSRPParser::NewL(*this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
265 |
iReader = CMSRPReader::NewL(*iSocket , *this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
266 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
267 |
iReader->StartReceivingL(iBufPool.ProvideBufferL()); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
268 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
269 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
270 |
/*not deleting connector as yet, notify all could leave in subsession and also delete conn on conn error*/ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
271 |
//intimate all subsessions |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
272 |
NotifyAllL(aNewState, aStatus ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
273 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
274 |
//on error or connect timeout close connection, i.e. intimate all subsessions and delete connection obj |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
275 |
if(aStatus != KErrNone) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
276 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
277 |
//listenaccepted does not comeback with error intimations, hence safe to decrement listen count |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
278 |
//currently no risk of double decrementing listener count |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
279 |
//CloseConnection(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
280 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
281 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
282 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
283 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
284 |
MSRPLOG("CMSRPConnection::ConnectionEstablishedL() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
285 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
286 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
287 |
TInt CMSRPConnection::getConnectionState() |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
288 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
289 |
return iConnectionState; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
290 |
// iConnection state should not be Tint, it should be MMSRPConnection::TMSRPConnectionState. |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
291 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
292 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
293 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
294 |
// CMSRPConnection::ReadStatus |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
295 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
296 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
297 |
void CMSRPConnection::ReadStatusL(RMsrpBuf& aBuf, TInt aStatus) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
298 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
299 |
MSRPLOG("CMSRPConnection::ReadStatusL() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
300 |
if(aStatus == KErrNone) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
301 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
302 |
//post to parser and return immediate |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
303 |
iParser->ParseL(aBuf); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
304 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
305 |
RMsrpBuf copy(aBuf); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
306 |
if(copy.MsrpRightExtract() > KThreshold) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
307 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
308 |
iReader->StartReceivingL(copy); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
309 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
310 |
else |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
311 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
312 |
iReader->StartReceivingL(iBufPool.ProvideBufferL()); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
313 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
314 |
return; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
315 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
316 |
//read error or connection error |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
317 |
//intimate all subsessions |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
318 |
NotifyAllL(EError, aStatus ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
319 |
//CloseConnection(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
320 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
321 |
MSRPLOG("CMSRPConnection::ReadStatusL() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
322 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
323 |
|
58
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
324 |
TInt CMSRPConnection::ParseStatusL (CMSRPMessageHandler* aMsg, TInt aStatus) |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
325 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
326 |
MSRPLOG("CMSRPConnection::ParseStatus enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
327 |
if (aStatus != KErrNone) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
328 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
329 |
NotifyAllL(EError, aStatus ); |
58
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
330 |
return MMSRPParserObserver::EParseStatusError; |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
331 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
332 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
333 |
/*if error, count is zero*/ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
334 |
//while msg not consumed try to handover |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
335 |
TBool consumed = FALSE; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
336 |
for ( TInt i = 0; (!consumed) && i < iSubsessions.Count(); i++ ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
337 |
{ |
58
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
338 |
TRAPD( err, consumed = iSubsessions[ i ]->MessageReceivedL( aMsg ) ); |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
339 |
if ( err ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
340 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
341 |
// invalid message |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
342 |
NotifyAllL( EError, err ); |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
343 |
return MMSRPParserObserver::EParseStatusError; |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
344 |
} |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
345 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
346 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
347 |
//if unclaimed by any subsession, callback to first subsession |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
348 |
if(!consumed && iSubsessions.Count()) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
349 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
350 |
iSubsessions[0]->UnclaimedMessageL( aMsg ); |
58
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
351 |
return MMSRPParserObserver::EParseStatusMessageUnclaimed; |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
352 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
353 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
354 |
MSRPLOG("CMSRPConnection::ParseStatus exit") |
58
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
355 |
return MMSRPParserObserver::EParseStatusMessageHandled; |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
356 |
} |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
357 |
|
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
358 |
// ----------------------------------------------------------------------------- |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
359 |
// CMSRPConnection::ReportReceiveprogressL |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
360 |
// ----------------------------------------------------------------------------- |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
361 |
// |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
362 |
void CMSRPConnection::ReportReceiveprogressL( CMSRPMessageHandler* aMsg ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
363 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
364 |
MSRPLOG("-> CMSRPConnection::ReportReceiveprogressL") |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
365 |
|
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
366 |
for ( TInt i = 0; i < iSubsessions.Count(); i++ ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
367 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
368 |
TRAPD( err, iSubsessions[ i ]->MessageReceiveProgressL( aMsg ) ); |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
369 |
if ( err ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
370 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
371 |
// invalid message |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
372 |
NotifyAllL( EError, err ); |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
373 |
return; |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
374 |
} |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
375 |
} |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
376 |
|
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
377 |
MSRPLOG("<- CMSRPConnection::ReportReceiveprogressL") |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
378 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
379 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
380 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
381 |
// CMSRPConnection::WriteSocketError |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
382 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
383 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
384 |
void CMSRPConnection::WriteSocketError(TInt aStatus) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
385 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
386 |
MSRPLOG("CMSRPConnection::WriteSocketError() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
387 |
TInt err =0; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
388 |
TRAP(err, NotifyAllL(EError, aStatus)); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
389 |
//CloseConnection(); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
390 |
MSRPLOG("CMSRPConnection::WriteSocketError() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
391 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
392 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
393 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
394 |
// CMSRPConnection::Send |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
395 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
396 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
397 |
void CMSRPConnection::SendL(MMSRPWriterObserver& aMsg) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
398 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
399 |
MSRPLOG("CMSRPConnection::SendL() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
400 |
if(iConnectionState == EConnected) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
401 |
iWriter->RequestSendL(aMsg); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
402 |
MSRPLOG("CMSRPConnection::SendL() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
403 |
} |
58
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
404 |
|
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
405 |
// ----------------------------------------------------------------------------- |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
406 |
// CMSRPConnection::ContinueSendingL |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
407 |
// ----------------------------------------------------------------------------- |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
408 |
// |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
409 |
void CMSRPConnection::ContinueSendingL( MMSRPWriterObserver& aMsg ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
410 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
411 |
MSRPLOG("-> CMSRPConnection::ContinueSendingL") |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
412 |
if( iConnectionState == EConnected ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
413 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
414 |
iWriter->RequestSendL( aMsg ); |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
415 |
} |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
416 |
MSRPLOG("<- CMSRPConnection::ContinueSendingL") |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
417 |
} |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
418 |
|
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
419 |
// ----------------------------------------------------------------------------- |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
420 |
// CMSRPConnection::CancelSendingL |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
421 |
// ----------------------------------------------------------------------------- |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
422 |
// |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
423 |
void CMSRPConnection::CancelSendingL( const MMSRPWriterObserver* aMsg ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
424 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
425 |
MSRPLOG("-> CMSRPConnection::CancelSendingL") |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
426 |
if( iConnectionState == EConnected ) |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
427 |
{ |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
428 |
iWriter->CancelSendingL( aMsg ); |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
429 |
} |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
430 |
MSRPLOG("<- CMSRPConnection::CancelSendingL") |
cdb720e67852
This release addresses the following issues:
Petteri Saari <petteri.saari@digia.com>
parents:
25
diff
changeset
|
431 |
} |
25
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
432 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
433 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
434 |
// CMSRPConnection::TimerExpired |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
435 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
436 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
437 |
void CMSRPConnection::TimerExpiredL() |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
438 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
439 |
MSRPLOG("CMSRPConnection::TimerExpired() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
440 |
if(iConnectionState == EListening) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
441 |
NotifyAllL(EListenTimedOut, KErrTimedOut); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
442 |
else |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
443 |
NotifyAllL(EConnectTimedOut, KErrTimedOut); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
444 |
//iConnMngr.ListenCancel(this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
445 |
MSRPLOG("CMSRPConnection::TimerExpired() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
446 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
447 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
448 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
449 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
450 |
// CMSRPConnection::Remove |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
451 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
452 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
453 |
void CMSRPConnection::Remove(MMSRPConnectionObserver* aSubsession) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
454 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
455 |
MSRPLOG("CMSRPConnection::Remove() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
456 |
TInt index = iSubsessions.Find(aSubsession); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
457 |
//iSubsessions[index].DisconnectIssued; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
458 |
if(index != KErrNotFound) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
459 |
iSubsessions.Remove(index); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
460 |
MSRPLOG("CMSRPConnection::Remove() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
461 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
462 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
463 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
464 |
// CMSRPConnection::CloseConnection |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
465 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
466 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
467 |
void CMSRPConnection::CloseConnection() |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
468 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
469 |
MSRPLOG("CMSRPConnection::CloseConnection() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
470 |
//for connected no listen cancel needed |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
471 |
//for listener error listener deleted |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
472 |
if(/*iConnectionState == EListenConnected ||*/ iConnectionState == EListening || iConnectionState == EListenTimedOut) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
473 |
iConnMngr.ListenCancel(this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
474 |
else |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
475 |
//deleting connection, takes care of issuing cancel connect on connector also (if connecting) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
476 |
iConnMngr.Remove(this); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
477 |
MSRPLOG("CMSRPConnection::CloseConnection() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
478 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
479 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
480 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
481 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
482 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
483 |
// CMSRPConnection::NotifyAll |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
484 |
// ----------------------------------------------------------------------------- |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
485 |
// |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
486 |
void CMSRPConnection::NotifyAllL(TInt aNewState, TInt aStatus ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
487 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
488 |
MSRPLOG("CMSRPConnection::NotifyAll() enter") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
489 |
iConnectionState = aNewState; |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
490 |
for ( TInt i = 0; i < iSubsessions.Count(); i++ ) |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
491 |
{ |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
492 |
//make sure connectionstate does not release in notify |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
493 |
//else returns a value to reflect the same |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
494 |
iSubsessions[ i ]->ConnectionStateL( aNewState, aStatus ); |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
495 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
496 |
MSRPLOG("CMSRPConnection::NotifyAll() exit") |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
497 |
} |
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
498 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
499 |
|
505ad3f0ce5c
MSRP Chat and File Sharing FrameWork - Initial Contribution from Nokia.
shivsood
parents:
diff
changeset
|
500 |
// End of File |