smf/smfservermodule/smfserver/server/smfserversymbian_p.h
author James Aley <jamesa@symbian.org>
Fri, 21 May 2010 15:45:10 +0100
changeset 10 77a56c951f86
parent 7 be09cf1f39dd
child 14 a469c0e6e7fb
permissions -rw-r--r--
Fixed build for Qt desktop
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     1
/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     2
 * Copyright (c) 2010 Sasken Communication Technologies Ltd.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     3
 * All rights reserved.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     4
 * This component and the accompanying materials are made available
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     5
 * under the terms of the "Eclipse Public License v1.0" 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     6
 * which accompanies  this distribution, and is available
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html"
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     8
 *
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
     9
 * Initial Contributors:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    10
 * Chandradeep Gandhi, Sasken Communication Technologies Ltd - Initial contribution
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    11
 *
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    12
 * Contributors:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    13
 * Manasij Roy, Nalina Hariharan*
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    14
 * Description:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    15
 * SMF Server private implementation for Symbian
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    16
 *
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    17
 **/
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    18
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    19
#ifndef SMFSERVERSYMBIAN_H
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    20
#define SMFSERVERSYMBIAN_H
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    21
#include <QObject>
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    22
#include <e32hashtab.h>
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    23
#include <e32base.h>
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    24
#include <QByteArray>
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    25
#include <QString>
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    26
//testing -start
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    27
#include "smfprovider.h"
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    28
//end
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    29
//SMF wide global const and macros, to be shared among SMF components as well as SMF aware apps
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    30
//#include <smf/smfGlobal.h>
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    31
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    32
//#include "clientGlobal.h"
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    33
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    34
#include "SmfServer.h"
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    35
//Forward declarations
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    36
class SmfServerSymbianSession;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    37
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    38
/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    39
 * Stores session and request information.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
    40
 * For now storing RMessage2 is reduntant as we are allowing only one outstanding request per session
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    41
 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    42
