2175 { |
2175 { |
2176 __FLOG(_L8("RoutingTargetL, Entry")); |
2176 __FLOG(_L8("RoutingTargetL, Entry")); |
2177 // Parse the operation request dataset. |
2177 // Parse the operation request dataset. |
2178 TRoutingParameters params(aRequest, static_cast<MMTPConnection&>(aConnection)); |
2178 TRoutingParameters params(aRequest, static_cast<MMTPConnection&>(aConnection)); |
2179 ParseOperationRequestL(params); |
2179 ParseOperationRequestL(params); |
2180 |
2180 ValidateOperationRequestParametersL(params); |
|
2181 |
2181 // Route the operation request. |
2182 // Route the operation request. |
2182 RArray<TUint> targets; |
2183 RArray<TUint> targets; |
2183 CleanupClosePushL(targets); |
2184 CleanupClosePushL(targets); |
2184 params.SetParam(TRoutingParameters::EFlagRoutingTypes, (ETypeFramework | ETypeOperationParameter | ETypeRequestRegistration)); |
2185 params.SetParam(TRoutingParameters::EFlagRoutingTypes, (ETypeFramework | ETypeOperationParameter | ETypeRequestRegistration)); |
2185 RouteOperationRequestL(params, targets); |
2186 RouteOperationRequestL(params, targets); |
2291 CleanupStack::PopAndDestroy(&valid); |
2292 CleanupStack::PopAndDestroy(&valid); |
2292 } |
2293 } |
2293 __FLOG(_L8("ValidateTargetsL, Exit")); |
2294 __FLOG(_L8("ValidateTargetsL, Exit")); |
2294 } |
2295 } |
2295 |
2296 |
|
2297 void CMTPParserRouter::ValidateOperationRequestParametersL(TRoutingParameters& aParams) const |
|
2298 { |
|
2299 __FLOG(_L8("ValidateOperationRequestParametersL, Entry")); |
|
2300 if(aParams.Param(TRoutingParameters::EFlagInvalid)) |
|
2301 { |
|
2302 __FLOG(_L8("ValidateOperationRequestParametersL, Invalid is true,Exit")); |
|
2303 return; |
|
2304 } |
|
2305 |
|
2306 const TUint16 KOpCode(aParams.Request().Uint16(TMTPTypeRequest::ERequestOperationCode)); |
|
2307 __FLOG_VA((_L8("Operation Code = 0x%04X"), KOpCode)); |
|
2308 switch (KOpCode) |
|
2309 { |
|
2310 case EMTPOpCodeDeleteObject: |
|
2311 { |
|
2312 const TUint32 KObjectHandle(aParams.Request().Uint32(TMTPTypeRequest::ERequestParameter1)); |
|
2313 if ((KObjectHandle != KMTPHandleAll) && (KObjectHandle != KMTPHandleNone)) |
|
2314 { |
|
2315 CMTPObjectMetaData* obj(CMTPObjectMetaData::NewLC()); |
|
2316 if (!iSingletons.ObjectMgr().ObjectL(KObjectHandle, *obj)) |
|
2317 { |
|
2318 // Object does not exist. |
|
2319 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2320 } |
|
2321 else if(!iSingletons.StorageMgr().IsReadWriteStorage(obj->Uint(CMTPObjectMetaData::EStorageId))) |
|
2322 { |
|
2323 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2324 } |
|
2325 CleanupStack::PopAndDestroy(obj); |
|
2326 } |
|
2327 } |
|
2328 break; |
|
2329 |
|
2330 case EMTPOpCodeMoveObject: |
|
2331 { |
|
2332 const TUint32 KObjectHandle(aParams.Request().Uint32(TMTPTypeRequest::ERequestParameter1)); |
|
2333 CMTPObjectMetaData* obj(CMTPObjectMetaData::NewLC()); |
|
2334 if (!iSingletons.ObjectMgr().ObjectL(KObjectHandle, *obj)) |
|
2335 { |
|
2336 // Object does not exist. |
|
2337 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2338 } |
|
2339 else if(!iSingletons.StorageMgr().IsReadWriteStorage(obj->Uint(CMTPObjectMetaData::EStorageId))) |
|
2340 { |
|
2341 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2342 } |
|
2343 else |
|
2344 { |
|
2345 const TUint32 KStorageID(aParams.Request().Uint32(TMTPTypeRequest::ERequestParameter2)); |
|
2346 if( (!iSingletons.StorageMgr().ValidStorageId(KStorageID)) || (!iSingletons.StorageMgr().IsReadWriteStorage(KStorageID)) ) |
|
2347 { |
|
2348 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2349 } |
|
2350 } |
|
2351 CleanupStack::PopAndDestroy(obj); |
|
2352 } |
|
2353 break; |
|
2354 case EMTPOpCodeCopyObject: |
|
2355 { |
|
2356 const TUint32 KStorageID(aParams.Request().Uint32(TMTPTypeRequest::ERequestParameter2)); |
|
2357 if( (!iSingletons.StorageMgr().ValidStorageId(KStorageID)) || (!iSingletons.StorageMgr().IsReadWriteStorage(KStorageID)) ) |
|
2358 { |
|
2359 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2360 } |
|
2361 } |
|
2362 break; |
|
2363 case EMTPOpCodeSendObjectInfo: |
|
2364 case EMTPOpCodeSendObjectPropList: |
|
2365 { |
|
2366 const TUint32 KStorageID(aParams.Request().Uint32(TMTPTypeRequest::ERequestParameter1)); |
|
2367 if( KMTPStorageDefault != KStorageID ) |
|
2368 { |
|
2369 if( (!iSingletons.StorageMgr().ValidStorageId(KStorageID)) || (!iSingletons.StorageMgr().IsReadWriteStorage(KStorageID)) ) |
|
2370 { |
|
2371 aParams.SetParam(TRoutingParameters::EFlagInvalid, ETrue); |
|
2372 } |
|
2373 } |
|
2374 } |
|
2375 break; |
|
2376 default: |
|
2377 break; |
|
2378 } |
|
2379 __FLOG(_L8("ValidateOperationRequestParametersL, Exit")); |
|
2380 } |
|
2381 |
2296 /** |
2382 /** |
2297 Provides the routing sub-type modifier flags of the specified routing sub-type. |
2383 Provides the routing sub-type modifier flags of the specified routing sub-type. |
2298 @param aSubType The routing sub-type identifier. |
2384 @param aSubType The routing sub-type identifier. |
2299 @return The routing sub-type modifier flags. |
2385 @return The routing sub-type modifier flags. |
2300 */ |
2386 */ |