<ahref="index__v1_8c.html">Go to the documentation of this file.</a><divclass="fragment"><divclass="line"><aid="l00001"name="l00001"></a><spanclass="lineno"> 1</span><spanclass="comment">/*</span></div>
<divclass="line"><aid="l00002"name="l00002"></a><spanclass="lineno"> 2</span><spanclass="comment"> * This file is part of the Aaru Data Preservation Suite.</span></div>
<divclass="line"><aid="l00005"name="l00005"></a><spanclass="lineno"> 5</span><spanclass="comment"> * This library is free software; you can redistribute it and/or modify</span></div>
<divclass="line"><aid="l00006"name="l00006"></a><spanclass="lineno"> 6</span><spanclass="comment"> * it under the terms of the GNU Lesser General Public License as</span></div>
<divclass="line"><aid="l00007"name="l00007"></a><spanclass="lineno"> 7</span><spanclass="comment"> * published by the Free Software Foundation; either version 2.1 of the</span></div>
<divclass="line"><aid="l00008"name="l00008"></a><spanclass="lineno"> 8</span><spanclass="comment"> * License, or (at your option) any later version.</span></div>
<divclass="line"><aid="l00010"name="l00010"></a><spanclass="lineno"> 10</span><spanclass="comment"> * This library is distributed in the hope that it will be useful, but</span></div>
<divclass="line"><aid="l00011"name="l00011"></a><spanclass="lineno"> 11</span><spanclass="comment"> * WITHOUT ANY WARRANTY; without even the implied warranty of</span></div>
<divclass="line"><aid="l00012"name="l00012"></a><spanclass="lineno"> 12</span><spanclass="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU</span></div>
<divclass="line"><aid="l00013"name="l00013"></a><spanclass="lineno"> 13</span><spanclass="comment"> * Lesser General Public License for more details.</span></div>
<divclass="line"><aid="l00015"name="l00015"></a><spanclass="lineno"> 15</span><spanclass="comment"> * You should have received a copy of the GNU Lesser General Public</span></div>
<divclass="line"><aid="l00016"name="l00016"></a><spanclass="lineno"> 16</span><spanclass="comment"> * License along with this library; if not, see <http://www.gnu.org/licenses/>.</span></div>
<divclass="line"><aid="l00095"name="l00095"></a><spanclass="lineno"> 95</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not allocate memory for index entries array."</span>);</div>
<divclass="line"><aid="l00100"name="l00100"></a><spanclass="lineno"> 100</span><spanclass="comment">// Read the index header</span></div>
<divclass="line"><aid="l00101"name="l00101"></a><spanclass="lineno"> 101</span><aclass="code hl_define"href="log_8h.html#a21cc0459b78d5f2d7bd737e5aae1278a">TRACE</a>(<spanclass="stringliteral">"Reading index header at position %llu"</span>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00104"name="l00104"></a><spanclass="lineno"> 104</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not seek to index header at %llu."</span>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00114"name="l00114"></a><spanclass="lineno"> 114</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not read index header at %llu."</span>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00124"name="l00124"></a><spanclass="lineno"> 124</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Incorrect index identifier."</span>);</div>
<divclass="line"><aid="l00131"name="l00131"></a><spanclass="lineno"> 131</span><spanclass="keywordflow">for</span>(<spanclass="keywordtype">int</span> i = 0; i < idx_header.<aclass="code hl_variable"href="structIndexHeader.html#ae58869887e8b622c63cc4ca85b8490a6">entries</a>; i++)</div>
<divclass="line"><aid="l00135"name="l00135"></a><spanclass="lineno"> 135</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not read index entry %d at %llu."</span>, i, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00145"name="l00145"></a><spanclass="lineno"> 145</span><aclass="code hl_define"href="log_8h.html#a21cc0459b78d5f2d7bd737e5aae1278a">TRACE</a>(<spanclass="stringliteral">"Read %d index entries from index block at position %llu"</span>, idx_header.<aclass="code hl_variable"href="structIndexHeader.html#ae58869887e8b622c63cc4ca85b8490a6">entries</a>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00242"name="l00242"></a><spanclass="lineno"> 242</span><spanclass="comment">// This will traverse all blocks and check their CRC64 without uncompressing them</span></div>
<divclass="line"><aid="l00243"name="l00243"></a><spanclass="lineno"> 243</span><aclass="code hl_define"href="log_8h.html#a21cc0459b78d5f2d7bd737e5aae1278a">TRACE</a>(<spanclass="stringliteral">"Checking index integrity at %llu."</span>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00246"name="l00246"></a><spanclass="lineno"> 246</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not seek to index header at %llu."</span>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00252"name="l00252"></a><spanclass="lineno"> 252</span><spanclass="comment">// Read the index header</span></div>
<divclass="line"><aid="l00253"name="l00253"></a><spanclass="lineno"> 253</span><aclass="code hl_define"href="log_8h.html#a21cc0459b78d5f2d7bd737e5aae1278a">TRACE</a>(<spanclass="stringliteral">"Reading index header at position %llu"</span>, ctx-><aclass="code hl_variable"href="structaaruformat__context.html#a670dec8d59407989fefc361dc26c6832">header</a>.<aclass="code hl_variable"href="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">indexOffset</a>);</div>
<divclass="line"><aid="l00258"name="l00258"></a><spanclass="lineno"> 258</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not read index header."</span>);</div>
<divclass="line"><aid="l00266"name="l00266"></a><spanclass="lineno"> 266</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Incorrect index identifier."</span>);</div>
<divclass="line"><aid="l00279"name="l00279"></a><spanclass="lineno"> 279</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Cannot allocate memory for index entries."</span>);</div>
<divclass="line"><aid="l00287"name="l00287"></a><spanclass="lineno"> 287</span><aclass="code hl_define"href="log_8h.html#a053d6037d543b84ce59308ce71d15cd1">FATAL</a>(<spanclass="stringliteral">"Could not read index entries."</span>);</div>
<divclass="line"><aid="l00296"name="l00296"></a><spanclass="lineno"> 296</span><spanclass="comment">// Due to how C# wrote it, it is effectively reversed</span></div>
<divclass="ttc"id="aenums_8h_html_a54420623f26ab6bb61042b41cccf37a3ab8d63dc690b2ba82f066fdc31ab5adad"><divclass="ttname"><ahref="enums_8h.html#a54420623f26ab6bb61042b41cccf37a3ab8d63dc690b2ba82f066fdc31ab5adad">IndexBlock</a></div><divclass="ttdeci">@ IndexBlock</div><divclass="ttdoc">Block containing the index (v1).</div><divclass="ttdef"><b>Definition</b><ahref="enums_8h_source.html#l00146">enums.h:146</a></div></div>
<divclass="ttc"id="aerrors_8h_html_a1d6e49f7e8a1fa489efa0a582e90b5de"><divclass="ttname"><ahref="errors_8h.html#a1d6e49f7e8a1fa489efa0a582e90b5de">AARUF_STATUS_OK</a></div><divclass="ttdeci">#define AARUF_STATUS_OK</div><divclass="ttdoc">Sector present and read without uncorrectable errors.</div><divclass="ttdef"><b>Definition</b><ahref="errors_8h_source.html#l00075">errors.h:75</a></div></div>
<divclass="ttc"id="aerrors_8h_html_a3459a04771fe04f8f77bfa90563a4375"><divclass="ttname"><ahref="errors_8h.html#a3459a04771fe04f8f77bfa90563a4375">AARUF_ERROR_CANNOT_READ_HEADER</a></div><divclass="ttdeci">#define AARUF_ERROR_CANNOT_READ_HEADER</div><divclass="ttdoc">Failed to read container header.</div><divclass="ttdef"><b>Definition</b><ahref="errors_8h_source.html#l00045">errors.h:45</a></div></div>
<divclass="ttc"id="aerrors_8h_html_ab6c57651868e0f35e3821680ebb2b17a"><divclass="ttname"><ahref="errors_8h.html#ab6c57651868e0f35e3821680ebb2b17a">AARUF_ERROR_CANNOT_READ_INDEX</a></div><divclass="ttdeci">#define AARUF_ERROR_CANNOT_READ_INDEX</div><divclass="ttdoc">Index block unreadable / truncated / bad identifier.</div><divclass="ttdef"><b>Definition</b><ahref="errors_8h_source.html#l00043">errors.h:43</a></div></div>
<divclass="ttc"id="aerrors_8h_html_abb63e240b11d790da83bd34507b57851"><divclass="ttname"><ahref="errors_8h.html#abb63e240b11d790da83bd34507b57851">AARUF_ERROR_NOT_AARUFORMAT</a></div><divclass="ttdeci">#define AARUF_ERROR_NOT_AARUFORMAT</div><divclass="ttdoc">Input file/stream failed magic or structural validation.</div><divclass="ttdef"><b>Definition</b><ahref="errors_8h_source.html#l00040">errors.h:40</a></div></div>
<divclass="ttc"id="aindex__v1_8c_html_a5d3b1092abc36a27a441a01a8a0b3b48"><divclass="ttname"><ahref="index__v1_8c.html#a5d3b1092abc36a27a441a01a8a0b3b48">process_index_v1</a></div><divclass="ttdeci">UT_array * process_index_v1(aaruformat_context *ctx)</div><divclass="ttdoc">Processes an index block (version 1) from the image stream.</div><divclass="ttdef"><b>Definition</b><ahref="#l00079">index_v1.c:79</a></div></div>
<divclass="ttc"id="aindex__v1_8c_html_a89ed93d216c4dce0ae5e2acccf8cc2b4"><divclass="ttname"><ahref="index__v1_8c.html#a89ed93d216c4dce0ae5e2acccf8cc2b4">verify_index_v1</a></div><divclass="ttdeci">int32_t verify_index_v1(aaruformat_context *ctx)</div><divclass="ttdoc">Verifies the integrity of an index block (version 1) in the image stream.</div><divclass="ttdef"><b>Definition</b><ahref="#l00225">index_v1.c:225</a></div></div>
<divclass="ttc"id="astructAaruHeaderV2_html_a4ec4b1d593f5a0af19f6d7b8eaeada40"><divclass="ttname"><ahref="structAaruHeaderV2.html#a4ec4b1d593f5a0af19f6d7b8eaeada40">AaruHeaderV2::indexOffset</a></div><divclass="ttdeci">uint64_t indexOffset</div><divclass="ttdoc">Absolute byte offset to primary index block (MUST be > 0; 0 => corrupt/unreadable).</div><divclass="ttdef"><b>Definition</b><ahref="header_8h_source.html#l00115">header.h:115</a></div></div>
<divclass="ttc"id="astructAaruHeaderV2_html_af79ca31bcd428d1a54ac25c30d09b7a7"><divclass="ttname"><ahref="structAaruHeaderV2.html#af79ca31bcd428d1a54ac25c30d09b7a7">AaruHeaderV2::imageMajorVersion</a></div><divclass="ttdeci">uint8_t imageMajorVersion</div><divclass="ttdoc">Container format major version.</div><divclass="ttdef"><b>Definition</b><ahref="header_8h_source.html#l00110">header.h:110</a></div></div>
<divclass="ttc"id="astructIndexEntry_html"><divclass="ttname"><ahref="structIndexEntry.html">IndexEntry</a></div><divclass="ttdoc">Single index entry describing a block's type, (optional) data classification, and file offset.</div><divclass="ttdef"><b>Definition</b><ahref="index_8h_source.html#l00108">index.h:109</a></div></div>
<divclass="ttc"id="astructIndexHeader_html"><divclass="ttname"><ahref="structIndexHeader.html">IndexHeader</a></div><divclass="ttdoc">Index header (version 1) for legacy images (identifier == IndexBlock).</div><divclass="ttdef"><b>Definition</b><ahref="index_8h_source.html#l00066">index.h:67</a></div></div>
<divclass="ttc"id="astructIndexHeader_html_a2813a47694e6c1e6bb4bdf7f0ced6cc4"><divclass="ttname"><ahref="structIndexHeader.html#a2813a47694e6c1e6bb4bdf7f0ced6cc4">IndexHeader::crc64</a></div><divclass="ttdeci">uint64_t crc64</div><divclass="ttdoc">CRC64-ECMA of the entries array (legacy byte-swapped for early images).</div><divclass="ttdef"><b>Definition</b><ahref="index_8h_source.html#l00070">index.h:70</a></div></div>
<divclass="ttc"id="astructIndexHeader_html_ae177ec4a99f07ed0e3caadf38a27268e"><divclass="ttname"><ahref="structIndexHeader.html#ae177ec4a99f07ed0e3caadf38a27268e">IndexHeader::identifier</a></div><divclass="ttdeci">uint32_t identifier</div><divclass="ttdoc">Block identifier (must be BlockType::IndexBlock).</div><divclass="ttdef"><b>Definition</b><ahref="index_8h_source.html#l00068">index.h:68</a></div></div>
<divclass="ttc"id="astructIndexHeader_html_ae58869887e8b622c63cc4ca85b8490a6"><divclass="ttname"><ahref="structIndexHeader.html#ae58869887e8b622c63cc4ca85b8490a6">IndexHeader::entries</a></div><divclass="ttdeci">uint16_t entries</div><divclass="ttdoc">Number of IndexEntry records that follow immediately.</div><divclass="ttdef"><b>Definition</b><ahref="index_8h_source.html#l00069">index.h:69</a></div></div>
<divclass="ttc"id="astructaaruformat__context_html"><divclass="ttname"><ahref="structaaruformat__context.html">aaruformat_context</a></div><divclass="ttdoc">Master context representing an open or in‑creation Aaru image.</div><divclass="ttdef"><b>Definition</b><ahref="context_8h_source.html#l00171">context.h:172</a></div></div>
<liclass="footer">Generated by <ahref="https://www.doxygen.org/index.html"><imgclass="footer"src="doxygen.svg"width="104"height="31"alt="doxygen"/></a> 1.14.0 </li>