DSMCC
15.3.1
|
00001 /******************************************************************************* 00002 * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org) 00003 * Copyright © 2004 Ocean Blue Software Ltd 00004 * Copyright © 2001 Koninklijke Philips Electronics N.V 00005 * 00006 * This file is part of a DTVKit Software Component 00007 * You are permitted to copy, modify or distribute this file subject to the terms 00008 * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org 00009 * 00010 * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 00011 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 00012 * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 00013 * 00014 * If you or your organisation is not a member of DTVKit then you have access 00015 * to this source code outside of the terms of the licence agreement 00016 * and you are expected to delete this and any associated files immediately. 00017 * Further information on DTVKit, membership and terms can be found at www.dtvkit.org 00018 *******************************************************************************/ 00028 /* 00029 -- findModuleInDiiMsg - Common Code 00030 -- 00031 -- Find start of requested module in DII message (compatible with 00032 -- contiguous or managed/MemSeq memory) 00033 -- 00034 -- Uses/assumes the following vars: 00035 -- found, mpDiiMsg, dataLength, *mpModuleInfoDescStart 00036 -- 00037 -- mpDiiMsg references ('points' to) first byte of DIIMessageBody, 00038 -- found (BOOLEAN) indicates whether module descriptor was found 00039 -- 00040 -- mpDiiMsg = const U8BIT* or MemSeqRef, 00041 -- dataLength = U32BIT 00042 -- mpModuleInfoDescStart = *U8BIT* or *MemSeqRef 00043 -- found = BOOLEAN 00044 */ 00045 00046 { 00047 MemPtr mpModuleInfoDesc; 00048 U16BIT numModules; 00049 U16BIT currModuleId; 00050 MemPos moduleDataEnd = 0; 00051 MemPos currStartPos = 0; 00052 U8BIT moduleInfoLength; 00053 00054 dsmAssert(( mpDiiMsg != NULL )); 00055 dsmAssert(( dataLength > 0 )); 00056 dsmAssert(( mpModuleInfoDescStart != NULL )); 00057 00058 00059 found = FALSE; 00060 00061 /* -- Open MemPtr for accessing module info in DII message */ 00062 MEMPTR_OPEN( mpDiiMsg, mpModuleInfoDesc ); 00063 00064 /* -- mpModuleInfo -> DIIMessageBody */ 00065 00066 /* -- Skip downloadId, blockSize - not used here */ 00067 SET_POS_REL( mpModuleInfoDesc, 6 ); 00068 00069 /* -- Skip windowSize, ackPeriod, tCDownloadWindow, tCDownloadScenario, 00070 -- compatibilityDescriptor - unused in DVB OC */ 00071 SET_POS_REL( mpModuleInfoDesc, 12 ); 00072 00073 /* -- Read numberOfModules */ 00074 READ_UINT16( mpModuleInfoDesc, numModules ); 00075 00076 /* -- Calculate end position of module data */ 00077 GET_POS( mpModuleInfoDesc, moduleDataEnd ); 00078 moduleDataEnd += dataLength; 00079 00080 /* -- Loop through module descriptors until we find the right one */ 00081 while (numModules--) { 00082 00083 /* -- mpModuleInfo -> start of module descriptor */ 00084 00085 /* -- Remember start position of this module descriptor */ 00086 GET_POS( mpModuleInfoDesc, currStartPos ); 00087 00088 /* -- Check for end of module data */ 00089 if (currStartPos >= moduleDataEnd) { 00090 break; 00091 } 00092 00093 /* -- Read moduleId */ 00094 READ_UINT16( mpModuleInfoDesc, currModuleId ); 00095 00096 if (currModuleId == moduleId) { 00097 found = TRUE; 00098 break; 00099 } 00100 00101 /* -- Skip moduleSize, moduleVersion */ 00102 SET_POS_REL( mpModuleInfoDesc, 5 ); 00103 00104 /* -- Read moduleInfoLength */ 00105 READ_UINT8( mpModuleInfoDesc, moduleInfoLength ); 00106 00107 /* -- Skip objectInfo */ 00108 SET_POS_REL( mpModuleInfoDesc, (S32BIT)moduleInfoLength ); 00109 } 00110 00111 if (found) { 00112 SET_POS_ABS( *mpModuleInfoDescStart, currStartPos ); 00113 } 00114 00115 MEMPTR_CLOSE( mpModuleInfoDesc ); 00116 } 00117 00118 00119 /*----------------------------------------------------------------------------*/ 00120 00121 00122