|
1 /* |
|
2 * Copyright (c) 2002 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 * This is the definition for CDosSession class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef __DOSSESSION_H__ |
|
21 #define __DOSSESSION_H__ |
|
22 |
|
23 #include "dosserver.h" |
|
24 |
|
25 class CDosService; |
|
26 |
|
27 /** |
|
28 * This class represents a server side session. |
|
29 */ |
|
30 NONSHARABLE_CLASS( CDosSession ) : public CSession2 |
|
31 { |
|
32 public: |
|
33 /** |
|
34 * Constructor. |
|
35 */ |
|
36 CDosSession(); |
|
37 |
|
38 /** |
|
39 * Destructor. |
|
40 */ |
|
41 ~CDosSession(); |
|
42 |
|
43 /** |
|
44 * 2nd phase constructor called by the CServer framework. |
|
45 */ |
|
46 void CreateL(); |
|
47 |
|
48 private: |
|
49 /** |
|
50 * Returns the server that owns the session. |
|
51 * @return A reference to the server. |
|
52 */ |
|
53 inline CDosServer& Server() const; |
|
54 |
|
55 /** |
|
56 * This function is called by the CServer framework and handles |
|
57 * the requests. It just passes them to DispatchMessageL and complete them |
|
58 * if they are auto-completeable |
|
59 * @param aMessage Client-server message containing the request. |
|
60 */ |
|
61 void ServiceL(const RMessage2& aMessage); |
|
62 |
|
63 /** |
|
64 * Sends the request to the proper handler based on the message function. |
|
65 * @param aMessage Client-server message containing the request. |
|
66 * @return Symbina error code. |
|
67 */ |
|
68 TInt DispatchMessageL(const RMessage2& aMessage); |
|
69 |
|
70 /** |
|
71 * Gets a service object using a handle. |
|
72 * @param aHandle Handle assigned to the service by the Server framework, |
|
73 * @return A pointer to the Service object. |
|
74 */ |
|
75 inline CDosService* ServiceFromHandle(const TInt aHandle) const; |
|
76 |
|
77 /** |
|
78 * Sets up a subsession. Assigns it a handle. |
|
79 * @param aHandle Handle assigned to the service by the Server framework, |
|
80 * @param aService The Service object. |
|
81 */ |
|
82 void SetupSubSessionL(const RMessage2& aMessage,CDosService* aService); |
|
83 |
|
84 /** |
|
85 * Closes a subsession. |
|
86 * @param aHandle Handle assigned to the service by the Server framework, |
|
87 */ |
|
88 void CloseSubSession(const RMessage2& aMessage); |
|
89 |
|
90 private: |
|
91 friend class CDosServer; |
|
92 |
|
93 private: |
|
94 //A container for Services. |
|
95 CObjectCon* iServiceCon; |
|
96 |
|
97 //An index for services. |
|
98 CObjectIx* iServices; |
|
99 TInt iSDCounter; |
|
100 }; |
|
101 |
|
102 #include "dossession.inl" |
|
103 |
|
104 |
|
105 #endif //__DOSSESSION_H__ |