43 #define PATH_SEPARATOR_LIST_STRING "\\/:"
52 U16BIT original_network_id;
53 U16BIT transport_stream_id;
66 U8BIT *ipPath, U8BIT *opPath,
76 U16BIT serviceId, U32BIT couId, E_SIQueryKind kind,
77 H_DsmCarousel *pclDsmCarouselHandle )
85 dsmDP2((
"CDSM_LoadCarousel( %p,srvID: %u, carouselID: %u, %u, %p )\n",
86 instance, serviceId, couId, pclDsmCarouselHandle));
88 if (!instance || !pclDsmCarouselHandle)
90 dsmDP1((
"ERROR: Illegal parameter\n"));
91 err = CLDSM_ERR_INVALID_INSTANCE;
93 else if (!idp->currentServiceSet)
95 err = CLDSM_ERR_NO_CURRENT_SERVICE_SET;
97 else if ((couId == INVALID_CAROUSEL_ID || couId == UNKNOWN_CAROUSEL_ID) &&
98 idp->pBootingCarousel != NULL)
100 *pclDsmCarouselHandle = (H_DsmCarousel)idp->pBootingCarousel;
101 err = CLDSM_DUPLICATE_REQUEST;
111 *pclDsmCarouselHandle = (H_DsmCarousel)pRC;
113 err = CLDSM_DUPLICATE_REQUEST;
118 *pclDsmCarouselHandle = NULL;
121 case SIQUERY_SSU_PID:
126 case SIQUERY_SSU_CAROUSEL:
139 dsmDP4((
"carousel load created\n"));
140 siQueryData.dataId = couId;
141 siQueryData.serviceId = serviceId;
142 siQueryData.kind = kind;
144 pRC->status = RCS_PENDING_BOOTINFO;
145 err =
siQueryStart( idp, &siQueryData, (
void *)pRC, &siQueryResult );
149 dsmDP2((
"Query Handle=%p\n", siQueryResult.data.queryHandle));
150 dsmAssert((siQueryResult.kind == SIRESULT_PENDING));
152 pRC->pPendingSiQueryRef = siQueryResult.data.queryHandle;
157 dsmDP2((
"Crsl PID=%d\n", siQueryResult.data.carouselInfo.pid));
165 if (kind == SIQUERY_SSU_CAROUSEL || kind == SIQUERY_SSU_PID)
177 *pclDsmCarouselHandle = (H_DsmCarousel)pRC;
180 LLInsertTail( idp->llcRootCarousels, pRC );
182 if (idp->pBootingCarousel == NULL)
185 idp->pBootingCarousel = pRC;
187 if (idp->pCurrentCarousel == NULL)
189 idp->pCurrentCarousel = pRC;
198 DBGLOG(DD_OC,
"ptr=%p", *pclDsmCarouselHandle);
200 case CLDSM_ERR_SI_QUERY_FAILED:
201 DBG3(DD_OC,
"SI query fail loading carousel")
204 ERRPRINT(
"ERROR: clDsmLoadCarousel: %u", err);
220 dsmDP2((
"CDSM_GetCarouselId( %p, %p )\n", instance, hCarousel));
221 if (instance == NULL)
223 err = CLDSM_ERR_INVALID_INSTANCE;
225 else if (!memValidate((MemHandle)hCarousel))
227 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
232 if (pOC->root.magic != OC_MAGIC)
234 ERRPRINT(
"API ERROR: Invalid Carousel handle (magic)")
235 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
239 dsmDP2((
"CDSM_GetCarouselId() is %u\n", pOC->root.rcid));
240 *pCarouselId = pOC->root.rcid;
249 return (H_DsmCarousel)instance->pCurrentCarousel;
253 H_DsmCarousel hCarousel )
257 dsmDP2((
"CDSM_GetCarouselId( %p, %p )\n", idp, hCarousel));
260 err = CLDSM_ERR_INVALID_INSTANCE;
262 else if (!memValidate((MemHandle)hCarousel))
264 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
270 dsmDP1((
"API ERROR: Invalid Carousel handle (magic)\n"));
271 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
283 H_DsmCarousel hCarousel, U16BIT *total,
289 dsmDP2((
"CDSM_CarouselLoadFileGroups( %p, %p )\n", instance, hCarousel));
290 if (instance == NULL)
292 err = CLDSM_ERR_INVALID_INSTANCE;
294 else if (!memValidate((MemHandle)hCarousel))
296 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
301 if (pOC->root.magic != OC_MAGIC)
303 dsmDP1((
"API ERROR: Invalid Carousel handle (magic)\n"));
304 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
308 switch (pOC->root.status)
312 err = DSC_ObjCrslRetrieveFileGroups( pOC, total, pGroups );
316 err = CLDSM_ERR_CAROUSEL_NOT_BOOTED;
329 H_DsmCarousel hCarousel,
336 dsmDP2((
"CDSM_CarouselUnloadFileGroups( %p, %p, %p )\n", instance, hCarousel, groups));
337 if (instance == NULL)
339 err = CLDSM_ERR_INVALID_INSTANCE;
344 if (!memValidate((MemHandle)hCarousel))
346 DSC_ObjCrslReleaseFileGroups( idp, NULL, groups );
351 if (pOC->root.magic != OC_MAGIC)
353 dsmDP1((
"API ERROR: Invalid Carousel handle (magic)\n"));
354 DSC_ObjCrslReleaseFileGroups( idp, NULL, groups );
358 DSC_ObjCrslReleaseFileGroups( idp, pOC, groups );
372 H_DsmCarousel clDsmCarouselHandle, E_DsmRstMode mode )
377 E_DscError err = CLDSM_OK;
379 dsmDP2((
"CDSM_UnloadCarousel( %p, %p, %d )\n", instance, clDsmCarouselHandle, mode));
381 dsmAssert((instance != NULL));
383 if (!RC_VALID( pRC ))
385 dsmDP1((
"API ERROR: Invalid Carousel handle (handle)\n"));
386 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
388 else if ( (pRC->magic == OC_MAGIC) &&
391 dsmDP1((
"ERROR: Objects still loaded in Carousel\n"));
392 err = CLDSM_ERR_OBJECTS_STILL_LOADED;
398 idp->pBootingCarousel = NULL;
399 if (idp->pCurrentCarousel == pRC)
401 idp->pCurrentCarousel = NULL;
406 case RCS_PENDING_BOOTINFO:
411 dsmAssert((pRC->pPendingSiQueryRef != NULL));
415 pRC->pPendingSiQueryRef = NULL;
424 pLoadRequest->rlr.status = LRS_ABORTED_BY_REQUESTER;
430 if (pRC->magic == OC_MAGIC)
436 dsmAssert((pLoadRequest != NULL));
437 pLoadRequest->rlr.status = LRS_ABORTED_BY_REQUESTER;
438 lmStopModuleLoadRequest( idp, pLoadRequest );
444 case RCS_LOAD_FAILED:
447 if (pRC->magic == OC_MAGIC)
449 if (idp->setup.notifyCarouselLoadEventFunc)
451 idp->setup.notifyCarouselLoadEventFunc((H_DsmCarousel)pRC, OC_LOAD_ABORTED_UNLOAD, pRC->rcid);
456 dsmAssert((pRC->magic == UC_MAGIC));
457 if (idp->setup.ssuFuncs.status)
461 idp->setup.ssuFuncs.status((H_DsmCarousel)pRC, SSU_CRSL_UNLOAD, sr, 0 );
468 dsmDP1((
"ERROR: Illegal Carousel status = %u\n", pRC->status));
471 err = CLDSM_ERR_INTERNAL;
481 DSC_SectionFilterStop( idp, &pRC->pDsiSf );
486 DSC_RootCrslUnload( idp, pRC );
487 DSC_RootCrslDestroy( idp, pRC );
490 if (idp->pCurrentCarousel == NULL)
494 idp->pCurrentCarousel = LLHead( idp->llcRootCarousels );
497 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: clDsmUnloadCarousel: %u\n", err)));
498 dsmDP2((
"exit clDsmUnloadCarousel -> rtn: %u \n", err));
516 if (!memValidate(pRC) || pRC->magic != UC_MAGIC)
518 ERRPRINT(
"not Update Carousel")
519 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
537 U8BIT *pathname, U32BIT timeout, E_CacheRules cachingRules,
538 H_ObjUserData pUserData, U32BIT sizeOfUserData,
539 E_ObjLoadStatus *pStatus,
H_DsmObject *pclDsmObjectHandle )
541 U8BIT path[MAX_PATH_NAME_SIZE];
547 dsmDP2((
"CDSM_LoadObject( %p, %s, %u, %u, %p, %u, %p, %p )\n",
548 idp, pathname, timeout, cachingRules,
549 pUserData, sizeOfUserData, pStatus, pclDsmObjectHandle));
551 API_PARAM_CHK( idp, dsmDP1((
"ERROR: Invalid instance\n")),
552 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
553 API_PARAM_CHK( pStatus, dsmDP1((
"ERROR: Illegal parameter\n")),
554 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
555 API_PARAM_CHK( pclDsmObjectHandle, dsmDP1((
"ERROR: Illegal parameter\n")),
556 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
557 API_PARAM_CHK( pathname, dsmDP1((
"ERROR: Invalid pathname\n")),
558 err = CLDSM_ERR_INVALID_PATHNAME;
goto _return );
560 err = RetrieveCarouselPath( idp, pathname, path, &pOC );
563 *pclDsmObjectHandle = NULL;
564 *pStatus = OBJ_LOAD_UNINITIATED;
566 err = objectCreate( idp, &pDsmObject );
573 pDsmObject->pObjCarousel = pOC;
577 #ifndef DSM_DISABLE_CACHE_PRIORITISING
578 pDsmObject->cachingRules = cachingRules;
580 err = lmRequestObjectLoad( idp, pOC, path, timeout, pUserData, sizeOfUserData,
581 pDsmObject, &pLoadRequest );
585 switch (pLoadRequest->rlr.status)
588 ERRLOG(DD_MOD,
"%s LOADED",pathname)
589 pDsmObject->pObjCarousel = pLoadRequest->pObjCarousel;
590 pDsmObject->pModule = pLoadRequest->pModule;
591 pDsmObject->objectDataOffset =
592 pLoadRequest->targetObjectOffset;
593 pDsmObject->objectInfo = pLoadRequest->targetObjectInfo;
595 convertObjectKindStr(
596 pLoadRequest->targetObjectInfo.objectKind );
598 lmSetObjectModuleLoaded( idp, pDsmObject->pModule );
600 pDsmObject->status = OBJ_LOAD_COMPLETED;
602 *pStatus = OBJ_LOAD_COMPLETED;
603 *pclDsmObjectHandle = (
void *) pDsmObject;
606 case LRS_STALLED_MODULE:
607 case LRS_STALLED_SRG_MODULE:
608 pDsmObject->r.pLoadRequest = pLoadRequest;
609 pDsmObject->status = OBJ_LOAD_IN_PROGRESS;
611 *pStatus = OBJ_LOAD_IN_PROGRESS;
612 *pclDsmObjectHandle = (
void *) pDsmObject;
615 case LRS_LITE_OPTIONS_LOADED:
616 dsmDP2(("LRS_LITE_OPTIONS_LOADED pOC=%p\n", pLoadRequest->pObjCarousel));
617 pDsmObject->pObjCarousel = pLoadRequest->pObjCarousel;
618 pDsmObject->pModule = pLoadRequest->pModule;
619 pDsmObject->objectDataOffset =
620 pLoadRequest->targetObjectOffset;
621 pDsmObject->objectInfo = pLoadRequest->targetObjectInfo;
623 convertObjectKindStr(
624 pLoadRequest->targetObjectInfo.objectKind );
626 lmSetObjectModuleLoaded( idp, pDsmObject->pModule );
628 pDsmObject->status = OBJ_LOAD_COMPLETED;
629 *pStatus = OBJ_LOAD_COMPLETED;
630 *pclDsmObjectHandle = (
void *) pDsmObject;
633 case LRS_LITE_OPTIONS_PENDING:
634 dsmDP2(("LRS_LITE_OPTIONS_PENDING pOC=%p\n", pLoadRequest->pObjCarousel));
635 pDsmObject->r.pLoadRequest = pLoadRequest;
636 pDsmObject->pObjCarousel = pLoadRequest->pObjCarousel;
637 pDsmObject->objectDataOffset =
638 pLoadRequest->targetObjectOffset;
639 pDsmObject->objectInfo = pLoadRequest->targetObjectInfo;
641 convertObjectKindStr(
642 pLoadRequest->targetObjectInfo.objectKind );
644 pDsmObject->status = OBJ_LOAD_IN_PROGRESS;
645 *pStatus = OBJ_LOAD_IN_PROGRESS;
646 *pclDsmObjectHandle = (
void *) pDsmObject;
656 case LRS_ABORTED_PATH_ERROR:
657 *pStatus = OBJ_LOAD_ABORTED_PATH_ERROR;
658 ERRPRINT("%p", pDsmObject)
659 err = CLDSM_ERR_LOAD_FAILED;
662 case LRS_ABORTED_LOAD_ERROR:
663 *pStatus = OBJ_LOAD_ABORTED_ERROR;
664 ERRPRINT("%p", pDsmObject)
665 err = CLDSM_ERR_LOAD_FAILED;
668 case LRS_ABORTED_TIMEOUT:
669 *pStatus = OBJ_LOAD_ABORTED_TIMEOUT;
672 ERRPRINT("%p", pDsmObject)
673 err = CLDSM_ERR_LOAD_FAILED;
678 dsmDP1(("ERROR: Illegal loadRequest status = %u\n",
679 pLoadRequest->rlr.status));
680 *pStatus = OBJ_LOAD_ABORTED_ERROR;
681 ERRPRINT("%p", pDsmObject)
683 err = CLDSM_ERR_INTERNAL;
691 if (pLoadRequest->rlr.status == LRS_LITE_OPTIONS_LOADED ||
692 pLoadRequest->rlr.status == LRS_LITE_OPTIONS_PENDING)
696 idp->pCurrentCarousel = (
P_RootCarousel)pLoadRequest->pObjCarousel;
699 pLiteOC = pDsmObject->pObjCarousel;
700 pLiteOC->loadedObjectCount++;
704 pOC->loadedObjectCount++;
708 LLInsertHead( pOC->llcCurrObjects, pDsmObject );
718 lmLoadDestroy( idp, pLoadRequest );
720 objectDestroy( idp, pDsmObject );
725 if (*pStatus == OBJ_LOAD_COMPLETED)
728 lmLoadDestroy( idp, pLoadRequest );
733 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"clDsmLoadObject:%u Path=%s not found\n", err, path)));
734 dsmDP2((
"clDsmLoadObject -> rtn: %u, o/p: %u, Hl=%p pLoadRequest = 0x%p path=%s\n",
735 err, *pStatus, *pclDsmObjectHandle, pLoadRequest, path));
749 E_DscError err = CLDSM_OK;
752 dsmDP2((
"CDSM_UnloadObject( %p, Hl=%p )\n", instance, clDsmObjectHandle));
754 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
755 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
757 if (!memValidate( pObject ))
759 dsmDP1((
"API ERROR: Invalid object handle\n"));
760 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
762 else if (!DSM_OBJECT_CORRECT( pObject, idp ))
764 dsmDP1((
"API ERROR: Invalid object handle\n"));
765 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
767 else if (pObject->status == OBJ_LOAD_ABORTED_UNLOAD)
769 dsmDP1((
"API ERROR: Invalid object handle (already unloaded)\n"));
770 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
772 else if (pObject->objectDataSeq != NULL)
774 dsmDP1((
"API ERROR: Object still open\n"));
775 err = CLDSM_ERR_OBJECT_OPEN;
787 pOC = pObject->pObjCarousel;
791 pOC->loadedObjectCount--;
796 DBGLOG(DD_GEN,
"Object's Carousel is NULL")
800 LLRemove( pObject, CURR_OBJECT_LIST );
802 switch (pObject->status)
804 case OBJ_LOAD_IN_PROGRESS:
805 pLoadRequest = pObject->r.pLoadRequest;
806 ASSERT( pLoadRequest != NULL )
807 if (mode == RST_MODE_PENDING)
809 if (pLoadRequest->rlr.status != LRS_ABORT_PENDING_RELOAD)
811 DBGLOG(DD_GEN,
"Object remains pending a re-load")
812 pLoadRequest->rlr.status = LRS_ABORT_PENDING_RELOAD;
813 lmStopModuleLoadRequest( idp, pLoadRequest );
816 pObject->pObjCarousel = NULL;
821 if (pLoadRequest->rlr.status == LRS_ABORT_PENDING_RELOAD)
823 pLoadRequest->rlr.status = LRS_ABORTED_BY_REQUESTER;
829 pLoadRequest->rlr.status = LRS_ABORTED_BY_REQUESTER;
830 lmStopModuleLoadRequest( idp, pLoadRequest );
832 objectDestroy( idp, pObject );
836 case OBJ_LOAD_COMPLETED:
837 lmSetObjectModuleUnloaded( idp, pObject->pModule );
840 pObject->pModule = NULL;
842 case OBJ_LOAD_ABORTED_TIMEOUT:
843 case OBJ_LOAD_ABORTED_PATH_ERROR:
844 case OBJ_LOAD_ABORTED_ERROR:
846 objectDestroy( idp, pObject );
851 objectDestroy( idp, pObject );
852 dsmDP1((
"ERROR: Illegal DSM object status = %u\n",
855 err = CLDSM_ERR_INTERNAL;
860 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: clDsmUnloadObject: %u\n", err)));
861 dsmDP2((
"exit clDsmUnloadObject -> rtn: %u \n", err));
896 E_DsmObjectKind *pKind)
898 E_DscError err = CLDSM_OK;
902 U32BIT dataOffset = 0;
903 U32BIT dataLength = 0;
905 dsmDP2((
"CDSM_OpenObject( %p, %p, %p )\n",
906 instance, clDsmObjectHandle, pKind));
908 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
909 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
910 API_PARAM_CHK( clDsmObjectHandle, dsmDP1((
"ERROR: Invalid object handle\n")),
911 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
goto _return );
912 API_PARAM_CHK( pKind, dsmDP1((
"ERROR: Illegal parameter\n")),
913 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
915 if (!DSM_OBJECT_CORRECT( pDsmObject, idp ))
917 dsmDP1((
"API ERROR: Invalid object handle\n"));
918 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
920 else if (pDsmObject->pModule == NULL)
922 err = CLDSM_ERR_OBJECT_NOT_LOADED;
924 else if (pDsmObject->objectDataSeq != NULL)
926 err = CLDSM_ERR_OBJECT_OPEN;
928 else if (idp->dsmObjectsOpen >= NUM_OPEN_DSM_OBJECTS_MAX)
930 err = CLDSM_ERR_OPEN_OBJECT_LIMIT;
934 pModule = pDsmObject->pModule;
935 dsmAssert((pModule->hModuleData != NULL));
936 dsmAssert((pModule->moduleInfo.crslMagic == OC_MAGIC));
940 switch (pDsmObject->kind)
944 case STREAM_OBJ_WITH_EVENTS:
946 dataOffset = pDsmObject->objectInfo.messageBodyOffset;
947 dataLength = pDsmObject->objectInfo.messageBodyLength;
955 dataOffset = pDsmObject->objectInfo.messageBodyOffset + 4;
956 dataLength = pDsmObject->objectInfo.messageBodyLength - 4;
959 case SERVICE_GATEWAY_OBJ:
964 dataOffset = pDsmObject->objectInfo.objectInfoOffset +
965 pDsmObject->objectInfo.objectInfoLength;
969 dataLength = pDsmObject->objectInfo.objectLen -
970 pDsmObject->objectInfo.objectInfoOffset -
971 pDsmObject->objectInfo.objectInfoLength;
976 dsmDP1((
"API ERROR: Invalid object kind\n"));
977 err = CLDSM_ERR_INVALID_OBJECT_TYPE;
984 *pKind = pDsmObject->kind;
985 err = CLDSM_ERR_END_OF_DATA;
990 DBGLOG(DD_OBJ,
"Module %p, status %u",pModule,pModule->status)
991 pDsmObject->hModuleData = pModule->hModuleData;
994 CHECK_MEM_ERR(memSeqOpen(MEM_CONTEXT, (MemHandle)moduleDataOpen(pDsmObject->hModuleData),
995 (pDsmObject->objectDataOffset + dataOffset), dataLength,
996 TRUE , &(pDsmObject->objectDataSeq)));
1004 *pKind = pDsmObject->kind;
1006 idp->dsmObjectsOpen++;
1012 DEBUG_CHK( err == CLDSM_OK,
1013 dsmDP1((
"ERROR: clDsmOpenObject: %u\n", err)));
1014 dsmDP2((
"exit clDsmOpenObject -> rtn: %u, o/p: %u \n", err, *pKind));
1028 E_DscError err = CLDSM_OK;
1030 dsmDP2((
"CDSM_CloseObject( %p, %p )\n",
1031 instance, clDsmObjectHandle));
1033 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
1034 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
1035 API_PARAM_CHK( clDsmObjectHandle, dsmDP1((
"ERROR: Invalid object handle\n")),
1036 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
goto _return );
1039 if (!DSM_OBJECT_CORRECT( pDsmObject, idp ))
1041 dsmDP1((
"API ERROR: Invalid object handle\n"));
1042 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
1044 else if (pDsmObject->pModule == NULL)
1046 err = CLDSM_ERR_OBJECT_NOT_LOADED;
1048 else if (pDsmObject->objectDataSeq == NULL)
1050 err = CLDSM_ERR_OBJECT_NOT_OPEN;
1054 moduleDataClose(idp, pDsmObject->hModuleData);
1055 pDsmObject->hModuleData = NULL;
1056 memSeqClose( pDsmObject->objectDataSeq );
1057 pDsmObject->objectDataSeq = NULL;
1059 idp->dsmObjectsOpen--;
1064 DEBUG_CHK( err == CLDSM_OK,
1065 dsmDP1((
"ERROR: clDsmCloseObject: %u\n", err)));
1066 dsmDP2((
"exit clDsmCloseObject -> rtn: %u\n", err));
1079 if (!memValidate( pDsmObject ))
1083 return pDsmObject->myDsmInst;
1089 E_DscError CDSM_SetObjectCachingRules(
H_DsmCoreInst instance,
1090 U8BIT *pathname, E_CacheRules cachingRules )
1093 U8BIT path[MAX_PATH_NAME_SIZE];
1098 dsmDP2((
"CDSM_SetObjectCachingRules( %p, %s, %u )\n", instance, pathname, cachingRules));
1100 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
1101 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
1102 API_PARAM_CHK( pathname, dsmDP1((
"ERROR: Invalid pathname\n")),
1103 err = CLDSM_ERR_INVALID_PATHNAME;
goto _return );
1105 err = RetrieveCarouselPath( idp, pathname, path, &pOC );
1108 #ifdef DSM_DISABLE_CACHE_PRIORITISING
1110 cachingRules = CACHE_RULES_DEFAULT;
1113 err = lmGetObjectLoadState( idp, pOC, (U8BIT *)path, &pModule );
1116 if (pModule != NULL)
1119 dsmAssert((pModule->status == MS_CACHED));
1120 dsmAssert((pModule->hModuleData != NULL));
1125 if (cachingRules == CACHE_RULES_FROM_STREAM)
1127 DSC_ModuleDataRefresh( idp, pModule );
1132 if (err == CLDSM_ERR_LOAD_FAILED)
1139 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: clDsmSetObjectCachingRules: %u\n", err)));
1140 dsmDP2((
"exit clDsmSetObjectCachingRules -> rtn: %u\n", err));
1149 U8BIT *pathname, U32BIT timeout )
1152 U8BIT path[MAX_PATH_NAME_SIZE];
1156 E_LRStatus lrStatus;
1158 dsmDP2((
"CDSM_PrefetchObject( %p, %s, %u )\n", instance, pathname, timeout));
1160 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
1161 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
1162 API_PARAM_CHK( pathname, dsmDP1((
"ERROR: Invalid pathname\n")),
1163 err = CLDSM_ERR_INVALID_PATHNAME;
goto _return );
1165 err = RetrieveCarouselPath( idp, pathname, path, &pOC );
1168 err = lmPrefetchObjectLoad( idp, pOC, path, timeout, &pLoadRequest );
1172 lrStatus = pLoadRequest->rlr.status;
1177 case LRS_ABORTED_LOAD_ERROR:
1178 case LRS_ABORTED_PATH_ERROR:
1181 lmLoadDestroy( idp, pLoadRequest );
1189 case LRS_STALLED_MODULE:
1190 case LRS_STALLED_SRG_MODULE:
1196 dsmDP1((
"ERROR: Illegal loadRequest status = %u\n",
1199 err = CLDSM_ERR_INTERNAL;
1209 lmLoadDestroy( idp, pLoadRequest );
1214 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: clDsmPrefetchObject: %u\n", err)));
1215 dsmDP2((
"exit clDsmPrefetchObject -> rtn: %u\n", err));
1226 E_DscError CDSM_ObjectGetKind(
1228 E_DsmObjectKind *pKind )
1231 E_DscError err = CLDSM_OK;
1233 dsmDP2((
"CDSM_ObjectGetKind( %p, %p )\n",
object, pKind));
1235 API_PARAM_CHK(
object, dsmDP1((
"ERROR: Invalid object handle\n")),
1236 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
goto _return );
1237 API_PARAM_CHK( pKind, dsmDP1((
"ERROR: Illegal parameter\n")),
1238 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
1241 if (!DSM_OBJECT_VALIDATE( pDsmObject ))
1243 dsmDP1((
"API ERROR: Invalid object handle\n"));
1244 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
1246 else if (pDsmObject->status != OBJ_LOAD_COMPLETED)
1248 err = CLDSM_ERR_OBJECT_NOT_LOADED;
1252 *pKind = pDsmObject->kind;
1257 DEBUG_CHK( err == CLDSM_OK,
1258 dsmDP1((
"ERROR: dsmObjectGetKind: %u\n", err)));
1259 dsmDP2((
"exit dsmObjectGetKind -> rtn: %u, o/p: %u \n", err, *pKind));
1277 E_DscError CDSM_ObjectGetCarouselHandle(
1279 void **hCarouselHandle )
1282 E_DscError err = CLDSM_OK;
1284 dsmDP2((
"CDSM_ObjectGetCarouselHandle( %p, %p )\n",
object, hCarouselHandle));
1286 API_PARAM_CHK(
object, dsmDP1((
"ERROR: Invalid object handle\n")),
1287 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
goto _return );
1288 API_PARAM_CHK( hCarouselHandle, dsmDP1((
"ERROR: Illegal parameter\n")),
1289 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
1292 if (!DSM_OBJECT_VALIDATE( pDsmObject ))
1294 dsmDP1((
"API ERROR: Invalid object handle\n"));
1295 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
1297 else if (pDsmObject->status != OBJ_LOAD_COMPLETED)
1299 err = CLDSM_ERR_OBJECT_NOT_LOADED;
1303 *hCarouselHandle = pDsmObject->pObjCarousel;
1308 DEBUG_CHK( err == CLDSM_OK,
1309 dsmDP1((
"ERROR: dsmObjectGetCarouselHandle: %u\n", err)));
1310 dsmDP2((
"exit dsmObjectGetCarouselHandle -> rtn: %u, o/p: %p \n", err, *hCarouselHandle));
1350 U8BIT **pSrvCtxtData,
1351 U32BIT *pSrvCtxtLen)
1355 U32BIT initialOffset;
1358 U16BIT application_specific_data_length;
1360 U8BIT serviceContextList_count;
1362 dsmDP3((
"CDSM_ObjectGetServiceContext(clDsmObjectHandle=%p, serviceId=0x%x)\n",
1363 clDsmObjectHandle, serviceId));
1365 if (!DSM_OBJECT_VALIDATE(pObject))
1367 dsmDP1((
"API ERROR: Invalid SRG Object handle\n"));
1368 err = CLDSM_ERR_INVALID_OBJECT_HANDLE;
1370 else if (pObject->status != OBJ_LOAD_COMPLETED)
1372 dsmDP1((
"API ERROR: SRG Object not loaded\n"));
1373 err = CLDSM_ERR_OBJECT_NOT_LOADED;
1375 else if (pObject->objectDataSeq == NULL)
1377 dsmDP1((
"API ERROR Object not open\n"));
1378 err = CLDSM_ERR_OBJECT_NOT_OPEN;
1382 err = CLDSM_ERR_END_OF_DATA;
1385 memSeqReadPos((MemSeqRef)pObject->objectDataSeq, &initialOffset);
1388 addr = pObject->objectDataSeq;
1391 memSeqReadByte( addr, &serviceContextList_count );
1393 for (serviceIdNum = 0; serviceIdNum != serviceContextList_count; serviceIdNum++)
1397 readUInt32Seq(addr, &srvId);
1400 readUInt16Seq(addr, &application_specific_data_length);
1403 if (srvId == serviceId)
1405 *pSrvCtxtLen = application_specific_data_length;
1406 memSeqAccessCurrent( addr, (U8BIT **)pSrvCtxtData, pSrvCtxtLen );
1411 memSeqSetPosRel( addr, application_specific_data_length);
1414 memSeqSetPosAbs(addr, initialOffset);
1416 DEBUG_CHK(err == CLDSM_OK, dsmDP1((
"ERROR: clDsmSRGObjectHandle=%u\n", err)));
1422 static U8BIT* GetHexValue16( U8BIT *url, U16BIT *pValue )
1426 for (i = 0; i != 4; i++, url++)
1428 if (*url >=
'0' && *url <=
'9')
1430 val = (val * 16) + *url -
'0';
1432 else if (*url >=
'a' && *url <=
'f')
1434 val = (val * 16) + 0xa + *url -
'a';
1436 else if (*url >=
'A' && *url <=
'F')
1438 val = (val * 16) + 0xA + *url -
'A';
1452 static U8BIT* GetHexValue32( U8BIT *url, U32BIT *pValue )
1456 for (i = 0; i != 8; i++, url++)
1458 if (*url >=
'0' && *url <=
'9')
1460 val = (val * 16) + *url -
'0';
1462 else if (*url >=
'a' && *url <=
'f')
1464 val = (val * 16) + 0xa + *url -
'a';
1466 else if (*url >=
'A' && *url <=
'F')
1468 val = (val * 16) + 0xA + *url -
'A';
1479 static U8BIT* ParseDvbLocator( U8BIT *url, S_CarouselLocator *pLoc )
1481 url = GetHexValue16( url, &pLoc->original_network_id );
1485 url = GetHexValue16( url, &pLoc->transport_stream_id );
1489 url = GetHexValue16( url, &pLoc->service_id );
1493 url = GetHexValue16( url, &pLoc->component_tag );
1497 url = GetHexValue32( url, &pLoc->carousel_id );
1535 if (ipPath[0] ==
'/' && ipPath[1] ==
'/')
1541 ipPath = ParseDvbLocator( ipPath, pLoc );
1547 while (*ipPath ==
'/' || *ipPath ==
'\\')
1551 pathElementLen = strcspn((
char *)ipPath, PATH_SEPARATOR_LIST_STRING );
1554 pathLen = pathElementLen;
1555 while (pathLen < (MAX_PATH_NAME_SIZE - 1) && pathElementLen != 0)
1558 memcpy( opPath, ipPath, pathElementLen );
1561 ipPath += pathElementLen;
1562 opPath += pathElementLen;
1564 if (*ipPath ==
'\0')
1569 *opPath++ = PATH_SEPERATOR_CHAR;
1573 ipPath += strspn((
char *)ipPath, PATH_SEPARATOR_LIST_STRING );
1576 pathElementLen = strcspn((
char *)ipPath, PATH_SEPARATOR_LIST_STRING );
1577 pathLen += pathElementLen;
1579 if (pathLen >= (MAX_PATH_NAME_SIZE - 1))
1581 dsmDP1((
"API ERROR: Invalid pathname length: %u\n", pathLen));
1582 err = CLDSM_ERR_INVALID_PATHNAME;
1589 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: SanitisePath: %u\n", err)));
1590 dsmDP3((
"exit SanitisePath -> rtn: %u\n", err));
1595 U8BIT *ipPath, U8BIT *opPath,
1600 S_CarouselLocator locator;
1603 locator.original_network_id = idp->dvbLocator.original_network_id;
1604 locator.transport_stream_id = idp->dvbLocator.transport_stream_id;
1605 locator.service_id = 0xFFFF;
1606 locator.component_tag = 0xFFFF;
1607 locator.carousel_id = INVALID_CAROUSEL_ID;
1608 err = SanitisePath( ipPath, opPath, &locator );
1611 if (locator.original_network_id != idp->dvbLocator.original_network_id ||
1612 (locator.transport_stream_id != 0 &&
1613 locator.transport_stream_id != idp->dvbLocator.transport_stream_id &&
1614 idp->dvbLocator.transport_stream_id != 0))
1616 ERRPRINT(
"different transport: onet=0x%x trans=0x%x",
1617 locator.original_network_id, locator.transport_stream_id )
1618 err = CLDSM_ERR_CAROUSEL_UNAVAILABLE;
1623 if (locator.service_id == 0xFFFF)
1625 if (pOC == NULL || !memValidate( pOC ) || pOC->root.magic != OC_MAGIC)
1627 ERRPRINT(
"ERROR: Invalid Current Carousel %p", pOC)
1628 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
1632 locator.service_id = pOC->root.serviceId;
1633 locator.carousel_id = pOC->root.rcid;
1634 DBGLOG(DD_OC,
"cid=%d", locator.carousel_id)
1637 else if (locator.component_tag == 0xFFFF)
1639 if (pOC == NULL || !memValidate( pOC ) || pOC->root.magic != OC_MAGIC)
1641 ERRPRINT(
"ERROR: Current Carousel is invalid")
1642 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
1644 else if (locator.service_id != pOC->root.serviceId)
1646 ERRPRINT(
"current carousel on different service: sid=0x%x cc_sid=0x%x",
1647 locator.service_id, pOC->root.serviceId)
1648 err = CLDSM_ERR_CAROUSEL_UNAVAILABLE;
1652 locator.carousel_id = pOC->root.rcid;
1653 DBGLOG(DD_OC,
"cid=%d", locator.carousel_id)
1656 else if (locator.carousel_id == INVALID_CAROUSEL_ID)
1660 DBGLOG(DD_OC,
"ctag=%d", locator.component_tag)
1661 siQueryData.kind = SIQUERY_CAROUSEL_INFO;
1662 siQueryData.dataId = (U8BIT)locator.component_tag;
1663 siQueryData.serviceId = locator.service_id;
1664 err =
siQueryStart( idp, &siQueryData, NULL, &siQueryResult );
1672 locator.carousel_id = siQueryResult.data.carouselInfo.carouselId;
1673 DBGLOG(DD_OC,
"cid=%d", locator.carousel_id)
1676 ERRPRINT("err=%d", err);
1681 if (locator.carousel_id != INVALID_CAROUSEL_ID)
1686 DBGLOG(DD_OC,
"pOC=%p", pOC) *
1691 DBGLOG(DD_OC,
"cid=%d", locator.carousel_id)
1693 SIQUERY_CAROUSEL, (H_DsmCarousel *)ppOC );
1699 SIQUERY_CAROUSEL_INFO, (H_DsmCarousel *)ppOC );
1704 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: %s: %u\n", __FUNCTION__, err)));
Header to the dataCarousel module - functions/methods for creating/destroying and managing attributes...
E_DscError CDSM_OpenObject(H_DsmCoreInst instance, H_DsmObject clDsmObjectHandle, E_DsmObjectKind *pKind)
Open object data for subsequent access via API functions for given object kind. The object must have ...
E_DscError CDSM_CarouselUnloadFileGroups(H_DsmCoreInst instance, H_DsmCarousel hCarousel, S_CarouselInfoFileGroup *groups)
Release "File Group Info" data allocated by used by CDSM_CarouselLoadFileGroups() ...
E_DscError CDSM_LoadCarousel(H_DsmCoreInst instance, U16BIT serviceId, U32BIT couId, E_SIQueryKind kind, H_DsmCarousel *pclDsmCarouselHandle)
Request load of a DSM-CC Object Carousel (service domain).
General include file for clDsm library internal definitions.
void DSC_RootCrslUnloadModule(P_DsmCoreInst idp, P_RootCarousel pRC, U32BIT moduleRef)
Unload module on Data Carousel.
Header to the loadMgr module.
P_RootCarousel DSC_RootCrslListFindById(P_LLControl plcCarousels, U16BIT serviceId, U32BIT couId)
Find Carousel from ID's.
E_DscError CDSM_UnloadObject(H_DsmCoreInst instance, H_DsmObject clDsmObjectHandle, E_DsmRstMode mode)
Unload (or cancel the requested load of) a DSM-CC object The client MUST first close and/or unsubscri...
E_DscError CDSM_GetCarouselId(H_DsmCoreInst instance, H_DsmCarousel hCarousel, U32BIT *pCarouselId)
Retrieve Carousel Id for the loaded DSM-CC Object Carousel.
H_DsmCoreInst CDSM_ObjectGetInstance(H_DsmObject clDsmObjectHandle)
Get DSM instance to which the object belongs.
void DSC_UpdCrslDestroy(P_DsmCoreInst idp, P_UpdateCarousel pUC)
Destroy UpdateCarousel.
E_DscError DSC_RootCrslBootCarousel(P_DsmCoreInst idp, P_RootCarousel pRC, P_CarouselInfo pCarouselInfo)
Request DSI for booting carousel, since info is available.
E_DscError CDSM_CarouselLoadFileGroups(H_DsmCoreInst instance, H_DsmCarousel hCarousel, U16BIT *total, S_CarouselInfoFileGroup **pGroups)
Retrieve from Object Carousel's User Info, the "File Group Info" used by Australia and South Africa M...
E_DscError CDSM_UnloadModule(H_DsmCoreInst idp, H_DsmCarousel hCarousel, U32BIT moduleRef)
Unload SSU module. To be called once the client has finished saving this module data.
Header to dsmObject module - functions for managing DSM object heap.
H_DsmCarousel CDSM_CurrentCarousel(H_DsmCoreInst instance)
Retrieve handle to the current carousel for DSM-CC Instance.
E_DscError CDSM_SetCurrentCarousel(H_DsmCoreInst idp, H_DsmCarousel hCarousel)
Sets current carousel for DSM-CC Instance.
E_DscError CDSM_UnloadCarousel(H_DsmCoreInst instance, H_DsmCarousel clDsmCarouselHandle, E_DsmRstMode mode)
Unload (or cancel the requested load of) a DSM-CC Object Carousel (service domain). The client MUST first unload all objects before calling this function (which implies it must also have previously closed and/or unsubscribed any events on any loaded objects). If there are any active object loads in the carousel when clDsmUnloadCarousel is called then the unload will not be executed and an error returned. If the carousel is in the process of loading and/or booting the load operation will be aborted (and the notifyCarouselLoadEventFunc callback made with status OC_LOAD_ABORTED_UNLOAD). Any carousel load request that returned a valid CDSM_CarouselHandle(ie. did not generate an error at clDsmLoadCarousel call time), must be explicitly unloaded via clDsmUnloadCarousel. This is necessary, whether the carousel was successfully loaded or the load was aborted due to timeout or error. Once unload is called for a carousel, the clDsmCarouselHandle is no longer valid and must not be used by the client/calling env. If it needs to access the carousel subsequently it must re-load it and get a new clDsmCarouselHandle value. To forcefully destroy loaded objects and/or carousels (eg. where the handles may be unknown/lost) then clDsmReset can be used with force switches. Note that this physically deletes them from the cache whereas unloading (objects or carousels) does not. CALLBACKS THAT MAY BE INITIATED DURING THIS CALL: delSectionFilterFunc stopTimerFunc stopSIQueryFunc unsubscribeSIChange notifyCarouselLoadEventFunc.
E_DscError DSC_UpdCrslCreate(P_DsmCoreInst idp, U16BIT serviceId, U32BIT carouselId, P_UpdateCarousel *ppUpdateCarousel)
Creates an instance of the UpdateCarousel and initialises it.
void siQueryAbortPending(P_DsmCoreInst idp, P_SiQuery pSiQueryRef)
Aborts the specified SI Query before completion. Stops/destroys duplicate queries. For original queries or duplicate queries that have expired parents (and no further duplicates) calls stop SI Query callback on relevant query.
E_DscError CDSM_ObjectGetServiceContext(H_DsmObject clDsmObjectHandle, U32BIT serviceId, U8BIT **pSrvCtxtData, U32BIT *pSrvCtxtLen)
This function gets service context of DSM object (if available) Need by MHEG5 for specified service g...
Header to the sectionFilter module.
Header to the objectCarousel module.
E_DscError siQueryStart(P_DsmCoreInst idp, P_SIQueryRequest pQueryData, void *queryTarget, P_SIQueryResult pResult)
Starts an SI Query. First tests if we have already made this query and the results are stored or stil...
Header to siQuery module - functions for managing SI queries.
Implementation of the Update Carousel module.
Header to the 'module' module - Functions/methods for creating/destroying and managing attributes of ...
eader to the clDsmUtils module.
Header to the moduleData module.