|
1 /* |
|
2 * Copyright (c) 2006 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 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef TMceSessionUtility_H |
|
22 #define TMceSessionUtility_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 #include <mcedefs.h> |
|
27 #include <mcemediastream.h> |
|
28 #include <e32des8.h> |
|
29 #include <in_sock.h> |
|
30 #include <sdpdocument.h> |
|
31 |
|
32 |
|
33 // CLASS DECLARATION |
|
34 |
|
35 /** |
|
36 * Base class for MCE sessions, inherited by both CMceInSession and CMceOutSession. |
|
37 * |
|
38 * CMceSession represents peer-to-peer connection made with remote terminal. |
|
39 * This connection is also known as dialog and it is set up using SIP INVITE |
|
40 * method. |
|
41 * |
|
42 * The characteristics of the session are defined by user of this class by attaching |
|
43 * media streams into the session. |
|
44 * |
|
45 * After the session has been succesfylly established, it can be later updated and |
|
46 * must be finally terminated. |
|
47 * |
|
48 * If for any reason instance of this class is deleted while in established state, |
|
49 * session is automatically terminated by MCE server. |
|
50 * |
|
51 * @lib mceclient.lib |
|
52 */ |
|
53 class TMceSessionUtility : public CBase |
|
54 { |
|
55 public: // Session states |
|
56 |
|
57 enum TSDPLineName |
|
58 { |
|
59 EVersion, // v= |
|
60 //EOrigin, // o= |
|
61 ESession, // s= |
|
62 EInfo, // i= |
|
63 EUri, // u= |
|
64 //EEmail, // e= |
|
65 //EPhone, // p= |
|
66 //EConnection, // c= |
|
67 //EBandwidth, // b= |
|
68 EZone // z= |
|
69 //EKey, // k= |
|
70 //EAttribute, // a= |
|
71 //ETime, //t= |
|
72 //ERepeat, //r= |
|
73 //EMedia, //m= |
|
74 }; |
|
75 |
|
76 public: // Constructors and destructor |
|
77 |
|
78 |
|
79 //static TMceSessionUtility(CMceSession* aSession); |
|
80 |
|
81 /** |
|
82 * Destructor. |
|
83 */ |
|
84 //virtual ~TMceSessionUtility(); |
|
85 |
|
86 public: // Functions |
|
87 |
|
88 /** |
|
89 * Returns value of remote session SDP line. |
|
90 * @param aSess MCE session object |
|
91 * @param TSDPLineName SDP session level SDP line name |
|
92 * @return The valid pointer of HBufC8 if the value exists otherwise returns NULL |
|
93 * The ownership of HBufC8 is transferred to the clietns. |
|
94 */ |
|
95 |
|
96 static HBufC8* getSessionSdPLineL(CMceSession* aSess, |
|
97 TSDPLineName aLSdpLineName); |
|
98 |
|
99 /** |
|
100 * Returns the value of remote media sdp attribute value. |
|
101 * @param aStream . The stream object for which the remote attribute is required |
|
102 * @param aAttrName attribte name like "accept-types", "accept-wrapped-types" etc |
|
103 * @return The valid pointer of HBufC8 if the value for the attribute exists otherwise returns NULL |
|
104 * The ownership of HBufC8 is transferred to the clietns. |
|
105 * @Pre session->State() < CMceSession::ECancelling) || |
|
106 * session->State() > CMceSession::EIdle |
|
107 */ |
|
108 |
|
109 IMPORT_C static HBufC8* getRemoteMediaSDPAttrL(CMceMediaStream* aStream, |
|
110 const TDesC8& aAttrName); |
|
111 |
|
112 /** |
|
113 * Returns the local conneciton address for the passed session |
|
114 * @param CMceSession MCE session object for which the conneciton address is requested |
|
115 * @param TInetAddr The conneciton address of the session will be filled in this parameter |
|
116 * |
|
117 */ |
|
118 |
|
119 IMPORT_C static void GetLocalConnectionAddrL(CMceSession* aSess, TInetAddr& aAddr); |
|
120 |
|
121 |
|
122 /** |
|
123 * Returns the remote conneciton address for the passed stream |
|
124 * @param aStream The stream object for which the remote connection addr is requested |
|
125 * @return The HBufC8 pointer either holds the FQDN or the IP address of the remote end |
|
126 * The Ownership is transferred to the clients |
|
127 * @Pre session->State() < CMceSession::ECancelling) || |
|
128 * session->State() > CMceSession::EIdle |
|
129 */ |
|
130 |
|
131 IMPORT_C static HBufC8* GetRemoteConnectionAddrL(CMceMediaStream* aStream); |
|
132 |
|
133 |
|
134 /** |
|
135 * Get local media port of the stream |
|
136 * @aSession MCE session |
|
137 * @aMediaPort On return filled with local media port |
|
138 * @Pre session->State() < CMceSession::ECancelling) || |
|
139 * session->State() > CMceSession::EIdle |
|
140 */ |
|
141 |
|
142 IMPORT_C static void GetLocalMediaPortL(CMceMediaStream* aStream, TUint& aMediaPort ); |
|
143 |
|
144 |
|
145 /** |
|
146 * Get remote media port of the session |
|
147 * @aSession MCE session |
|
148 * @aMediaPort On return filled with local media port |
|
149 * @Pre session->State() < CMceSession::ECancelling) || |
|
150 * session->State() > CMceSession::EIdle |
|
151 */ |
|
152 |
|
153 IMPORT_C static void GetRemoteMediaPortL(CMceMediaStream* aStream, TUint& aMediaPort ); |
|
154 |
|
155 private: |
|
156 |
|
157 static void ConstructSdpDocumentL(CDesC8Array* asdpLines, CSdpDocument*& asdpDoc); |
|
158 |
|
159 static HBufC8* FindAttributeL(CDesC8Array* asdpLines , const TDesC8& aAttrName); |
|
160 |
|
161 private: |
|
162 MCE_UNIT_TEST_DEFS |
|
163 }; |
|
164 |
|
165 #endif // TMceSessionUtility_H |