21 |
21 |
22 #include "absession.h" |
22 #include "absession.h" |
23 #include "absessionmap.h" |
23 #include "absessionmap.h" |
24 #include "sbedataowner.h" |
24 #include "sbedataowner.h" |
25 #include "sbepanic.h" |
25 #include "sbepanic.h" |
|
26 #include "OstTraceDefinitions.h" |
|
27 #include "sbtrace.h" |
|
28 #ifdef OST_TRACE_COMPILER_IN_USE |
|
29 #include "absessionmapTraces.h" |
|
30 #endif |
26 |
31 |
27 namespace conn |
32 namespace conn |
28 { |
33 { |
29 |
|
30 CABSessionElement::CABSessionElement(TSecureId aSecureId) : iKey(aSecureId), iValue(NULL) |
34 CABSessionElement::CABSessionElement(TSecureId aSecureId) : iKey(aSecureId), iValue(NULL) |
31 /** |
35 /** |
32 Class Constructor |
36 Class Constructor |
33 |
37 |
34 @param aSecureId The secure Id of the data owner that the session has been created for |
38 @param aSecureId The secure Id of the data owner that the session has been created for |
35 */ |
39 */ |
36 { |
40 { |
|
41 OstTraceFunctionEntry0( CABSESSIONELEMENT_CABSESSIONELEMENT_CONS_ENTRY ); |
|
42 OstTraceFunctionExit0( CABSESSIONELEMENT_CABSESSIONELEMENT_CONS_EXIT ); |
37 } |
43 } |
38 |
44 |
39 CABSessionElement::~CABSessionElement() |
45 CABSessionElement::~CABSessionElement() |
40 /** |
46 /** |
41 Class destructor |
47 Class destructor |
42 */ |
48 */ |
43 { |
49 { |
|
50 OstTraceFunctionEntry0( CABSESSIONELEMENT_CABSESSIONELEMENT_DES_ENTRY ); |
|
51 OstTraceFunctionExit0( CABSESSIONELEMENT_CABSESSIONELEMENT_DES_EXIT ); |
44 } |
52 } |
45 |
53 |
46 CABSessionElement* CABSessionElement::NewL(TSecureId aSecureId) |
54 CABSessionElement* CABSessionElement::NewL(TSecureId aSecureId) |
47 /** |
55 /** |
48 Symbian first phase constructor |
56 Symbian first phase constructor |
49 @param aSecureId The secure Id of the data owner that the session has been created for |
57 @param aSecureId The secure Id of the data owner that the session has been created for |
50 */ |
58 */ |
51 { |
59 { |
|
60 OstTraceFunctionEntry0( CABSESSIONELEMENT_NEWL_ENTRY ); |
52 CABSessionElement* self = new (ELeave) CABSessionElement(aSecureId); |
61 CABSessionElement* self = new (ELeave) CABSessionElement(aSecureId); |
53 CleanupStack::PushL(self); |
62 CleanupStack::PushL(self); |
54 self->ConstructL(); |
63 self->ConstructL(); |
55 CleanupStack::Pop(self); |
64 CleanupStack::Pop(self); |
|
65 OstTraceFunctionExit0( CABSESSIONELEMENT_NEWL_EXIT ); |
56 return self; |
66 return self; |
57 } |
67 } |
58 |
68 |
59 void CABSessionElement::ConstructL() |
69 void CABSessionElement::ConstructL() |
60 /** |
70 /** |
61 Create the session for the data owner specified by iKey |
71 Create the session for the data owner specified by iKey |
62 */ |
72 */ |
63 { |
73 { |
|
74 OstTraceFunctionEntry0( CABSESSIONELEMENT_CONSTRUCTL_ENTRY ); |
64 // Note that the server takes ownership of the session, not this object |
75 // Note that the server takes ownership of the session, not this object |
65 iValue = CABSession::NewL(iKey); |
76 iValue = CABSession::NewL(iKey); |
|
77 OstTraceFunctionExit0( CABSESSIONELEMENT_CONSTRUCTL_EXIT ); |
66 } |
78 } |
67 |
79 |
68 CABSessionMap* CABSessionMap::NewL() |
80 CABSessionMap* CABSessionMap::NewL() |
69 /** |
81 /** |
70 Symbian first phase constructor |
82 Symbian first phase constructor |
71 |
83 |
72 @return Pointer to a created CABSessionMap object |
84 @return Pointer to a created CABSessionMap object |
73 */ |
85 */ |
74 { |
86 { |
|
87 OstTraceFunctionEntry0( CABSESSIONMAP_NEWL_ENTRY ); |
75 CABSessionMap* self = new (ELeave) CABSessionMap; |
88 CABSessionMap* self = new (ELeave) CABSessionMap; |
|
89 OstTraceFunctionExit0( CABSESSIONMAP_NEWL_EXIT ); |
76 return self; |
90 return self; |
77 } |
91 } |
78 |
92 |
79 CABSession& CABSessionMap::CreateL(TSecureId aSecureId) |
93 CABSession& CABSessionMap::CreateL(TSecureId aSecureId) |
80 /** |
94 /** |
82 |
96 |
83 @param aSecureId The SID to initialise the session with |
97 @param aSecureId The SID to initialise the session with |
84 @return Reference to the created session |
98 @return Reference to the created session |
85 */ |
99 */ |
86 { |
100 { |
|
101 OstTraceFunctionEntry0( CABSESSIONMAP_CREATEL_ENTRY ); |
87 CABSessionElement* element = CABSessionElement::NewL(aSecureId); |
102 CABSessionElement* element = CABSessionElement::NewL(aSecureId); |
88 CleanupStack::PushL(element); |
103 CleanupStack::PushL(element); |
89 iMapElements.AppendL(element); |
104 iMapElements.AppendL(element); |
90 CleanupStack::Pop(element); |
105 CleanupStack::Pop(element); |
91 return element->Value(); |
106 |
|
107 CABSession& session = element->Value(); |
|
108 OstTraceFunctionExit0( CABSESSIONMAP_CREATEL_EXIT ); |
|
109 return session; |
92 } |
110 } |
93 |
111 |
94 void CABSessionMap::Delete(TSecureId aSecureId) |
112 void CABSessionMap::Delete(TSecureId aSecureId) |
95 /** |
113 /** |
96 Delete the session and remove it from the map |
114 Delete the session and remove it from the map |
97 |
115 |
98 @param aSecureId The key to the session to be deleted |
116 @param aSecureId The key to the session to be deleted |
99 */ |
117 */ |
100 { |
118 { |
|
119 OstTraceFunctionEntry0( CABSESSIONMAP_DELETE_ENTRY ); |
101 TInt count = iMapElements.Count(); |
120 TInt count = iMapElements.Count(); |
102 |
121 |
103 for (TInt index = 0; index < count; index++) |
122 for (TInt index = 0; index < count; index++) |
104 { |
123 { |
105 if (iMapElements[index]->Key() == aSecureId) |
124 if (iMapElements[index]->Key() == aSecureId) |
119 @param aSecureId The SID of the DO that's connected to the returned session |
139 @param aSecureId The SID of the DO that's connected to the returned session |
120 @leave KErrNotFound If no session exists for that SID |
140 @leave KErrNotFound If no session exists for that SID |
121 @return The session that the DO with SID aSecureId is connected to |
141 @return The session that the DO with SID aSecureId is connected to |
122 */ |
142 */ |
123 { |
143 { |
|
144 OstTraceFunctionEntry0( CABSESSIONMAP_SESSIONL_ENTRY ); |
124 TInt count = iMapElements.Count(); |
145 TInt count = iMapElements.Count(); |
125 CABSession* pSession = NULL; |
146 CABSession* pSession = NULL; |
126 |
147 |
127 for (TInt index = 0; index < count; index++) |
148 for (TInt index = 0; index < count; index++) |
128 { |
149 { |
134 } |
155 } |
135 } |
156 } |
136 |
157 |
137 if (!pSession) |
158 if (!pSession) |
138 { |
159 { |
|
160 OstTrace0(TRACE_ERROR, CABSESSIONMAP_SESSIONL, "Leave: KErrNotFound"); |
139 User::Leave(KErrNotFound); |
161 User::Leave(KErrNotFound); |
140 } |
162 } |
141 |
163 |
|
164 OstTraceFunctionExit0( CABSESSIONMAP_SESSIONL_EXIT ); |
142 return *pSession; |
165 return *pSession; |
143 } |
166 } |
144 |
167 |
145 CABSessionMap::CABSessionMap() |
168 CABSessionMap::CABSessionMap() |
146 /** |
169 /** |
147 Class Constructor |
170 Class Constructor |
148 */ |
171 */ |
149 { |
172 { |
|
173 OstTraceFunctionEntry0( CABSESSIONMAP_CABSESSIONMAP_CONS_ENTRY ); |
|
174 OstTraceFunctionExit0( CABSESSIONMAP_CABSESSIONMAP_CONS_EXIT ); |
150 } |
175 } |
151 |
176 |
152 CABSessionMap::~CABSessionMap() |
177 CABSessionMap::~CABSessionMap() |
153 /** |
178 /** |
154 Class destructor |
179 Class destructor |
155 */ |
180 */ |
156 { |
181 { |
|
182 OstTraceFunctionEntry0( CABSESSIONMAP_CABSESSIONMAP_DES_ENTRY ); |
157 iMapElements.ResetAndDestroy(); |
183 iMapElements.ResetAndDestroy(); |
158 iMapElements.Close(); |
184 iMapElements.Close(); |
|
185 OstTraceFunctionExit0( CABSESSIONMAP_CABSESSIONMAP_DES_EXIT ); |
159 } |
186 } |
160 |
187 |
161 void CABSessionMap::InvalidateABSessions() |
188 void CABSessionMap::InvalidateABSessions() |
162 /** |
189 /** |
163 Set each CABSession currently hold in the map as invalid |
190 Set each CABSession currently hold in the map as invalid |
164 */ |
191 */ |
165 { |
192 { |
|
193 OstTraceFunctionEntry0( CABSESSIONMAP_INVALIDATEABSESSIONS_ENTRY ); |
166 TInt count = iMapElements.Count(); |
194 TInt count = iMapElements.Count(); |
167 CABSession* pSession = NULL; |
195 CABSession* pSession = NULL; |
168 |
196 |
169 for (TInt index = 0; index < count; index++) |
197 for (TInt index = 0; index < count; index++) |
170 { |
198 { |