struct CSessionStruct
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    43
	{
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    44
	SmfServerSymbianSession* iSession;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    45
	RMessage2 iMsg;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    46
	};
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    47
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    48
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    49
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    50
//Policy table---start
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    51
//note capabilities are yet to be finalized
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    52
//46 services as of 15th apr
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    53
const TUint myRangeCount = 1/*7*/; 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    54
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    55
//Passing everything for the time being
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    56
const TInt myRanges[myRangeCount] = 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    57
        {
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    58
        0/*, //ERequestPass
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    59
        1, //ERequestFail
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    60
        2, //ERequestNotSupported
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    61
        3, //ERequestDrmService
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    62
        4, //ERequestUserEnvironmentService  
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    63
        5, //ERequestCustomCheckPass
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    64
        6  //ERequestCustomCheckFail*/ 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    65
        };
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    66
        
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    67
        
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    68
/* bis: each element of this array actually indexes to a particular element of
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    69
TPolicyElement. For eg. element 0 of this array maps element 0 of myRanges to 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    70
a particular element of TpolicyElement array which is in this case element 0
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    71
of TPolicyElement       
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    72
*/
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    73
const TUint8 myElementsIndex[myRangeCount] = 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    74
        {
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    75
        CPolicyServer::EAlwaysPass, //passing everything for now  
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    76
        };
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    77
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    78
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    79
/* bis: Policies used by the server to check messages from the client 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    80
for each message, the server will carry out security check according 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    81
to this policy. 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    82
*/        
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    83
const CPolicyServer::TPolicyElement myElements[] = 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    84
        {
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    85
        {_INIT_SECURITY_POLICY_PASS, CPolicyServer::EFailClient}     
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    86
        };
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    87
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    88
/* bis: TPolicy used by the server to check messages from the client 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    89
for each message. This structure is passed to the server at its creation.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    90
The Symbian client-server architecture will make sure that each client request
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    91
passes through the security test as indicated by myPolicy before it is handled
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    92
by myPolciyServer */        
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    93
const CPolicyServer::TPolicy myPolicy =
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    94
        {
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    95
        //bis:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    96
        //the connection policy (CPolicyServer::EAlwaysPass) should be changed if the 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    97
        //server wants to check for a particular policy before grating any connection
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    98
        //to the client. For eg. DRM manager server should only allow clients having DRM
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
    99
        //capability to connect to it. To do so, change CPolicyserver::EAlwaysPass,
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   100
        //to the index no. of myElements which checks for ECapabilityDRM i.e index 2
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   101
        //in this case. For EACM server, the server should allow only clients having
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   102
        //ECapabilityUserEnvironment to connect to it.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   103
        CPolicyServer::EAlwaysPass, //specifies all connect attempts should pass 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   104
        myRangeCount,                                   
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   105
        myRanges,
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   106
        myElementsIndex,
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   107
        myElements,
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   108
        };
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   109
//Policy table---end
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   110
/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   111
* Our server class - an active object - and therefore derived ultimately from CActive.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   112
* It accepts requests from client threads and forwards
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   113
* them to the client session to be dealt with. It also handles the creation
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   114
* of the server-side client session.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   115
**/
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   116
class SmfServerSymbian : public CPolicyServer
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   117
{
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   118
  
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   119
public:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   120
	/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   121
	 * Creates a new session with the server; the function
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   122
	 * implements the pure virtutal function
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   123
	 * defined in class CServer2
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   124
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   125
	SmfServerSymbian(CActive::TPriority aActiveObjectPriority,SmfServer* aWrapper);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   126
    static SmfServerSymbian * NewL(CActive::TPriority aActiveObjectPriority,SmfServer* aWrapper);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   127
    ~SmfServerSymbian();
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   128
    CSession2 * NewSessionL(const TVersion& aVersion, const RMessage2& aMessage) const;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   129
  
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   130
    /**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   131
     * Returns SmfServer
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   132
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   133
    SmfServer* wrapper();
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   134
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   135
     * Adds session info to the currently active session map iMap. This map is used to
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   136
     * retreive the corresponding session to be serviced. The keys for this map is sent
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   137
     * alongwith the request to other components
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   138
     * @param aSession Session to be added
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   139
     * @param aMsg Currently redundant
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   140
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   141
    TInt addToSessionMap(SmfServerSymbianSession* aSession,const RMessage2& aMsg);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   142
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   143
     * Removes the session from the active list of session map
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   144
     * @param aSession Session to be removed.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   145
     * @param aMsg Currently redundant
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   146
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   147
    TInt removeFromSessionMap(SmfServerSymbianSession* aSession,RMessage2& aMsg);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   148
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   149
     * Returns a symbian session for the given key from the iMap.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   150
     * @param id Session ID in the SmfServer Session map
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   151
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   152
    SmfServerSymbianSession* findSession(TInt id);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   153
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   154
     * Finds the given session and services it with the data.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   155
     * @param requestID Session ID
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   156
     * @param parsedData Parsed and serialized data to be sent to client.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   157
     * @param error Error code
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   158
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   159
    TInt findAndServiceclient(TInt requestID,QByteArray* parsedData,SmfError error);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   160
	/**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   161
	 * Debugging
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   162
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   163
	void writeLog(QString log)const;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   164
//private:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   165
    void ConstructL();
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   166
    SmfServer* iWrapper;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   167
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   168
	/**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   169
	 * Keeps track of the requests sent by each session
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   170
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   171
    RHashMap<TInt,CSessionStruct> iMap;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   172
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   173
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   174
     * The key in the iMap.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   175
     * Its sent to the wrapper
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   176
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   177
    TInt iRequestID;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   178
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   179
    TInt iSessionCount;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   180
};
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   181
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   182
/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   183
This class represents a session with the  Smf server.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   184
Functions are provided to respond appropriately to client messages.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   185
*/
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   186
class SmfServerSymbianSession : public CSession2
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   187
{
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   188
public:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   189
	/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   190
	 * Creates a session.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   191
	 * @param aServer The server handle
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   192
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   193
	SmfServerSymbianSession(SmfServerSymbian* aServer);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   194
    ~SmfServerSymbianSession();
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   195
    /**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   196
     * From CSession2
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   197
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   198
    void ServiceL(const RMessage2 & aMessage);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   199
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   200
     * Called by the SmfServerSymbian when results are available
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   201
     * @param parsedData Parsed serialized data
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   202
     * @param error Smf Error code
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   203
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   204
	void resultsAvailable(QByteArray* parsedData,SmfError error);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   205
	/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   206
	 * Called by the SmfServer when client authorization finishes.
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   207
	 * @param success success of the authorization
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   208
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   209
	void clientAuthorizationFinished(bool success);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   210
protected:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   211
    //TMessageParams ReadMessageAndRetrieveParams (const RMessage2 & aMessage);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   212
    void PanicClient(const RMessage2 & aMessage, TInt aPanic) const;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   213
    /**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   214
     * Called by ServiceL()
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   215
     * It tests the function code and then delegates to
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   216
     * the appropriate function.
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   217
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   218
    void HandleClientMessageL(const RMessage2 & aMessage);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   219
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   220
    //Following are for handling specific client requests
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   221
    /**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   222
     * ESmfGetService
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   223
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   224
    void HandleGetService(const RMessage2 & aMessage);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   225
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   226
    /**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   227
     * Handles all the opcodes except ESmfGetService
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   228
     */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   229
    void HandleCommonServiceL(const RMessage2 & aMessage);
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   230
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   231
    
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   232
//private:
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   233
    SmfServerSymbian* iServer;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   234
    RMessage2 iMessage;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   235
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   236
	//this interface id will be provided by Smf client, will map Smf Client 
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   237
	// interface hierarchy
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   238
	SmfInterfaceID iInterfaceID;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   239
	TPtr8 iIntfNmaeSymbian;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   240
	TPtr iIntfNameSymbian16;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   241
	TBuf8<125> iInterfaceNametbuf;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   242
	TPtr8 iProviderSymbian;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   243
	HBufC8* iProviderBuf;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   244
	HBufC8* iIntfNameBuf;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   245
	QMap<SmfPluginID,SmfProvider> iPluginIDMap;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   246
	QList<SmfPluginID> iPluginIDList;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   247
	QList<SmfPluginID> iAuthList;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   248
	
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   249
	/**
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   250
	 * To keep track of the requests sent by this session,not required for now, as only one
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   251
	 * outstanding request per session is required
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   252
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   253
	RArray<RMessage2> iRequestList;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   254
	/**
7
be09cf1f39dd Updating the source code for plugin manager, transport manager, smfserver and smf client.
cgandhi <chandradeep.gandhi@sasken.com>
parents:
diff changeset
   255
	 * Last request opcode
10
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   256
	 */
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   257
	TInt iLastRequest;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   258
	//testing
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   259
	TBuf<525> dataToPass;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   260
	HBufC8* iBuf;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   261
	HBufC* iBuf16;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   262
	TPtr8 iPtrToBuf;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   263
	QByteArray byteArrayToClnt;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   264
	SmfProvider* providerToClnt;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   265
	TInt iError;
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   266
};
77a56c951f86 Fixed build for Qt desktop
James Aley <jamesa@symbian.org>
parents: 7
diff changeset
   267
#endif // SMFSERVERSYMBIAN_H