class CMTPParserRouter : public CBase |
Implements the MTP framework parser/router singleton.
The MTP framework parser/router singleton is responsible for directing received MTP operation request (and event) datasets to the appropriate data provider(s) for processing, and performs the following major functions:
1. Parses received operation request and event datasets to extract and coarse grain validate routing data (ParseOperationRequestL). 2. Executes one or more routing algorithms to select the set of data provider targets able to service the operation or event (RouteOperationRequestL). 3. (Optionally) dispatches the request or event (ProcessRequestL).There are two basic scenarios which the parser/router must handle, and a different set of APIs is provided for each. These scenarios are:
1. The initial routing of operations as they are first received. This routing is initiated by the MTP framework using the ProcessRequestL API. This API executes all three of the functions identified above. 2. The secondary routing of those operations which cannot be dispatched directly. Either because they require the combined processing capabilities of multiple data providers to produce an aggregated response, or; because they cannot be routed using data available during the operation request phase and can only be routed to their final target using data available during the operation data phase. This secondary routing is performed by the MTP framework's proxy data provider using the ParseOperationRequestL and RouteOperationRequestL APIs. These APIs respectively execute the first two functions identified above, which are separated in order to allow additional information to be added to the routing data by the proxy data provider. The third function identified above is not executed in this scenario, since a very different dispatching mechanism must be used by the proxy data provider.The parser/router implements a number of different routing algorithm types, some of which are further decomposed into sub-types to achieve a finer level of routing granularity and control. In combination these algorithms support the following general routing mechanisms:
1. Device - A subset of device oriented MTP operations are always dispatched to the device data provider. 2. Proxy - A subset of MTP operations cannot be dispatched directly. Either they require the combined processing capabilities of multiple data providers to produce an aggregated response, or cannot be routed using data available from the operation dataset alone. These operations are dispatched to the proxy data provider for additional processing. 3. Object Handle - MTP object handles generated by the MTP framework are encoded with a data provider identifier to efficiently route those MTP operations which supply an object handle as a parameter. 4. StorageID - MTP storage identifiers generated by the MTP framework are encoded with a data provider identifier to efficiently route those MTP operations which supply a storage identifier as a parameter. 5. Operation Parameter - On being loaded each data provider supplies a set of configuration data (MTP operation codes, event codes, object property codes, device property codes, and storage system types) which collectively define the set of MTP operation requests that it wishes to receive. 6. Request Registration - Data providers may optionally register MTP operation request datasets with the framework which, when subsequently matched, will be routed to them. This mechanism is used to route those MTP operation types which are paired to complete over two transaction cycles (e.g. SendObjectInfo/SendObject). It may also be used to route vendor extension operation requests.
The following routing algorithm types are implemeted:
1. Operation Parameter Routing
Operation parameter routing is the primary routing mechanism and by default is enabled for both initial and secondary proxy routing scenarios. Operation parameter routing involves selecting one or more data provider targets using routing data obtained from or related to the supplied operation dataset parameters using one of the following sub-types:
o Parameter lookup routing sub-types, which match operation dataset parameter data with the set of supported capabilities registered by each data provider on being loaded, or; o Parameter decode routing sub-types, which extract data provider target identifiers encoded into the parameter data itself.
The parameter lookup routing sub-types are table driven and utilise binary search techniques to minimise processing overhead. The following parameter lookup routing sub-types (tables) are implemented, each characterised by the combination of parameters they require to map to a routing target:
o DevicePropCode o ObjectPropCode o OperationCode o StorageType o FormatCode + FormatSubcode o FormatCode + OperationCode o StorageType + OperationCode o FormatCode + FormatSubcode + StorageType
These routing tables may be further characterised by modifier flags which e.g. allow or disallow duplicate entries, or specify ascending or descending sort orders which in turn can manipulate the order in which proxy targets are processed.
The parameter decode routing sub-types extract routing target identifiers directly from the operation dataset parameter data itself. The following parameter decode routing sub-types are implemented:
o Object Handle o StorageID
2. Framework Routing
By default, framework routing is enabled during initial operation routing only and not during secondary proxy routing. Framework routing directs a sub-set of MTP operations to one or other of the framework data providers. Using one of the following routing sub-types:
o Device DP. A fixed sub-set of MTP operations are always dispatched to the device data provider. o Proxy DP. A fixed sub-set of MTP operations are always dispatched to the proxy data provider. In addition, any operations which yield multiple routing targets will also be routed to the proxy data provider.
3. Request Registration Routing
By default, request registration routing is enabled during initial operation routing only and not during secondary proxy routing. Data providers may optionally register MTP operation request datasets with the framework which, when subsequently matched, will be routed to them. This mechanism is used to process those MTP operation types which are paired to complete over two transaction cycles (e.g. SendObjectInfo/SendObject). It may also be used to route vendor extension operation requests.
Request registration routing does not implement any routing sub-types.
Public Member Functions | |
---|---|
~CMTPParserRouter() | |
IMPORT_C void | ConfigureL() |
CMTPParserRouter * | NewL() |
IMPORT_C TBool | OperationSupportedL(TUint16) |
IMPORT_C void | ParseOperationRequestL(TRoutingParameters &) |
void | ProcessEventL(const TMTPTypeEvent &, CMTPConnection &) |
void | ProcessRequestL(const TMTPTypeRequest &, CMTPConnection &) |
IMPORT_C void | RouteOperationRequestL(const TRoutingParameters &, RArray< TUint > &) |
void | RouteRequestRegisterL(const TMTPTypeRequest &, MMTPConnection &, TInt) |
IMPORT_C TBool | RouteRequestRegisteredL(const TMTPTypeRequest &, MMTPConnection &) |
void | RouteRequestUnregisterL(const TMTPTypeRequest &, MMTPConnection &) |
Private Member Enumerations | |
---|---|
enum | TRoutingParams { EParam1 = 0, EParam2 = 1, EParam3 = 2 } |
enum | TRoutingSubType { ESubTypeIndexMask = 0x0000FFFF, ESubTypeFlagMask = 0x00FF0000, ESubTypeFlagNone = 0x00000000, ESubTypeFlagEnableDuplicates = 0x00010000, ESubTypeFlagOrderDescending = 0x00020000, ESubTypeParamsMask = 0xFF000000, ESubTypeParams0 = 0x00000000, ESubTypeParams1 = 0x01000000, ESubTypeParams2 = 0x02000000, ESubTypeParams3 = 0x03000000, ESubTypeDevicePropCode = (0x00000000 | ESubTypeParams1 | ESubTypeFlagNone), ESubTypeObjectPropCode = (0x00000001 | ESubTypeParams1 | ESubTypeFlagEnableDuplicates), ESubTypeOperationCode = (0x00000002 | ESubTypeParams1 | ESubTypeFlagEnableDuplicates), ESubTypeStorageType = (0x00000003 | ESubTypeParams1 | ESubTypeFlagEnableDuplicates), ESubTypeFormatCodeFormatSubcode = (0x00000004 | ESubTypeParams2 | (ESubTypeFlagEnableDuplicates | ESubTypeFlagOrderDescending)), ESubTypeFormatCodeOperationCode = (0x00000005 | ESubTypeParams2 | ESubTypeFlagEnableDuplicates), ESubTypeStorageTypeOperationCode = (0x00000006 | ESubTypeParams2 | ESubTypeFlagEnableDuplicates), ESubTypeFormatCodeFormatSubcodeStorageType = (0x00000007 | ESubTypeParams3 | ESubTypeFlagNone), ESubTypeServiceIDOperationCode = (0x00000008 | ESubTypeParams1 | ESubTypeFlagNone), ESubTypeDpDevice = (0x00000009 | ESubTypeParams0 | ESubTypeFlagNone), ESubTypeDpProxy = (0x0000000A | ESubTypeParams0 | ESubTypeFlagNone), ESubTypeOwnerObject = (0x0000000B | ESubTypeParams0 | ESubTypeFlagNone), ESubTypeOwnerStorage = (0x0000000C | ESubTypeParams0 | ESubTypeFlagNone), ESubTypeRequestRegistration = (0x0000000D | ESubTypeParams0 | ESubTypeFlagNone) } |
enum | TRoutingType { ETypeFlagMask = 0xFF000000, ETypeFlagSingleTarget = 0x01000000, ETypeMask = 0x0000FFFF, ETypeFramework = 0x00000001, ETypeOperationParameter = 0x00000002, ETypeRequestRegistration = 0x00000004 } |
Private Attributes | |
---|---|
__FLOG_DECLARATION_MEMBER_MUTABLE | |
RPointerArray< CMap > | iMaps |
RMTPFramework | iSingletons |
void | Configure1ParameterMapL | ( | TUint | aSubType, |
const RArray< TUint > & | aP1Codes | |||
) | [private] |
void | Configure2ParameterMapL | ( | TUint | aSubType, |
const RArray< TUint > & | aP1Codes, | |||
const RArray< TUint > & | aP2Codes | |||
) | [private] |
void | Configure3ParameterMapL | ( | TUint | aSubType, |
const RArray< TUint > & | aP1Codes, | |||
const RArray< TUint > & | aP2Codes, | |||
const RArray< TUint > & | aP3Codes | |||
) | [private] |
IMPORT_C void | ConfigureL | ( | ) |
TUint | Flags | ( | TUint | aSubType | ) | [private, static] |
Provides the routing sub-type modifier flags of the specified routing sub-type.
TUint aSubType | The routing sub-type identifier. |
void | GetConfigParametersL | ( | const CMTPDataProvider & | aDp, |
const RArray< TUint > & | aCodes, | |||
RArray< TUint > & | aParams | |||
) | const [private] |
const CMTPDataProvider & aDp | The data provider. |
const RArray< TUint > & aCodes | The set of |
RArray< TUint > & aParams | On exit, the set of supported parameter values. |
void | GetMapParameterIdsL | ( | TUint | aSubType, |
RArray< TUint > & | aP1Codes, | |||
RArray< TUint > & | aP2Codes, | |||
RArray< TUint > & | aP3Codes | |||
) | [private, static] |
void | GetRoutingSubTypesCopyMoveRequestL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
void | GetRoutingSubTypesDeleteObjectPropListL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
void | GetRoutingSubTypesDeleteRequestL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
void | GetRoutingSubTypesGetFormatCapabilitiesL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
void | GetRoutingSubTypesGetObjectPropListRequestL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
void | GetRoutingSubTypesL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
void | GetRoutingSubTypesSendObjectPropListRequestL | ( | RArray< TRoutingParameters > & | aParams, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
TUint | Index | ( | TUint | aSubType | ) | [private, static] |
Provides the routing sub-type (map) index of the specified routing sub-type.
TUint aSubType | The routing sub-type identifier. |
CMTPParserRouter * | NewL | ( | ) | [static] |
IMPORT_C TBool | OperationSupportedL | ( | TUint16 | aOperation | ) | const |
TUint16 aOperation | The MTP operation code. |
TUint | Params | ( | TUint | aSubType | ) | [private, static] |
Provides the routing sub-type parameter count type of the specified routing sub-type.
TUint aSubType | The routing sub-type identifier. |
TUint | ParamsCount | ( | TUint | aSubType | ) | [private, static] |
Provides the routing sub-type parameter count of the specified routing sub-type.
TUint aSubType | The routing sub-type identifier. |
IMPORT_C void | ParseOperationRequestL | ( | TRoutingParameters & | aParams | ) | const |
Parses the operation dataset supplied in the specified routing parameters object which encapsulates all information required to route the operation. The parsing process involves:
1. Extracting all relevant routing information from the received operation dataset. Note that not all parameter data is extracted, only that which is required to route the operation. 2. Coarse grain validating the parsed data. Specifically this involves validating that any MTP StorageID or Object Handle parameter data refers to valid entities that exist on the device. 3. Extracting additional meta-data related to specific data objects and/or storages referred to in the operation dataset and which is required to route the operation.
TRoutingParameters & aParams | The routing parameters object. On entry this contains the operation dataset to be parsed and the handle of the MTP connection on which it was received. On exit this contains all information required to route the operation. |
void | ParseOperationRequestParameterL | ( | TMTPTypeRequest::TElements | aParam, |
TRoutingParameters::TParameterType | aType, | |||
TRoutingParameters & | aParams | |||
) | const [private] |
TMTPTypeRequest::TElements aParam | The operation request dataset parameter identifier. |
TRoutingParameters::TParameterType aType | The operation request dataset parameter type. |
TRoutingParameters & aParams | The operation routing parameter data, updated on exit with the parameter value together with any associated meta-data. |
void | ProcessEventL | ( | const TMTPTypeEvent & | aEvent, |
CMTPConnection & | aConnection | |||
) | const |
const TMTPTypeEvent & aEvent | The MTP event dataset. |
CMTPConnection & aConnection | The MTP connection on which the event was received. |
void | ProcessRequestL | ( | const TMTPTypeRequest & | aRequest, |
CMTPConnection & | aConnection | |||
) | const |
const TMTPTypeRequest & aRequest | The MTP operation (request) dataset. |
CMTPConnection & aConnection | The MTP connection on which the event was received. |
void | RouteOperationRequest0ParametersL | ( | TUint | aRoutingSubType, |
const TRoutingParameters & | aParams, | |||
RArray< TUint > & | aTargets | |||
) | const [private] |
TUint aRoutingSubType | The routing sub-type. |
const TRoutingParameters & aParams | The operation routing parameter data. |
RArray< TUint > & aTargets | On exit, the seto of resolved routing targets. |
IMPORT_C void | RouteOperationRequestL | ( | const TRoutingParameters & | aParams, |
RArray< TUint > & | aTargets | |||
) | const |
const TRoutingParameters & aParams | The routing parameters. |
RArray< TUint > & aTargets | One exit, the set of data provider targets to which the operation should be dispatched. |
void | RouteOperationRequestNParametersL | ( | TUint | aRoutingSubType, |
const TRoutingParameters & | aParams, | |||
RArray< TUint > & | aTargets | |||
) | const [private] |
TUint aRoutingSubType | The routing sub-type. |
const TRoutingParameters & aParams | The operation routing parameter data. |
RArray< TUint > & aTargets | On exit, the seto of resolved routing targets. |
void | RouteRequestRegisterL | ( | const TMTPTypeRequest & | aRequest, |
MMTPConnection & | aConnection, | |||
TInt | aId | |||
) |
const TMTPTypeRequest & aRequest | The operation request dataset being registered. |
MMTPConnection & aConnection | The handle of the MTP connection on which the operation request is expected to be received. |
TInt aId | The data provider identifier. |
IMPORT_C TBool | RouteRequestRegisteredL | ( | const TMTPTypeRequest & | aRequest, |
MMTPConnection & | aConnection | |||
) | const |
const TMTPTypeRequest & aRequest | The MTP operation requesty dataset specifying MTP operation code and session. |
MMTPConnection & aConnection | The handle of the MTP connection on which the operation request is expected to be received. |
void | RouteRequestUnregisterL | ( | const TMTPTypeRequest & | aRequest, |
MMTPConnection & | aConnection | |||
) |
const TMTPTypeRequest & aRequest | The registered operation request dataset. |
MMTPConnection & aConnection | The handle of the MTP connection for which the operation request was registered. |
TUint | RoutingTargetL | ( | const TMTPTypeRequest & | aRequest, |
CMTPConnection & | aConnection | |||
) | const [private] |
Provides a single suitable routing target for the specified request. A target is selected such that:
1. Any request that resolves to multiple targets will always be directed to the proxy data provider. 2. Any request that cannot be resolved to at least one target will always be directed to the device data provider.
const TMTPTypeRequest & aRequest | The operation request dataset of the MTP operation to be routed. |
CMTPConnection & aConnection | The MTP connection on which the operation request is being processed. |
void | SelectSubTypeRoutingL | ( | TRoutingSubType | aSubType, |
RArray< TUint > & | aRoutingSubTypes, | |||
RArray< TUint > & | aValidationSubTypes, | |||
RArray< TRoutingParameters > & | aParams | |||
) | const [private] |
TRoutingSubType aSubType | The selected routing sub-type. |
RArray< TUint > & aRoutingSubTypes | The set of selected routing sub-types, updated on exit. |
RArray< TUint > & aValidationSubTypes | The set of selected validation sub-types, potentially updated on exit. |
RArray< TRoutingParameters > & aParams | The set of operation routing parameter data. |
void | SelectSubTypeValidationL | ( | TRoutingSubType | aSubType, |
RArray< TUint > & | aValidationSubTypes | |||
) | const [private] |
TRoutingSubType aSubType | The selected validation sub-type. |
RArray< TUint > & aValidationSubTypes | The set of selected validation sub-types, updated on exit. |
void | SelectTargetL | ( | TUint | aTarget, |
RArray< TUint > & | aTargets | |||
) | [private, static] |
TUint | SubType | ( | TUint | aIndex, |
TUint | aFlags, | |||
TUint | aParamsCount | |||
) | [private, static] |
Encodes a routing sub-type identifier using the specified sub-field values.
void | ValidateOperationRequestParametersL | ( | TRoutingParameters & | aParams | ) | const [private] |
TRoutingParameters & aParams |
void | ValidateTargetsL | ( | const TRoutingParameters & | aParams, |
const RArray< TUint > & | aValidationSubTypes, | |||
RArray< TUint > & | aTargets | |||
) | const [private] |
Validates the specified set of routing targets.
const TRoutingParameters & aParams | The operation routing parameter data. |
const RArray< TUint > & aValidationSubTypes | The set of validation sub-types. |
RArray< TUint > & aTargets | The set of data provider targets to be validated. Invalid targets are removed from this set. |
Defines the routing parameter IDs.
EParam1 = 0 |
The first parameter. |
EParam2 = 1 |
The second parameter. |
EParam3 = 2 |
Defines the routing sub-type codes. These codes are partitioned into two sub-fields as follows:
1. Bits 0-15 - routing sub-type (map) index. 2. Bits 16-23 - routing sub-type modifier flags. 3. Bits 24-31 - routing sub-type parameter count type.
ESubTypeIndexMask = 0x0000FFFF |
The routing sub-type identifier (table index) mask. |
ESubTypeFlagMask = 0x00FF0000 |
The routing sub-type modifier bit flags mask. |
ESubTypeFlagNone = 0x00000000 |
The null flag bits. |
ESubTypeFlagEnableDuplicates = 0x00010000 |
The duplicates enabled flag bits. When set this flag indicates that duplicate routing table entries are permitted. |
ESubTypeFlagOrderDescending = 0x00020000 |
The order descending flag bits. When set this flag indicates that routing table entries are to be arranged in descending rather than ascending order. |
ESubTypeParamsMask = 0xFF000000 |
The routing sub-type parameter count mask. |
ESubTypeParams0 = 0x00000000 |
The zero parameter count code. |
ESubTypeParams1 = 0x01000000 |
The one parameter count code. |
ESubTypeParams2 = 0x02000000 |
The two parameter count code. |
ESubTypeParams3 = 0x03000000 |
The three parameter count code. |
ESubTypeDevicePropCode = (0x00000000 | ESubTypeParams1 | ESubTypeFlagNone) |
The DevicePropCode operation parameter lookup routing sub-type. |
ESubTypeObjectPropCode = (0x00000001 | ESubTypeParams1 | ESubTypeFlagEnableDuplicates) |
The ObjectPropCode operation parameter lookup routing sub-type. |
ESubTypeOperationCode = (0x00000002 | ESubTypeParams1 | ESubTypeFlagEnableDuplicates) |
The OperationCode operation parameter lookup routing sub-type. |
ESubTypeStorageType = (0x00000003 | ESubTypeParams1 | ESubTypeFlagEnableDuplicates) |
The StorageType operation parameter lookup routing sub-type. |
ESubTypeFormatCodeFormatSubcode = (0x00000004 | ESubTypeParams2 | (ESubTypeFlagEnableDuplicates | ESubTypeFlagOrderDescending)) |
The FormatCode + FormatSubcode operation parameter lookup routing sub-type. |
ESubTypeFormatCodeOperationCode = (0x00000005 | ESubTypeParams2 | ESubTypeFlagEnableDuplicates) |
The FormatCode + OperationCode operation parameter lookup routing sub-type. |
ESubTypeStorageTypeOperationCode = (0x00000006 | ESubTypeParams2 | ESubTypeFlagEnableDuplicates) |
The StorageType + OperationCode operation parameter lookup routing sub-type. |
ESubTypeFormatCodeFormatSubcodeStorageType = (0x00000007 | ESubTypeParams3 | ESubTypeFlagNone) |
The FormatCode + FormatSubcode + StorageType operation parameter lookup routing sub-type. |
ESubTypeServiceIDOperationCode = (0x00000008 | ESubTypeParams1 | ESubTypeFlagNone) |
The ServiceID operation parameter lookup routing sub-type. |
ESubTypeDpDevice = (0x00000009 | ESubTypeParams0 | ESubTypeFlagNone) |
The device DP framework routing sub-type. |
ESubTypeDpProxy = (0x0000000A | ESubTypeParams0 | ESubTypeFlagNone) |
The proxy DP framework routing sub-type. |
ESubTypeOwnerObject = (0x0000000B | ESubTypeParams0 | ESubTypeFlagNone) |
The object owner operation parameter decode routing sub-type. |
ESubTypeOwnerStorage = (0x0000000C | ESubTypeParams0 | ESubTypeFlagNone) |
The storage owner operation parameter decode routing sub-type. |
ESubTypeRequestRegistration = (0x0000000D | ESubTypeParams0 | ESubTypeFlagNone) |
The default request registration routing sub-type. |
Defines the routing type codes. These codes are partitioned into two sub-fields as follows:
1. Bits 0-15 - routing type identifier. 2. Bits 16-23 - unused. 3. Bits 24-31 - routing type modifier flags.
ETypeFlagMask = 0xFF000000 |
The routing type modifier flags mask. |
ETypeFlagSingleTarget = 0x01000000 |
The single target flag. When set this flag will result in at most one eligible routing target being selected. If multiple eligible targets exists then the first eligible target will be selected. |
ETypeMask = 0x0000FFFF |
The routing type identifier mask. |
ETypeFramework = 0x00000001 |
The framework routing type identifier. |
ETypeOperationParameter = 0x00000002 |
The operation parameter routing type identifier. |
ETypeRequestRegistration = 0x00000004 |
The request registration routing type identifier. |
__FLOG_DECLARATION_MEMBER_MUTABLE | [private] |
FLOGGER debug trace member variable.
RPointerArray< CMap > | iMaps | [private] |
The operation parameter routing sub-type map tables.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.