Home | History | Annotate | Download | only in src
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 #ifndef PVMF_SM_FSP_BASE_IMPL_H
     19 #include "pvmf_sm_fsp_base_impl.h"
     20 #endif
     21 #ifndef PVLOGGER_H_INCLUDED
     22 #include "pvlogger.h"
     23 #endif
     24 #ifndef PVMF_STREAMING_MANAGER_NODE_H_INCLUDED
     25 #include "pvmf_streaming_manager_node.h"
     26 #endif
     27 #ifndef PVMF_MEDIA_PRESENTATION_INFO_H_INCLUDED
     28 #include "pvmf_media_presentation_info.h"
     29 #endif
     30 #ifndef PVMF_STREAMING_DATA_SOURCE_H_INCLUDED
     31 #include "pvmf_streaming_data_source.h"
     32 #endif
     33 
     34 #define PVMF_STREAMING_MANAGER_NODE_MAX_CPM_METADATA_KEYS 256
     35 
     36 ///////////////////////////////////////////////////////////////////////////////
     37 //Implementation of PVMFCPMPluginLicenseInterface
     38 ///////////////////////////////////////////////////////////////////////////////
     39 PVMFStatus PVMFSMFSPBaseNode::GetLicenseURL(PVMFSessionId aSessionId,
     40         OSCL_wString& aContentName,
     41         OSCL_wString& aLicenseURL)
     42 {
     43     OSCL_UNUSED_ARG(aSessionId);
     44     OSCL_UNUSED_ARG(aContentName);
     45     OSCL_UNUSED_ARG(aLicenseURL);
     46     //must use Async method.
     47     PVMF_SM_FSP_BASE_LOGERR((0, "PVMFSMFSPBaseNode::GetLicenseURL - Error Not Supported"));
     48     return PVMFErrNotSupported;
     49 }
     50 
     51 PVMFStatus PVMFSMFSPBaseNode::GetLicenseURL(PVMFSessionId aSessionId,
     52         OSCL_String&  aContentName,
     53         OSCL_String&  aLicenseURL)
     54 {
     55     OSCL_UNUSED_ARG(aSessionId);
     56     OSCL_UNUSED_ARG(aContentName);
     57     OSCL_UNUSED_ARG(aLicenseURL);
     58     //must use Async method.
     59     PVMF_SM_FSP_BASE_LOGERR((0, "PVMFSMFSPBaseNode::GetLicenseURL - Error Not Supported"));
     60     return PVMFErrNotSupported;
     61 }
     62 
     63 /**
     64  * Queue an asynchronous node command - GetLicense(Unicode)
     65  */
     66 PVMFCommandId PVMFSMFSPBaseNode::GetLicense(PVMFSessionId aSessionId
     67         , OSCL_wString& aContentName
     68         , OsclAny* aLicenseData
     69         , uint32 aDataSize
     70         , int32 aTimeoutMsec
     71         , OsclAny* aContext)
     72 {
     73     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::GetLicense - Unicode Variant Called"));
     74     PVMFSMFSPBaseNodeCommand cmd;
     75     cmd.PVMFSMFSPBaseNodeCommand::Construct(aSessionId,
     76                                             PVMF_SMFSP_NODE_GET_LICENSE_W,
     77                                             aContentName,
     78                                             aLicenseData,
     79                                             aDataSize,
     80                                             aTimeoutMsec,
     81                                             aContext);
     82     return QueueCommandL(cmd);
     83 }
     84 
     85 /**
     86  * Queue an asynchronous node command - GetLicense(ASCII)
     87  */
     88 PVMFCommandId PVMFSMFSPBaseNode::GetLicense(PVMFSessionId aSessionId
     89         , OSCL_String&  aContentName
     90         , OsclAny* aLicenseData
     91         , uint32 aDataSize
     92         , int32 aTimeoutMsec
     93         , OsclAny* aContext)
     94 {
     95     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::GetLicense - called"));
     96     PVMFSMFSPBaseNodeCommand cmd;
     97     cmd.PVMFSMFSPBaseNodeCommand::Construct(aSessionId,
     98                                             PVMF_SMFSP_NODE_GET_LICENSE,
     99                                             aContentName,
    100                                             aLicenseData,
    101                                             aDataSize,
    102                                             aTimeoutMsec,
    103                                             aContext);
    104     return QueueCommandL(cmd);
    105 
    106 }
    107 
    108 /**
    109  * Queue an asynchronous node command - CancelGetLicense
    110  */
    111 PVMFCommandId PVMFSMFSPBaseNode::CancelGetLicense(PVMFSessionId aSessionId
    112         , PVMFCommandId aCmdId
    113         , OsclAny* aContext)
    114 {
    115     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CancelGetLicense - called"));
    116     PVMFSMFSPBaseNodeCommand cmd;
    117     cmd.PVMFSMFSPBaseNodeCommandBase::Construct(aSessionId,
    118             PVMF_SMFSP_NODE_CANCEL_GET_LICENSE,
    119             aCmdId,
    120             aContext);
    121     return QueueCommandL(cmd);
    122 }
    123 
    124 PVMFStatus PVMFSMFSPBaseNode::GetLicenseStatus(PVMFCPMLicenseStatus& aStatus)
    125 {
    126     if (iCPMLicenseInterface)
    127         return iCPMLicenseInterface->GetLicenseStatus(aStatus);
    128     return PVMFFailure;
    129 }
    130 
    131 void PVMFSMFSPBaseNode::InitCPM()
    132 {
    133     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::InitCPM() In"));
    134 
    135     iCPMInitCmdId = iCPM->Init();
    136 }
    137 
    138 void PVMFSMFSPBaseNode::OpenCPMSession()
    139 {
    140     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::OpenCPMSession() In"));
    141 
    142     iCPMOpenSessionCmdId = iCPM->OpenSession(iCPMSessionID);
    143 }
    144 
    145 void PVMFSMFSPBaseNode::CPMRegisterContent()
    146 {
    147     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CPMRegisterContent() In"));
    148 
    149     if (iSourceContextDataValid)
    150     {
    151         iCPMRegisterContentCmdId = iCPM->RegisterContent(iCPMSessionID,
    152                                    iSessionSourceInfo->_sessionURL,
    153                                    iSessionSourceInfo->_sessionType,
    154                                    (OsclAny*) & iSourceContextData);
    155     }
    156     else
    157     {
    158         iCPMRegisterContentCmdId = iCPM->RegisterContent(iCPMSessionID,
    159                                    iSessionSourceInfo->_sessionURL,
    160                                    iSessionSourceInfo->_sessionType,
    161                                    (OsclAny*) & iCPMSourceData);
    162     }
    163 }
    164 
    165 void PVMFSMFSPBaseNode::GetCPMLicenseInterface()
    166 {
    167     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::GetCPMLicenseInterface() In"));
    168 
    169     iCPMLicenseInterfacePVI = NULL;
    170     iCPMGetLicenseInterfaceCmdId =
    171         iCPM->QueryInterface(iCPMSessionID,
    172                              PVMFCPMPluginLicenseInterfaceUuid,
    173                              iCPMLicenseInterfacePVI);
    174 }
    175 
    176 void PVMFSMFSPBaseNode::GetCPMCapConfigInterface()
    177 {
    178     iCPMCapConfigInterfacePVI = NULL;
    179     iCPMGetCapConfigCmdId =
    180         iCPM->QueryInterface(iCPMSessionID,
    181                              PVMI_CAPABILITY_AND_CONFIG_PVUUID,
    182                              iCPMCapConfigInterfacePVI);
    183 }
    184 
    185 
    186 bool PVMFSMFSPBaseNode::GetCPMContentAccessFactory()
    187 {
    188     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::GetCPMContentAccessFactory() In"));
    189 
    190     PVMFStatus status = iCPM->GetContentAccessFactory(iCPMSessionID,
    191                         iCPMContentAccessFactory);
    192     if (status != PVMFSuccess)
    193     {
    194         return false;
    195     }
    196     return true;
    197 }
    198 
    199 bool PVMFSMFSPBaseNode::GetCPMMetaDataExtensionInterface()
    200 {
    201     PVInterface* temp = NULL;
    202     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::GetCPMMetaDataExtensionInterface() In"));
    203 
    204     bool retVal =
    205         iCPM->queryInterface(KPVMFMetadataExtensionUuid, temp);
    206     iCPMMetaDataExtensionInterface = OSCL_STATIC_CAST(PVMFMetadataExtensionInterface*, temp);
    207 
    208     return retVal;
    209 }
    210 
    211 void PVMFSMFSPBaseNode::RequestUsage()
    212 {
    213     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::RequestUsage() In"));
    214     iCPMRequestUsageId = iCPM->ApproveUsage(iCPMSessionID,
    215                                             iRequestedUsage,
    216                                             iApprovedUsage,
    217                                             iAuthorizationDataKvp,
    218                                             iUsageID,
    219                                             iCPMContentAccessFactory);
    220 }
    221 
    222 void PVMFSMFSPBaseNode::SendUsageComplete()
    223 {
    224     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::SendUsageComplete() In"));
    225 
    226     iCPMUsageCompleteCmdId = iCPM->UsageComplete(iCPMSessionID, iUsageID);
    227 }
    228 
    229 void PVMFSMFSPBaseNode::CloseCPMSession()
    230 {
    231     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CloseCPMSession() In"));
    232 
    233     iCPMCloseSessionCmdId = iCPM->CloseSession(iCPMSessionID);
    234 }
    235 
    236 void PVMFSMFSPBaseNode::ResetCPM()
    237 {
    238     iCPMResetCmdId = iCPM->Reset();
    239 }
    240 
    241 void PVMFSMFSPBaseNode::GetCPMMetaDataKeys()
    242 {
    243     if (iCPMMetaDataExtensionInterface != NULL)
    244     {
    245         iCPMMetadataKeys.clear();
    246         iCPMGetMetaDataKeysCmdId =
    247             iCPMMetaDataExtensionInterface->GetNodeMetadataKeys(iCPMSessionID,
    248                     iCPMMetadataKeys,
    249                     0,
    250                     PVMF_STREAMING_MANAGER_NODE_MAX_CPM_METADATA_KEYS);
    251     }
    252 }
    253 
    254 PVMFStatus
    255 PVMFSMFSPBaseNode::CheckCPMCommandCompleteStatus(PVMFCommandId aID,
    256         PVMFStatus aStatus)
    257 {
    258     PVMFStatus status = aStatus;
    259     if (aID == iCPMGetLicenseInterfaceCmdId)
    260     {
    261         if (aStatus == PVMFErrNotSupported)
    262         {
    263             /* License Interface is Optional */
    264             status = PVMFSuccess;
    265         }
    266     }
    267 
    268     if ((status != PVMFSuccess))
    269     {
    270         OSCL_ASSERT(aID != iCPMResetCmdId);
    271         if (iCurrErrHandlingCommand.size() > 0)
    272         {
    273             if (PVMF_SMFSP_NODE_RESET_DUE_TO_ERROR == iCurrErrHandlingCommand.front().iCmd)
    274             {
    275 
    276                 //skip to next step, cpm cleanup steps are not coupled so moving to next step even if
    277                 //some of inbetween step fails may not be harmful
    278                 status = PVMFSuccess;
    279             }
    280         }
    281     }
    282 
    283     return status;
    284 }
    285 
    286 void PVMFSMFSPBaseNode::CPMCommandCompleted(const PVMFCmdResp& aResponse)
    287 {
    288     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CPMCommandCompleted() In"));
    289 
    290     PVMFCommandId id = aResponse.GetCmdId();
    291     PVMFStatus status =
    292         CheckCPMCommandCompleteStatus(id, aResponse.GetCmdStatus());
    293 
    294     if (id == iCPMCancelGetLicenseCmdId)
    295     {
    296         /*
    297          * if this command is CancelGetLicense, we will return success or fail here.
    298          */
    299         OSCL_ASSERT(!iCancelCommand.empty());
    300         CommandComplete(iCancelCommand,
    301                         iCancelCommand.front(),
    302                         status);
    303         return;
    304     }
    305     else
    306     {
    307         /*
    308          * if there was any pending cancel, we just ignore CPM process.
    309          */
    310         if (iCurrentCommand.empty() && iCurrErrHandlingCommand.empty())
    311         {
    312             return;
    313         }
    314         if (!iCancelCommand.empty())
    315         {
    316             if (iCancelCommand.front().iCmd != PVMF_SMFSP_NODE_CANCEL_GET_LICENSE)
    317                 return;
    318         }
    319     }
    320 
    321     if (status != PVMFSuccess)
    322     {
    323         if (id == iCPMRequestUsageId)
    324         {
    325             /*
    326              * Only when PVMFErrLicenseRequired is replied for license authentication,
    327              * Set iCPMInitPending into true.
    328              */
    329             if (aResponse.GetCmdStatus() == PVMFErrLicenseRequired)
    330                 iCPMInitPending = true;
    331         }
    332         CommandComplete(iCurrentCommand,
    333                         iCurrentCommand.front(),
    334                         aResponse.GetCmdStatus(),
    335                         NULL,
    336                         NULL,
    337                         NULL,
    338                         aResponse.GetEventExtensionInterface());
    339 
    340     }
    341     else
    342     {
    343         /*
    344          * process the response, and issue the next command in
    345          * the sequence.
    346          */
    347 
    348         if (id == iCPMInitCmdId)
    349         {
    350             OpenCPMSession();
    351         }
    352         else if (id == iCPMOpenSessionCmdId)
    353         {
    354             CPMRegisterContent();
    355         }
    356         else if (id == iCPMRegisterContentCmdId)
    357         {
    358             GetCPMCapConfigInterface();
    359         }
    360         else if (id == iCPMGetCapConfigCmdId)
    361         {
    362             iCPMCapConfigInterface = OSCL_STATIC_CAST(PvmiCapabilityAndConfig*, iCPMCapConfigInterfacePVI);
    363             iCPMCapConfigInterfacePVI = NULL;
    364             // got capConfig interface, set kvps for CPM plugins
    365             if (!SetCPMKvps()) return;
    366             GetCPMLicenseInterface();
    367         }
    368         else if (id == iCPMGetLicenseInterfaceCmdId)
    369         {
    370             iCPMLicenseInterface = OSCL_STATIC_CAST(PVMFCPMPluginLicenseInterface*, iCPMLicenseInterfacePVI);
    371             iCPMLicenseInterfacePVI = NULL;
    372             iCPMContentType = iCPM->GetCPMContentType(iCPMSessionID);
    373             OSCL_ASSERT(iCPMContentType == PVMF_CPM_FORMAT_ACCESS_BEFORE_AUTHORIZE);
    374             GetCPMContentAccessFactory();
    375             GetCPMMetaDataExtensionInterface();
    376             RequestUsage();
    377         }
    378         else if (id == iCPMRequestUsageId)
    379         {
    380             OSCL_ASSERT(iCPMContentType == PVMF_CPM_FORMAT_ACCESS_BEFORE_AUTHORIZE);
    381             /* End of Node Init sequence. */
    382             OSCL_ASSERT(!iCurrentCommand.empty());
    383             OSCL_ASSERT(iCurrentCommand.front().iCmd == PVMF_SMFSP_NODE_INIT);
    384             CompleteDRMInit();
    385         }
    386         else if (id == iCPMGetMetaDataKeysCmdId)
    387         {
    388             /* End of GetNodeMetaDataKeys */
    389             PVMFStatus status =
    390                 CompleteGetMetadataKeys(iCurrentCommand.front());
    391             CommandComplete(iCurrentCommand,
    392                             iCurrentCommand.front(),
    393                             status);
    394         }
    395         else if (id == iCPMUsageCompleteCmdId)
    396         {
    397             if (iDecryptionInterface != NULL)
    398             {
    399                 iDecryptionInterface->Reset();
    400                 /* Remove the decrpytion interface */
    401                 PVUuid uuid = PVMFCPMPluginDecryptionInterfaceUuid;
    402                 iCPMContentAccessFactory->DestroyPVMFCPMPluginAccessInterface(uuid, iDecryptionInterface);
    403                 iDecryptionInterface = NULL;
    404             }
    405             CloseCPMSession();
    406         }
    407         else if (id == iCPMCloseSessionCmdId)
    408         {
    409             ResetCPM();
    410         }
    411         else if (id == iCPMResetCmdId)
    412         {
    413             if (EPVMFNodeError != iInterfaceState)
    414             {
    415                 /* End of Node Reset sequence */
    416                 OSCL_ASSERT(!iCurrentCommand.empty());
    417                 OSCL_ASSERT(iCurrentCommand.front().iCmd == PVMF_SMFSP_NODE_RESET);
    418                 iDRMResetPending = false;
    419                 CompleteReset();
    420             }
    421             else
    422             {
    423                 /* End of Node Reset sequence */
    424                 OSCL_ASSERT(!iCurrErrHandlingCommand.empty());
    425                 OSCL_ASSERT(PVMF_SMFSP_NODE_RESET_DUE_TO_ERROR == iCurrErrHandlingCommand.front().iCmd);
    426                 iDRMResetPending = false;
    427                 HandleError(aResponse);
    428             }
    429         }
    430         else if (id == iCPMGetMetaDataValuesCmdId)
    431         {
    432             /* End of GetNodeMetaDataValues */
    433             OSCL_ASSERT(!iCurrentCommand.empty());
    434             OSCL_ASSERT(iCurrentCommand.front().iCmd == PVMF_SMFSP_NODE_GETNODEMETADATAVALUES);
    435             CompleteGetMetaDataValues();
    436         }
    437         else if (id == iCPMGetLicenseCmdId)
    438         {
    439             CompleteGetLicense();
    440         }
    441         else
    442         {
    443             /* Unknown cmd ?? - error */
    444             CommandComplete(iCurrentCommand,
    445                             iCurrentCommand.front(),
    446                             PVMFFailure);
    447         }
    448     }
    449 }
    450 
    451 void PVMFSMFSPBaseNode::CompleteGetMetaDataValues()
    452 {
    453     CommandComplete(iCurrentCommand,
    454                     iCurrentCommand.front(),
    455                     PVMFSuccess);
    456 }
    457 
    458 void PVMFSMFSPBaseNode::CompleteDRMInit()
    459 {
    460     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CompleteDRMInit - In"));
    461     if (iApprovedUsage.value.uint32_value !=
    462             iRequestedUsage.value.uint32_value)
    463     {
    464         CommandComplete(iCurrentCommand,
    465                         iCurrentCommand.front(),
    466                         PVMFErrAccessDenied,
    467                         NULL, NULL, NULL);
    468         return;
    469     }
    470     //If protected content, get the decryption interface, if the intent is play
    471     if (iCPMSourceData.iIntent & BITMASK_PVMF_SOURCE_INTENT_PLAY)
    472     {
    473         PVUuid uuid = PVMFCPMPluginDecryptionInterfaceUuid;
    474         PVInterface* intf =
    475             iCPMContentAccessFactory->CreatePVMFCPMPluginAccessInterface(uuid);
    476         PVMFCPMPluginAccessInterface* interimPtr =
    477             OSCL_STATIC_CAST(PVMFCPMPluginAccessInterface*, intf);
    478         iDecryptionInterface = OSCL_STATIC_CAST(PVMFCPMPluginAccessUnitDecryptionInterface*, interimPtr);
    479         if (iDecryptionInterface == NULL)
    480         {
    481             CommandComplete(iCurrentCommand,
    482                             iCurrentCommand.front(),
    483                             PVMFErrAccessDenied);
    484             return;
    485         }
    486         iDecryptionInterface->Init();
    487 
    488         RequestUsageComplete();
    489     }
    490 
    491     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CompleteDRMInit Success"));
    492     //License authentication was successfull. Init is completed at protected clip
    493     SetState(EPVMFNodeInitialized);
    494     CommandComplete(iCurrentCommand,
    495                     iCurrentCommand.front(),
    496                     PVMFSuccess);
    497 
    498     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CompleteDRMInit - Out"));
    499     return;
    500 }
    501 
    502 bool PVMFSMFSPBaseNode::SetCPMKvps()
    503 {
    504     if (iCPMCapConfigInterface && !iCPMKvpStore.isEmpty())
    505     {
    506         PVMFKvpVector *aVector = iCPMKvpStore.getKVPStore();
    507         for (uint32 i = 0; i < aVector->size(); i++)
    508         {
    509             if (PVMFSuccess != SetCPMKvp((*aVector)[i]))
    510             {
    511                 CommandComplete(iCurrentCommand,
    512                                 iCurrentCommand.front(),
    513                                 PVMFFailure);
    514                 iCPMKvpStore.destroy();
    515                 return false;
    516             }
    517         }
    518         iCPMKvpStore.destroy();
    519     }
    520     return true;
    521 }
    522 
    523 PVMFStatus PVMFSMFSPBaseNode::SetCPMKvp(PvmiKvp& aKVP)
    524 {
    525     PVMFStatus status = PVMFSuccess;
    526     PvmiKvp *aErrorKVP = NULL;
    527     int32 leavecode = 0;
    528     OSCL_TRY(leavecode, iCPMCapConfigInterface->setParametersSync(NULL, &aKVP, 1, aErrorKVP));
    529     OSCL_FIRST_CATCH_ANY(leavecode,
    530                          PVLOGGER_LOGMSG(PVLOGMSG_INST_HLDBG, iLogger, PVLOGMSG_ERR, (0, "PVMFSMFSPBaseNode::PushKeyToMetadataList - Memory allocation failure when copying metadata key"));
    531                          status = leavecode);
    532     return status;
    533 }
    534 
    535 PVMFStatus PVMFSMFSPBaseNode::DoGetLicense(PVMFSMFSPBaseNodeCommand& aCmd,
    536         bool aWideCharVersion)
    537 {
    538     if (iCPMLicenseInterface == NULL)
    539     {
    540         return PVMFErrNotSupported;
    541     }
    542 
    543     if (aWideCharVersion == true)
    544     {
    545 
    546         OSCL_wString* contentName = NULL;
    547         OsclAny* data = NULL;
    548         uint32 dataSize = 0;
    549         int32 timeoutMsec = 0;
    550         aCmd.PVMFSMFSPBaseNodeCommand::Parse(contentName,
    551                                              data,
    552                                              dataSize,
    553                                              timeoutMsec);
    554         iCPMGetLicenseCmdId =
    555             iCPMLicenseInterface->GetLicense(iCPMSessionID,
    556                                              *contentName,
    557                                              data,
    558                                              dataSize,
    559                                              timeoutMsec);
    560     }
    561     else
    562     {
    563         OSCL_String* contentName = NULL;
    564         OsclAny* data = NULL;
    565         uint32 dataSize = 0;
    566         int32 timeoutMsec = 0;
    567         aCmd.PVMFSMFSPBaseNodeCommand::Parse(contentName,
    568                                              data,
    569                                              dataSize,
    570                                              timeoutMsec);
    571         iCPMGetLicenseCmdId =
    572             iCPMLicenseInterface->GetLicense(iCPMSessionID,
    573                                              *contentName,
    574                                              data,
    575                                              dataSize,
    576                                              timeoutMsec);
    577     }
    578     return PVMFPending;
    579 }
    580 
    581 void PVMFSMFSPBaseNode::CompleteGetLicense()
    582 {
    583     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::CompleteGetLicense - called"));
    584     CommandComplete(iCurrentCommand,
    585                     iCurrentCommand.front(),
    586                     PVMFSuccess);
    587 }
    588 
    589 void PVMFSMFSPBaseNode::DoCancelGetLicense(PVMFSMFSPBaseNodeCommand& aCmd)
    590 {
    591     PVMF_SM_FSP_BASE_LOGSTACKTRACE((0, "PVMFSMFSPBaseNode::DoCancelGetLicense() Called"));
    592     PVMFStatus status = PVMFErrArgument;
    593 
    594     if (iCPMLicenseInterface == NULL)
    595     {
    596         status = PVMFErrNotSupported;
    597     }
    598     else
    599     {
    600         /* extract the command ID from the parameters.*/
    601         PVMFCommandId id;
    602         aCmd.PVMFSMFSPBaseNodeCommandBase::Parse(id);
    603 
    604         /* first check "current" command if any */
    605         PVMFSMFSPBaseNodeCommand* cmd = iCurrentCommand.FindById(id);
    606         if (cmd)
    607         {
    608             if (cmd->iCmd == PVMF_SMFSP_NODE_GET_LICENSE_W || cmd->iCmd == PVMF_SMFSP_NODE_GET_LICENSE)
    609             {
    610                 iCPMCancelGetLicenseCmdId =
    611                     iCPMLicenseInterface->CancelGetLicense(iCPMSessionID, iCPMGetLicenseCmdId);
    612 
    613                 /*
    614                  * the queued commands are all asynchronous commands to the
    615                  * CPM module. CancelGetLicense can cancel only for GetLicense cmd.
    616                  * We need to wait CPMCommandCompleted.
    617                  */
    618                 MoveCmdToCancelQueue(aCmd);
    619                 return;
    620             }
    621         }
    622 
    623         /*
    624          * next check input queue.
    625          * start at element 1 since this cancel command is element 0.
    626          */
    627         cmd = iInputCommands.FindById(id, 1);
    628         if (cmd)
    629         {
    630             if (cmd->iCmd == PVMF_SMFSP_NODE_GET_LICENSE_W || cmd->iCmd == PVMF_SMFSP_NODE_GET_LICENSE)
    631             {
    632                 /* cancel the queued command */
    633                 CommandComplete(iInputCommands, *cmd, PVMFErrCancelled, NULL, NULL);
    634                 // report cancel success
    635                 CommandComplete(iInputCommands, aCmd, PVMFSuccess);
    636                 return;
    637             }
    638         }
    639     }
    640     /* if we get here the command isn't queued so the cancel fails */
    641     CommandComplete(iInputCommands, aCmd, status);
    642     return;
    643 }
    644