|
1 /* |
|
2 * Copyright (c) 2002-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: |
|
15 * Name : CServerTransport.h |
|
16 * Part of : ConnectionMgr |
|
17 * Version : SIP/4.0 |
|
18 * |
|
19 */ |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 /** |
|
25 @internalComponent |
|
26 */ |
|
27 |
|
28 #ifndef __CSERVERTRANSPORT_H__ |
|
29 #define __CSERVERTRANSPORT_H__ |
|
30 |
|
31 #include <e32base.h> |
|
32 #include "Lwtimer.h" |
|
33 #include "MContext.h" |
|
34 #include <in_sock.h> |
|
35 #include "sipconnection.h" |
|
36 #include "TSIPTransportParams.h" |
|
37 |
|
38 class MServerTransportOwner; |
|
39 class CSIPMessage; |
|
40 class CSender; |
|
41 class CSenderTcp; |
|
42 class CReceiverTcp; |
|
43 class CSocketContainer; |
|
44 class CSIPNATTraversalController; |
|
45 class MSIPNATBindingObserver; |
|
46 class MSIPTransportRemovalObserver; |
|
47 class COwnerSettingsList; |
|
48 |
|
49 class CServerTransport : public CBase, |
|
50 public MContext, |
|
51 public MExpirationHandler |
|
52 { |
|
53 public: |
|
54 static CServerTransport* NewL(RSocketServ& aServer, |
|
55 MServerTransportOwner& aMyOwner, |
|
56 MTimerManager& aTimer, |
|
57 TUint aTOne, |
|
58 CSIPNATTraversalController& aNATTraversal, |
|
59 COwnerSettingsList& aSettingsList); |
|
60 |
|
61 static CServerTransport* NewLC(RSocketServ& aServer, |
|
62 MServerTransportOwner& aMyOwner, |
|
63 MTimerManager& aTimer, |
|
64 TUint aTOne, |
|
65 CSIPNATTraversalController& aNATTraversal, |
|
66 COwnerSettingsList& aSettingsList); |
|
67 |
|
68 ~CServerTransport(); |
|
69 |
|
70 public: |
|
71 |
|
72 void SendL(const TSIPTransportParams& aParams, |
|
73 CSIPMessage& aMessage, |
|
74 TRequestStatus &aStatus); |
|
75 TBool CancelSend(TRequestStatus& aStatus); |
|
76 TBool Handle(const TInetAddr& aRemoteAddr); |
|
77 void AcceptedL(); |
|
78 |
|
79 TSIPTransportParams& TransportParams(); |
|
80 |
|
81 void CancelAllRequests(TInt aReason); |
|
82 |
|
83 CSender* Sender(); |
|
84 |
|
85 void SetPersistency( TBool aIsPersistent ); |
|
86 |
|
87 TBool IsPersistent() const; |
|
88 |
|
89 void InformSendingStatus(); |
|
90 |
|
91 TBool Removal( MSIPNATBindingObserver& aBindingObserver ); |
|
92 |
|
93 TBool Shutdown( MSIPTransportRemovalObserver* aRemovalObserver ); |
|
94 |
|
95 |
|
96 public: // From MExpirationHandler |
|
97 |
|
98 void TimerExpiredL(TTimerId aTimerId, TAny* aTimerParam); |
|
99 |
|
100 |
|
101 public: // From MContext |
|
102 |
|
103 MSigCompController* SigCompHandler(); |
|
104 CSocketContainer& SocketContainer(); |
|
105 CSocketContainer* SocketContainer(TUint aIPAddrFamily); |
|
106 void ReceivedDataL(HBufC8* /*aData*/, |
|
107 const TInetAddr& /*aRemoteAddr*/, |
|
108 TBool /*aCompressed*/){} |
|
109 void ReceivedDataL(CSIPMessage* aMessage, |
|
110 const TInetAddr& aRemoteAddr, |
|
111 TInt aError, |
|
112 TBool aCompressed); |
|
113 void ResetSocketL(){} |
|
114 void ContinueL(){} |
|
115 TBool StopL(){ return EFalse; } |
|
116 TBool ConnectionOpenL(){ return ETrue; } |
|
117 TBool DisconnectedL(); |
|
118 TInt Remove(); |
|
119 TUint32 IapId(); |
|
120 void Sending( TBool aIsSending ); |
|
121 void ReRouteL(TUint aProtocol, |
|
122 COutgoingData* aData); |
|
123 |
|
124 static const TInt iOffset; |
|
125 TSglQueLink iLink; |
|
126 |
|
127 private: |
|
128 CServerTransport(MServerTransportOwner& aMyOwner, |
|
129 MTimerManager& aTimer, |
|
130 CSIPNATTraversalController& aNATTraversal, |
|
131 COwnerSettingsList& aSettingsList ); |
|
132 void ConstructL(RSocketServ& aServer, TUint aTOne); |
|
133 void StartTimerL(); |
|
134 void StopTimer(); |
|
135 void SetShutdownObserver( MSIPTransportRemovalObserver* aRemovalObserver ); |
|
136 void HandleShutdownCompletion(); |
|
137 void RemoveL(); |
|
138 |
|
139 private: // Data |
|
140 |
|
141 MServerTransportOwner& iMyOwner; |
|
142 MTimerManager& iTimer; |
|
143 CSIPNATTraversalController& iNATTraversal; |
|
144 COwnerSettingsList& iSettingsList; |
|
145 TTimerId iTimerId; |
|
146 TUint iTimerValue; |
|
147 RSocket iSocket; |
|
148 TBool iAccepted; |
|
149 TInetAddr iRemoteAddr; |
|
150 CSocketContainer* iSocketContainer; |
|
151 CReceiverTcp* iReceiver; |
|
152 CSenderTcp* iSender; |
|
153 TSIPTransportParams iTransportParams; |
|
154 TBool iIsPersistent; |
|
155 TBool iIsSending; |
|
156 MSIPTransportRemovalObserver* iShutdownObserver; |
|
157 private: //For testing puposes |
|
158 #ifdef CPPUNIT_TEST |
|
159 friend class CServerTest; |
|
160 #endif |
|
161 }; |
|
162 |
|
163 #endif // end of __CSERVERTRANSPORT_H__ |
|
164 |
|
165 // End of File |