Files
libaaruformat/docs/html/flux_8c.html

1254 lines
98 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
<meta name="generator" content="Doxygen 1.15.0"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>libaaruformat: src/blocks/flux.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<script type="text/javascript" src="clipboard.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript" src="cookie.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr id="projectrow">
<td id="projectalign">
<div id="projectname">libaaruformat<span id="projectnumber">&#160;1.0</span>
</div>
<div id="projectbrief">Aaru Data Preservation Suite - Format Library</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.15.0 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search/",'.html');
</script>
<script type="text/javascript">
$(function() { codefold.init(); });
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
initMenu('',true,false,'search.php','Search',true);
$(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
$(function(){initNavTree('flux_8c.html','',''); });
</script>
<div id="container">
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<div id="MSearchResults">
<div class="SRPage">
<div id="SRIndex">
<div id="SRResults"></div>
<div class="SRStatus" id="Loading">Loading...</div>
<div class="SRStatus" id="Searching">Searching...</div>
<div class="SRStatus" id="NoMatches">No Matches</div>
</div>
</div>
</div>
</div>
<div class="header">
<div class="headertitle"><div class="title">flux.c File Reference</div></div>
</div><!--header-->
<div class="contents">
<div class="textblock"><code>#include &lt;inttypes.h&gt;</code><br />
<code>#include &lt;limits.h&gt;</code><br />
<code>#include &lt;stdint.h&gt;</code><br />
<code>#include &lt;stdlib.h&gt;</code><br />
<code>#include &lt;string.h&gt;</code><br />
<code>#include &quot;<a class="el" href="context_8h_source.html">aaruformat/context.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="errors_8h_source.html">aaruformat/errors.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="index_8h_source.html">aaruformat/structs/index.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="consts_8h_source.html">consts.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="decls_8h_source.html">decls.h</a>&quot;</code><br />
<code>#include &quot;<a class="el" href="log_8h_source.html">log.h</a>&quot;</code><br />
<code>#include &quot;utarray.h&quot;</code><br />
<code>#include &quot;uthash.h&quot;</code><br />
</div>
<p><a href="flux_8c_source.html">Go to the source code of this file.</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-nested-classes" class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:FluxCaptureMapEntry" id="r_FluxCaptureMapEntry"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structFluxCaptureMapEntry.html">FluxCaptureMapEntry</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">Internal hash table entry for flux capture lookup. <a href="structFluxCaptureMapEntry.html#details">More...</a><br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-func-members" class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a548a8cb21d02fded8a5084c96bbf5e30" id="r_a548a8cb21d02fded8a5084c96bbf5e30"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a548a8cb21d02fded8a5084c96bbf5e30">flux_capture_record_dtor</a> (void *element)</td></tr>
<tr class="memdesc:a548a8cb21d02fded8a5084c96bbf5e30"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor callback for <a class="el" href="structFluxCaptureRecord.html" title="Internal structure for storing flux capture data during write mode.">FluxCaptureRecord</a> elements in a utarray. <br /></td></tr>
<tr class="memitem:a608a4570f8f6e4a8b7d97dd2fdaf8050" id="r_a608a4570f8f6e4a8b7d97dd2fdaf8050"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a608a4570f8f6e4a8b7d97dd2fdaf8050">flux_map_clear</a> (<a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx)</td></tr>
<tr class="memdesc:a608a4570f8f6e4a8b7d97dd2fdaf8050"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear and deallocate the flux capture lookup map. <br /></td></tr>
<tr class="memitem:a3fd05dad98e7dedb15e256070bd73a88" id="r_a3fd05dad98e7dedb15e256070bd73a88"><td class="memItemLeft" align="right" valign="top">static int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a3fd05dad98e7dedb15e256070bd73a88">flux_map_add</a> (<a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx, const <a class="el" href="structFluxCaptureKey.html">FluxCaptureKey</a> *key, uint32_t index)</td></tr>
<tr class="memdesc:a3fd05dad98e7dedb15e256070bd73a88"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add or update a flux capture entry in the lookup map. <br /></td></tr>
<tr class="memitem:ae840a46bdea143ad49be3ba037376320" id="r_ae840a46bdea143ad49be3ba037376320"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae840a46bdea143ad49be3ba037376320">flux_map_rebuild_from_entries</a> (<a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx)</td></tr>
<tr class="memdesc:ae840a46bdea143ad49be3ba037376320"><td class="mdescLeft">&#160;</td><td class="mdescRight">Rebuild the flux capture lookup map from the flux_entries array. <br /></td></tr>
<tr class="memitem:aac6f1ed284f46388319d99bff2a1f409" id="r_aac6f1ed284f46388319d99bff2a1f409"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#aac6f1ed284f46388319d99bff2a1f409">process_flux_data_block</a> (<a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx, const <a class="el" href="structIndexEntry.html">IndexEntry</a> *entry)</td></tr>
<tr class="memdesc:aac6f1ed284f46388319d99bff2a1f409"><td class="mdescLeft">&#160;</td><td class="mdescRight">Parse and integrate a Flux Data block from the image stream into the context. <br /></td></tr>
<tr class="memitem:a91c222a3e35c47e7a2a13a864d85bc03" id="r_a91c222a3e35c47e7a2a13a864d85bc03"><td class="memItemLeft" align="right" valign="top">static int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a91c222a3e35c47e7a2a13a864d85bc03">ensure_flux_entries_loaded</a> (<a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx)</td></tr>
<tr class="memdesc:a91c222a3e35c47e7a2a13a864d85bc03"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lazy load flux data block if not already loaded. <br /></td></tr>
<tr class="memitem:a5f50a859c1849d13a6f4d26d904fb458" id="r_a5f50a859c1849d13a6f4d26d904fb458"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a5f50a859c1849d13a6f4d26d904fb458">aaruf_get_flux_captures</a> (void *context, uint8_t *buffer, size_t *length)</td></tr>
<tr class="memdesc:a5f50a859c1849d13a6f4d26d904fb458"><td class="mdescLeft">&#160;</td><td class="mdescRight">Retrieve metadata for all flux captures in the image. <br /></td></tr>
<tr class="memitem:ae11fa81212d9e363d8761e849859bab8" id="r_ae11fa81212d9e363d8761e849859bab8"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ae11fa81212d9e363d8761e849859bab8">aaruf_write_flux_capture</a> (void *context, uint32_t head, uint16_t track, uint8_t subtrack, uint32_t capture_index, uint64_t data_resolution, uint64_t index_resolution, const uint8_t *data, uint32_t data_length, const uint8_t *index, uint32_t index_length)</td></tr>
<tr class="memdesc:ae11fa81212d9e363d8761e849859bab8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Add a flux capture to the image during write mode. <br /></td></tr>
<tr class="memitem:a430617e60dee0b72e0ae5635c69f9a6c" id="r_a430617e60dee0b72e0ae5635c69f9a6c"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a430617e60dee0b72e0ae5635c69f9a6c">aaruf_clear_flux_captures</a> (void *context)</td></tr>
<tr class="memdesc:a430617e60dee0b72e0ae5635c69f9a6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Clear all flux captures from the context. <br /></td></tr>
<tr class="memitem:a11995aba3f4efbc10d6b41a628c08e5d" id="r_a11995aba3f4efbc10d6b41a628c08e5d"><td class="memItemLeft" align="right" valign="top">static const <a class="el" href="structFluxEntry.html">FluxEntry</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a11995aba3f4efbc10d6b41a628c08e5d">find_flux_entry_by_key</a> (const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx, const <a class="el" href="structFluxCaptureKey.html">FluxCaptureKey</a> *key)</td></tr>
<tr class="memdesc:a11995aba3f4efbc10d6b41a628c08e5d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Find a flux entry by its identifier key. <br /></td></tr>
<tr class="memitem:ac9145d7789804958ea126d136a45231b" id="r_ac9145d7789804958ea126d136a45231b"><td class="memItemLeft" align="right" valign="top">static int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#ac9145d7789804958ea126d136a45231b">read_flux_payload_header</a> (const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx, uint64_t payload_offset, <a class="el" href="structDataStreamPayloadHeader.html">DataStreamPayloadHeader</a> *header)</td></tr>
<tr class="memdesc:ac9145d7789804958ea126d136a45231b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read and validate a flux payload block header from the image stream. <br /></td></tr>
<tr class="memitem:a99b0c18957e1cb755c1c5e967bb9b97b" id="r_a99b0c18957e1cb755c1c5e967bb9b97b"><td class="memItemLeft" align="right" valign="top">static int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a99b0c18957e1cb755c1c5e967bb9b97b">read_uncompressed_payload</a> (const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx, size_t cmp_length, size_t raw_length, uint8_t **cmp_buffer, uint8_t **payload)</td></tr>
<tr class="memdesc:a99b0c18957e1cb755c1c5e967bb9b97b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read an uncompressed flux payload from the image stream. <br /></td></tr>
<tr class="memitem:a8b2e6d3cc3b80a282d15c2a737eb427c" id="r_a8b2e6d3cc3b80a282d15c2a737eb427c"><td class="memItemLeft" align="right" valign="top">static int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a8b2e6d3cc3b80a282d15c2a737eb427c">read_lzma_compressed_payload</a> (const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *ctx, size_t cmp_length, size_t raw_length, uint8_t **cmp_buffer, uint8_t **payload)</td></tr>
<tr class="memdesc:a8b2e6d3cc3b80a282d15c2a737eb427c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read and decompress an LZMA-compressed flux payload from the image stream. <br /></td></tr>
<tr class="memitem:a0c36f4d6d0d0cec73810133a28c0eb6f" id="r_a0c36f4d6d0d0cec73810133a28c0eb6f"><td class="memItemLeft" align="right" valign="top">static int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a0c36f4d6d0d0cec73810133a28c0eb6f">validate_flux_payload_crcs</a> (const uint8_t *cmp_buffer, size_t cmp_length, const uint8_t *payload, size_t raw_length, uint64_t expected_cmp_crc, uint64_t expected_raw_crc)</td></tr>
<tr class="memdesc:a0c36f4d6d0d0cec73810133a28c0eb6f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Validate CRC64 checksums for a flux payload block. <br /></td></tr>
<tr class="memitem:a2e3b7343a847fe5dac1d25bdf7f82b26" id="r_a2e3b7343a847fe5dac1d25bdf7f82b26"><td class="memItemLeft" align="right" valign="top">static int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a2e3b7343a847fe5dac1d25bdf7f82b26">extract_flux_data_buffers</a> (const <a class="el" href="structFluxEntry.html">FluxEntry</a> *flux_entry, const uint8_t *payload, size_t raw_length, uint8_t *data_data, uint32_t *data_length, uint8_t *index_data, uint32_t *index_length)</td></tr>
<tr class="memdesc:a2e3b7343a847fe5dac1d25bdf7f82b26"><td class="mdescLeft">&#160;</td><td class="mdescRight">Extract data and index buffers from decompressed payload and copy to output buffers. <br /></td></tr>
<tr class="memitem:a4592e2f67d77e1ee35d14cfca412add0" id="r_a4592e2f67d77e1ee35d14cfca412add0"><td class="memItemLeft" align="right" valign="top">int32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0">aaruf_read_flux_capture</a> (void *context, uint32_t head, uint16_t track, uint8_t subtrack, uint32_t capture_index, uint8_t *index_data, uint32_t *index_length, uint8_t *data_data, uint32_t *data_length)</td></tr>
<tr class="memdesc:a4592e2f67d77e1ee35d14cfca412add0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Read a specific flux capture's data and index buffers from the image. <br /></td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 id="header-var-members" class="groupheader"><a id="var-members" name="var-members"></a>
Variables</h2></td></tr>
<tr class="memitem:af25f05916bee2f8489613b6a096c2cec" id="r_af25f05916bee2f8489613b6a096c2cec"><td class="memItemLeft" align="right" valign="top">static const UT_icd&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="#af25f05916bee2f8489613b6a096c2cec">FLUX_CAPTURE_RECORD_ICD</a> = {sizeof(<a class="el" href="structFluxCaptureRecord.html">FluxCaptureRecord</a>), NULL, NULL, <a class="el" href="#a548a8cb21d02fded8a5084c96bbf5e30">flux_capture_record_dtor</a>}</td></tr>
</table>
<a name="doc-func-members" id="doc-func-members"></a><h2 id="header-doc-func-members" class="groupheader">Function Documentation</h2>
<a id="a430617e60dee0b72e0ae5635c69f9a6c" name="a430617e60dee0b72e0ae5635c69f9a6c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a430617e60dee0b72e0ae5635c69f9a6c">&#9670;&#160;</a></span>aaruf_clear_flux_captures()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t aaruf_clear_flux_captures </td>
<td>(</td>
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>context</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Clear all flux captures from the context. </p>
<p>This function removes all flux captures from the context, freeing all associated memory including the flux_captures utarray, flux_entries array, and the flux capture lookup map. The flux_data_header is zeroed.</p>
<p>This function is useful for resetting the flux capture state, particularly in write mode when starting a new image or when discarding previously added captures.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>Pointer to an initialized aaruformat context. Must not be NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure.</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">AARUF_STATUS_OK</td><td>All flux captures successfully cleared. </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>Invalid context or context magic mismatch.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This function is safe to call even if no flux captures are present (no-op). </dd>
<dd>
After this call, ctx-&gt;flux_captures, ctx-&gt;flux_entries, and ctx-&gt;flux_map are all NULL/cleared, and ctx-&gt;flux_data_header is zeroed. </dd>
<dd>
The function does not affect the image file itself; it only clears in-memory state. To remove flux data from an image file, the image must be rewritten.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#ae11fa81212d9e363d8761e849859bab8" title="Add a flux capture to the image during write mode.">aaruf_write_flux_capture()</a> to add flux captures </dd>
<dd>
<a class="el" href="#a5f50a859c1849d13a6f4d26d904fb458" title="Retrieve metadata for all flux captures in the image.">aaruf_get_flux_captures()</a> to retrieve flux capture metadata </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00790">790</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="decls_8h_source.html#l00046">AARU_CALL</a>, <a class="el" href="decls_8h_source.html#l00055">AARU_EXPORT</a>, <a class="el" href="consts_8h_source.html#l00064">AARU_MAGIC</a>, <a class="el" href="errors_8h_source.html#l00040">AARUF_ERROR_NOT_AARUFORMAT</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="context_8h_source.html#l00313">aaruformat_context::flux_captures</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="flux_8c_source.html#l00084">flux_map_clear()</a>, <a class="el" href="context_8h_source.html#l00177">aaruformat_context::magic</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
</div>
</div>
<a id="a5f50a859c1849d13a6f4d26d904fb458" name="a5f50a859c1849d13a6f4d26d904fb458"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5f50a859c1849d13a6f4d26d904fb458">&#9670;&#160;</a></span>aaruf_get_flux_captures()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t aaruf_get_flux_captures </td>
<td>(</td>
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>context</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *</td> <td class="paramname"><span class="paramname"><em>buffer</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t *</td> <td class="paramname"><span class="paramname"><em>length</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Retrieve metadata for all flux captures in the image. </p>
<p>This function retrieves metadata for all flux captures stored in the AaruFormat image. The metadata includes head, track, subtrack, captureIndex, indexResolution, and dataResolution for each capture, but does not include the actual flux data or index buffers (use <a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> to retrieve those).</p>
<p>The function can be called with a NULL buffer to determine the required buffer size. In this case, the required length is written to *length and AARUF_ERROR_BUFFER_TOO_SMALL is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>Pointer to an initialized aaruformat context opened for reading. Must not be NULL. </td></tr>
<tr><td class="paramname">buffer</td><td>Pointer to a buffer to receive the <a class="el" href="structFluxCaptureMeta.html" title="Metadata structure returned by aaruf_get_flux_captures().">FluxCaptureMeta</a> array. May be NULL to query the required size. </td></tr>
<tr><td class="paramname">length</td><td>Pointer to the size of the buffer (in bytes). On input, must contain the buffer size. On output, contains the required size (if buffer is too small) or the actual size written. Must not be NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure.</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">AARUF_STATUS_OK</td><td>Metadata successfully retrieved and written to buffer. </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>Invalid context or context magic mismatch. </td></tr>
<tr><td class="paramname">AARUF_ERROR_FLUX_DATA_NOT_FOUND</td><td>Image contains no flux captures. </td></tr>
<tr><td class="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>Buffer is NULL or too small; *length contains the required size.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The buffer must be large enough to hold ctx-&gt;flux_data_header.entries * sizeof(FluxCaptureMeta) bytes. </dd>
<dd>
The returned metadata array is in the same order as the flux entries in the FluxDataBlock (on-disk order). </dd>
<dd>
This function only returns metadata; use <a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> to retrieve the actual flux data and index buffers. </dd>
<dd>
Flux entries are loaded on-demand (lazy loading) the first time this function or <a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> is called, avoiding unnecessary I/O during image opening.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> to retrieve actual flux data for a specific capture </dd>
<dd>
<a class="el" href="structFluxCaptureMeta.html" title="Metadata structure returned by aaruf_get_flux_captures().">FluxCaptureMeta</a> for the structure of each metadata entry </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00497">497</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="decls_8h_source.html#l00046">AARU_CALL</a>, <a class="el" href="decls_8h_source.html#l00055">AARU_EXPORT</a>, <a class="el" href="consts_8h_source.html#l00064">AARU_MAGIC</a>, <a class="el" href="errors_8h_source.html#l00049">AARUF_ERROR_BUFFER_TOO_SMALL</a>, <a class="el" href="errors_8h_source.html#l00071">AARUF_ERROR_FLUX_DATA_NOT_FOUND</a>, <a class="el" href="errors_8h_source.html#l00040">AARUF_ERROR_NOT_AARUFORMAT</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="flux_8h_source.html#l00187">FluxCaptureMeta::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00160">FluxEntry::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00189">FluxCaptureMeta::dataResolution</a>, <a class="el" href="flux_8h_source.html#l00162">FluxEntry::dataResolution</a>, <a class="el" href="flux_8c_source.html#l00415">ensure_flux_entries_loaded()</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="flux_8h_source.html#l00184">FluxCaptureMeta::head</a>, <a class="el" href="flux_8h_source.html#l00157">FluxEntry::head</a>, <a class="el" href="flux_8h_source.html#l00188">FluxCaptureMeta::indexResolution</a>, <a class="el" href="flux_8h_source.html#l00161">FluxEntry::indexResolution</a>, <a class="el" href="context_8h_source.html#l00177">aaruformat_context::magic</a>, <a class="el" href="flux_8h_source.html#l00186">FluxCaptureMeta::subtrack</a>, <a class="el" href="flux_8h_source.html#l00159">FluxEntry::subtrack</a>, <a class="el" href="log_8h_source.html#l00025">TRACE</a>, <a class="el" href="flux_8h_source.html#l00185">FluxCaptureMeta::track</a>, and <a class="el" href="flux_8h_source.html#l00158">FluxEntry::track</a>.</p>
</div>
</div>
<a id="a4592e2f67d77e1ee35d14cfca412add0" name="a4592e2f67d77e1ee35d14cfca412add0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4592e2f67d77e1ee35d14cfca412add0">&#9670;&#160;</a></span>aaruf_read_flux_capture()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t aaruf_read_flux_capture </td>
<td>(</td>
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>context</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>head</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t</td> <td class="paramname"><span class="paramname"><em>track</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t</td> <td class="paramname"><span class="paramname"><em>subtrack</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>capture_index</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *</td> <td class="paramname"><span class="paramname"><em>index_data</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *</td> <td class="paramname"><span class="paramname"><em>index_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *</td> <td class="paramname"><span class="paramname"><em>data_data</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *</td> <td class="paramname"><span class="paramname"><em>data_length</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Read a specific flux capture's data and index buffers from the image. </p>
<p>This function retrieves the actual flux data and index buffers for a specific flux capture identified by its head, track, subtrack, and capture_index. The function locates the corresponding <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a> in the flux_entries array (using the lookup map for efficiency), converts the payloadOffset (stored divided by block alignment) to an absolute file offset using blockAlignmentShift from <a class="el" href="structFluxHeader.html" title="Header structure for a FluxDataBlock containing flux capture metadata.">FluxHeader</a>, seeks to the DataStreamPayloadBlock at the specified offset, reads and decompresses the payload, validates CRC64 checksums, and extracts the data and index buffers.</p>
<p>The function supports both uncompressed and LZMA-compressed payload blocks. CRC64 validation is performed on both the compressed and uncompressed data.</p>
<p>The function can be called with NULL data buffers to determine the required buffer sizes. In this case, the required lengths are written to *data_length and *index_length, and AARUF_ERROR_BUFFER_TOO_SMALL is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>Pointer to an initialized aaruformat context opened for reading. Must not be NULL. </td></tr>
<tr><td class="paramname">head</td><td>Head number of the flux capture to retrieve. </td></tr>
<tr><td class="paramname">track</td><td>Track number of the flux capture to retrieve. </td></tr>
<tr><td class="paramname">subtrack</td><td>Subtrack number of the flux capture to retrieve. </td></tr>
<tr><td class="paramname">capture_index</td><td>Capture index of the flux capture to retrieve. </td></tr>
<tr><td class="paramname">index_data</td><td>Pointer to a buffer to receive the index buffer. May be NULL to query the required size. </td></tr>
<tr><td class="paramname">index_length</td><td>Pointer to the size of the index buffer (in bytes). On input, must contain the buffer size. On output, contains the required size (if buffer is too small) or the actual size written. Must not be NULL. </td></tr>
<tr><td class="paramname">data_data</td><td>Pointer to a buffer to receive the data buffer. May be NULL to query the required size. </td></tr>
<tr><td class="paramname">data_length</td><td>Pointer to the size of the data buffer (in bytes). On input, must contain the buffer size. On output, contains the required size (if buffer is too small) or the actual size written. Must not be NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure.</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">AARUF_STATUS_OK</td><td>Flux capture data successfully retrieved and written to buffers. </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>Invalid context, context magic mismatch, or invalid image stream. </td></tr>
<tr><td class="paramname">AARUF_ERROR_FLUX_DATA_NOT_FOUND</td><td>No flux captures in image or specified capture not found. </td></tr>
<tr><td class="paramname">AARUF_ERROR_BUFFER_TOO_SMALL</td><td>One or both buffers are NULL or too small; *data_length and *index_length contain required sizes. </td></tr>
<tr><td class="paramname">AARUF_ERROR_CANNOT_READ_BLOCK</td><td>Failed to seek to payload or read payload header. </td></tr>
<tr><td class="paramname">AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK</td><td>LZMA decompression failed or invalid compression format. </td></tr>
<tr><td class="paramname">AARUF_ERROR_INVALID_BLOCK_CRC</td><td>CRC64 checksum mismatch (compressed or uncompressed). </td></tr>
<tr><td class="paramname">AARUF_ERROR_INCORRECT_DATA_SIZE</td><td>Payload section length exceeds 32-bit limits. </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>Memory allocation failed for decompression buffers. </td></tr>
<tr><td class="paramname">AARUF_ERROR_UNSUPPORTED_COMPRESSION</td><td>Unsupported compression type in payload header.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The function first attempts to locate the flux entry using the lookup map (O(1) lookup). If the map is not available or the entry is not found, it falls back to a linear search through flux_entries (O(n)). </dd>
<dd>
The payload data is stored as [data_buffer][index_buffer] concatenated, with indexOffset indicating where the index buffer starts. </dd>
<dd>
Both buffers must be large enough to hold the respective data. The function validates buffer sizes before copying data. </dd>
<dd>
The caller is responsible for freeing the returned buffers if they were allocated by the caller. </dd>
<dd>
CRC64 validation is performed on both compressed and uncompressed data to ensure data integrity.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a5f50a859c1849d13a6f4d26d904fb458" title="Retrieve metadata for all flux captures in the image.">aaruf_get_flux_captures()</a> to retrieve metadata for all flux captures </dd>
<dd>
<a class="el" href="#ae11fa81212d9e363d8761e849859bab8" title="Add a flux capture to the image during write mode.">aaruf_write_flux_capture()</a> to add flux captures during write mode </dd>
<dd>
<a class="el" href="structDataStreamPayloadHeader.html" title="Header structure for a DataStreamPayloadBlock containing data stream payload.">DataStreamPayloadHeader</a> for the structure of payload blocks </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l01201">1201</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="decls_8h_source.html#l00046">AARU_CALL</a>, <a class="el" href="decls_8h_source.html#l00055">AARU_EXPORT</a>, <a class="el" href="consts_8h_source.html#l00064">AARU_MAGIC</a>, <a class="el" href="errors_8h_source.html#l00049">AARUF_ERROR_BUFFER_TOO_SMALL</a>, <a class="el" href="errors_8h_source.html#l00071">AARUF_ERROR_FLUX_DATA_NOT_FOUND</a>, <a class="el" href="errors_8h_source.html#l00040">AARUF_ERROR_NOT_AARUFORMAT</a>, <a class="el" href="errors_8h_source.html#l00047">AARUF_ERROR_UNSUPPORTED_COMPRESSION</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="flux_8h_source.html#l00120">FluxHeader::blockAlignmentShift</a>, <a class="el" href="flux_8h_source.html#l00160">FluxEntry::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00249">DataStreamPayloadHeader::cmpCrc64</a>, <a class="el" href="flux_8h_source.html#l00247">DataStreamPayloadHeader::cmpLength</a>, <a class="el" href="flux_8h_source.html#l00246">DataStreamPayloadHeader::compression</a>, <a class="el" href="flux_8h_source.html#l00250">DataStreamPayloadHeader::crc64</a>, <a class="el" href="flux_8c_source.html#l00415">ensure_flux_entries_loaded()</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="flux_8c_source.html#l01088">extract_flux_data_buffers()</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="flux_8c_source.html#l00833">find_flux_entry_by_key()</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="flux_8h_source.html#l00157">FluxEntry::head</a>, <a class="el" href="context_8h_source.html#l00179">aaruformat_context::imageStream</a>, <a class="el" href="flux_8h_source.html#l00248">DataStreamPayloadHeader::length</a>, <a class="el" href="enums_8h_source.html#l00034">Lzma</a>, <a class="el" href="context_8h_source.html#l00177">aaruformat_context::magic</a>, <a class="el" href="enums_8h_source.html#l00033">None</a>, <a class="el" href="flux_8h_source.html#l00164">FluxEntry::payloadOffset</a>, <a class="el" href="flux_8c_source.html#l00865">read_flux_payload_header()</a>, <a class="el" href="flux_8c_source.html#l00971">read_lzma_compressed_payload()</a>, <a class="el" href="flux_8c_source.html#l00921">read_uncompressed_payload()</a>, <a class="el" href="flux_8h_source.html#l00159">FluxEntry::subtrack</a>, <a class="el" href="log_8h_source.html#l00025">TRACE</a>, <a class="el" href="flux_8h_source.html#l00158">FluxEntry::track</a>, and <a class="el" href="flux_8c_source.html#l01048">validate_flux_payload_crcs()</a>.</p>
</div>
</div>
<a id="ae11fa81212d9e363d8761e849859bab8" name="ae11fa81212d9e363d8761e849859bab8"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae11fa81212d9e363d8761e849859bab8">&#9670;&#160;</a></span>aaruf_write_flux_capture()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t aaruf_write_flux_capture </td>
<td>(</td>
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>context</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>head</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint16_t</td> <td class="paramname"><span class="paramname"><em>track</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t</td> <td class="paramname"><span class="paramname"><em>subtrack</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>capture_index</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t</td> <td class="paramname"><span class="paramname"><em>data_resolution</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t</td> <td class="paramname"><span class="paramname"><em>index_resolution</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *</td> <td class="paramname"><span class="paramname"><em>data</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>data_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *</td> <td class="paramname"><span class="paramname"><em>index</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>index_length</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Add a flux capture to the image during write mode. </p>
<p>This function adds a new flux capture to the image being written. The capture includes both data and index buffers, along with metadata specifying the head, track, subtrack, capture index, and resolution information for both streams.</p>
<p>The function copies the provided data and index buffers into internal storage (utarray) and creates a corresponding <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a> in the flux_entries array. The actual payload data is written to the image later during image finalization (in <a class="el" href="close_8c.html#af80e68ad63df21d7eb0ff9c7212302a1" title="Serialize all accumulated flux capture blocks to the image file.">write_flux_blocks()</a> and <a class="el" href="close_8c.html#a10d7168f66ee3b1e78d17022f37f63a9" title="Serialize a single flux capture payload block to the image file.">write_flux_capture_payload()</a>).</p>
<p>The flux capture lookup map is updated to enable efficient retrieval of the capture by its identifier tuple.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">context</td><td>Pointer to an initialized aaruformat context opened for writing. Must not be NULL. </td></tr>
<tr><td class="paramname">head</td><td>Head number the flux capture corresponds to. </td></tr>
<tr><td class="paramname">track</td><td>Track number the flux capture corresponds to. </td></tr>
<tr><td class="paramname">subtrack</td><td>Subtrack number the flux capture corresponds to. </td></tr>
<tr><td class="paramname">capture_index</td><td>Capture index, allowing multiple captures for the same location. </td></tr>
<tr><td class="paramname">data_resolution</td><td>Resolution in picoseconds for the data stream. </td></tr>
<tr><td class="paramname">index_resolution</td><td>Resolution in picoseconds for the index stream. </td></tr>
<tr><td class="paramname">data</td><td>Pointer to the flux data buffer. May be NULL if data_length is 0. </td></tr>
<tr><td class="paramname">data_length</td><td>Length of the data buffer in bytes. </td></tr>
<tr><td class="paramname">index</td><td>Pointer to the flux index buffer. May be NULL if index_length is 0. </td></tr>
<tr><td class="paramname">index_length</td><td>Length of the index buffer in bytes.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure.</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">AARUF_STATUS_OK</td><td>Flux capture successfully added to the context. </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_AARUFORMAT</td><td>Invalid context or context magic mismatch. </td></tr>
<tr><td class="paramname">AARUF_READ_ONLY</td><td>Context is not in write mode. </td></tr>
<tr><td class="paramname">AARUF_ERROR_INCORRECT_DATA_SIZE</td><td>Invalid buffer pointers or combined size exceeds UINT32_MAX. </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>Memory allocation failed for buffers or map entry.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>The function copies the data and index buffers; the caller retains ownership of the original buffers and may free them after this call. </dd>
<dd>
The combined size of data_length + index_length must not exceed UINT32_MAX. </dd>
<dd>
The maximum number of flux captures is limited to UINT16_MAX (65535). </dd>
<dd>
The payloadOffset field in the <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a> is set to 0 initially and is populated later when the payload block is written during image finalization. </dd>
<dd>
If adding the capture to the lookup map fails, the function performs cleanup and restores the previous state.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> to read flux captures from an image </dd>
<dd>
<a class="el" href="#a430617e60dee0b72e0ae5635c69f9a6c" title="Clear all flux captures from the context.">aaruf_clear_flux_captures()</a> to remove all flux captures </dd>
<dd>
<a class="el" href="close_8c.html#af80e68ad63df21d7eb0ff9c7212302a1" title="Serialize all accumulated flux capture blocks to the image file.">write_flux_blocks()</a> for when payload blocks are written </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00616">616</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="decls_8h_source.html#l00046">AARU_CALL</a>, <a class="el" href="decls_8h_source.html#l00055">AARU_EXPORT</a>, <a class="el" href="consts_8h_source.html#l00064">AARU_MAGIC</a>, <a class="el" href="crc64_8c_source.html#l00160">aaruf_crc64_data()</a>, <a class="el" href="errors_8h_source.html#l00065">AARUF_ERROR_INCORRECT_DATA_SIZE</a>, <a class="el" href="errors_8h_source.html#l00040">AARUF_ERROR_NOT_AARUFORMAT</a>, <a class="el" href="errors_8h_source.html#l00048">AARUF_ERROR_NOT_ENOUGH_MEMORY</a>, <a class="el" href="errors_8h_source.html#l00061">AARUF_READ_ONLY</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="flux_8h_source.html#l00160">FluxEntry::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00121">FluxHeader::crc64</a>, <a class="el" href="flux_8h_source.html#l00273">FluxCaptureRecord::data_buffer</a>, <a class="el" href="flux_8h_source.html#l00274">FluxCaptureRecord::data_length</a>, <a class="el" href="flux_8h_source.html#l00162">FluxEntry::dataResolution</a>, <a class="el" href="context_8h_source.html#l00339">aaruformat_context::dirty_flux_block</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="flux_8h_source.html#l00272">FluxCaptureRecord::entry</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="flux_8c_source.html#l00065">FLUX_CAPTURE_RECORD_ICD</a>, <a class="el" href="context_8h_source.html#l00313">aaruformat_context::flux_captures</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="flux_8c_source.html#l00122">flux_map_add()</a>, <a class="el" href="enums_8h_source.html#l00164">FluxDataBlock</a>, <a class="el" href="flux_8h_source.html#l00157">FluxEntry::head</a>, <a class="el" href="flux_8h_source.html#l00118">FluxHeader::identifier</a>, <a class="el" href="flux_8h_source.html#l00275">FluxCaptureRecord::index_buffer</a>, <a class="el" href="flux_8h_source.html#l00276">FluxCaptureRecord::index_length</a>, <a class="el" href="flux_8h_source.html#l00163">FluxEntry::indexOffset</a>, <a class="el" href="flux_8h_source.html#l00161">FluxEntry::indexResolution</a>, <a class="el" href="context_8h_source.html#l00295">aaruformat_context::is_writing</a>, <a class="el" href="context_8h_source.html#l00177">aaruformat_context::magic</a>, <a class="el" href="flux_8h_source.html#l00164">FluxEntry::payloadOffset</a>, <a class="el" href="flux_8h_source.html#l00159">FluxEntry::subtrack</a>, <a class="el" href="log_8h_source.html#l00025">TRACE</a>, and <a class="el" href="flux_8h_source.html#l00158">FluxEntry::track</a>.</p>
</div>
</div>
<a id="a91c222a3e35c47e7a2a13a864d85bc03" name="a91c222a3e35c47e7a2a13a864d85bc03"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a91c222a3e35c47e7a2a13a864d85bc03">&#9670;&#160;</a></span>ensure_flux_entries_loaded()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int32_t ensure_flux_entries_loaded </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Lazy load flux data block if not already loaded. </p>
<p>This helper function checks if flux entries are loaded, and if not, finds the FluxDataBlock in the index and loads it. This enables lazy loading of flux entries only when they are actually needed.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context. Must not be NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK if flux entries are loaded (or no flux data exists), or an error code on failure. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00415">415</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="errors_8h_source.html#l00071">AARUF_ERROR_FLUX_DATA_NOT_FOUND</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="index_8h_source.html#l00110">IndexEntry::blockType</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="enums_8h_source.html#l00164">FluxDataBlock</a>, <a class="el" href="context_8h_source.html#l00255">aaruformat_context::index_entries</a>, and <a class="el" href="flux_8c_source.html#l00307">process_flux_data_block()</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l00497">aaruf_get_flux_captures()</a>, and <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a id="a2e3b7343a847fe5dac1d25bdf7f82b26" name="a2e3b7343a847fe5dac1d25bdf7f82b26"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2e3b7343a847fe5dac1d25bdf7f82b26">&#9670;&#160;</a></span>extract_flux_data_buffers()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int32_t extract_flux_data_buffers </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structFluxEntry.html">FluxEntry</a> *</td> <td class="paramname"><span class="paramname"><em>flux_entry</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *</td> <td class="paramname"><span class="paramname"><em>payload</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>raw_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *</td> <td class="paramname"><span class="paramname"><em>data_data</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *</td> <td class="paramname"><span class="paramname"><em>data_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t *</td> <td class="paramname"><span class="paramname"><em>index_data</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t *</td> <td class="paramname"><span class="paramname"><em>index_length</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Extract data and index buffers from decompressed payload and copy to output buffers. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">flux_entry</td><td>Pointer to the flux entry containing index offset information. Must not be NULL. </td></tr>
<tr><td class="paramname">payload</td><td>Pointer to the decompressed payload buffer. Can be NULL if raw_length is 0. </td></tr>
<tr><td class="paramname">raw_length</td><td>Length of the decompressed payload. </td></tr>
<tr><td class="paramname">data_data</td><td>Output buffer for data portion. Can be NULL for size query. </td></tr>
<tr><td class="paramname">data_length</td><td>Input/output parameter for data buffer size/required size. Must not be NULL. </td></tr>
<tr><td class="paramname">index_data</td><td>Output buffer for index portion. Can be NULL for size query. </td></tr>
<tr><td class="paramname">index_length</td><td>Input/output parameter for index buffer size/required size. Must not be NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l01088">1088</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="errors_8h_source.html#l00049">AARUF_ERROR_BUFFER_TOO_SMALL</a>, <a class="el" href="errors_8h_source.html#l00065">AARUF_ERROR_INCORRECT_DATA_SIZE</a>, <a class="el" href="errors_8h_source.html#l00057">AARUF_ERROR_INVALID_BLOCK_CRC</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="flux_8h_source.html#l00163">FluxEntry::indexOffset</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a id="a11995aba3f4efbc10d6b41a628c08e5d" name="a11995aba3f4efbc10d6b41a628c08e5d"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a11995aba3f4efbc10d6b41a628c08e5d">&#9670;&#160;</a></span>find_flux_entry_by_key()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const <a class="el" href="structFluxEntry.html">FluxEntry</a> * find_flux_entry_by_key </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structFluxCaptureKey.html">FluxCaptureKey</a> *</td> <td class="paramname"><span class="paramname"><em>key</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Find a flux entry by its identifier key. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context containing flux data. Must not be NULL. </td></tr>
<tr><td class="paramname">key</td><td>Pointer to the <a class="el" href="structFluxCaptureKey.html" title="Key structure for flux capture lookup map.">FluxCaptureKey</a> identifying the flux capture. Must not be NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Pointer to the matching <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a>, or NULL if not found. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00833">833</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="flux_8h_source.html#l00301">FluxCaptureKey::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00160">FluxEntry::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="context_8h_source.html#l00314">aaruformat_context::flux_map</a>, <a class="el" href="flux_8h_source.html#l00298">FluxCaptureKey::head</a>, <a class="el" href="flux_8h_source.html#l00157">FluxEntry::head</a>, <a class="el" href="flux_8c_source.html#l00036">FluxCaptureMapEntry::index</a>, <a class="el" href="flux_8h_source.html#l00300">FluxCaptureKey::subtrack</a>, <a class="el" href="flux_8h_source.html#l00159">FluxEntry::subtrack</a>, <a class="el" href="flux_8h_source.html#l00299">FluxCaptureKey::track</a>, and <a class="el" href="flux_8h_source.html#l00158">FluxEntry::track</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a id="a548a8cb21d02fded8a5084c96bbf5e30" name="a548a8cb21d02fded8a5084c96bbf5e30"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a548a8cb21d02fded8a5084c96bbf5e30">&#9670;&#160;</a></span>flux_capture_record_dtor()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void flux_capture_record_dtor </td>
<td>(</td>
<td class="paramtype">void *</td> <td class="paramname"><span class="paramname"><em>element</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Destructor callback for <a class="el" href="structFluxCaptureRecord.html" title="Internal structure for storing flux capture data during write mode.">FluxCaptureRecord</a> elements in a utarray. </p>
<p>This function is used by the utarray library to clean up dynamically allocated memory when a <a class="el" href="structFluxCaptureRecord.html" title="Internal structure for storing flux capture data during write mode.">FluxCaptureRecord</a> is removed from or when the array is freed. It safely frees both the data_buffer and index_buffer fields if they are non-NULL, and then nullifies the pointers to prevent double-free errors.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">element</td><td>Pointer to the <a class="el" href="structFluxCaptureRecord.html" title="Internal structure for storing flux capture data during write mode.">FluxCaptureRecord</a> element to destroy. May be NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This function is registered with utarray via FLUX_CAPTURE_RECORD_ICD and is called automatically by utarray_free() and utarray_erase() operations. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00054">54</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="flux_8h_source.html#l00273">FluxCaptureRecord::data_buffer</a>, and <a class="el" href="flux_8h_source.html#l00275">FluxCaptureRecord::index_buffer</a>.</p>
</div>
</div>
<a id="a3fd05dad98e7dedb15e256070bd73a88" name="a3fd05dad98e7dedb15e256070bd73a88"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3fd05dad98e7dedb15e256070bd73a88">&#9670;&#160;</a></span>flux_map_add()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int flux_map_add </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structFluxCaptureKey.html">FluxCaptureKey</a> *</td> <td class="paramname"><span class="paramname"><em>key</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint32_t</td> <td class="paramname"><span class="paramname"><em>index</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Add or update a flux capture entry in the lookup map. </p>
<p>This function adds a new entry to the UTHASH-based flux capture lookup map, or updates an existing entry if a matching key is already present. The map enables O(1) lookup of flux captures by their (head, track, subtrack, captureIndex) identifier tuple.</p>
<p>If an entry with the same key already exists, its index is updated to the new value. If no entry exists, a new <a class="el" href="structFluxCaptureMapEntry.html" title="Internal hash table entry for flux capture lookup.">FluxCaptureMapEntry</a> is allocated and added to the map.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context containing the flux_map. Must not be NULL. </td></tr>
<tr><td class="paramname">key</td><td>Pointer to the <a class="el" href="structFluxCaptureKey.html" title="Key structure for flux capture lookup map.">FluxCaptureKey</a> identifying the flux capture (head, track, subtrack, captureIndex). Must not be NULL. </td></tr>
<tr><td class="paramname">index</td><td>The array index in ctx-&gt;flux_entries that corresponds to this flux capture.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success, -1 on memory allocation failure.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>On allocation failure, the function returns -1 and the map remains unchanged. </dd>
<dd>
This function is used internally during map rebuilding and when adding new flux captures in write mode. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00122">122</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="context_8h_source.html#l00314">aaruformat_context::flux_map</a>, <a class="el" href="flux_8c_source.html#l00036">FluxCaptureMapEntry::index</a>, and <a class="el" href="flux_8c_source.html#l00035">FluxCaptureMapEntry::key</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l00616">aaruf_write_flux_capture()</a>, and <a class="el" href="flux_8c_source.html#l00171">flux_map_rebuild_from_entries()</a>.</p>
</div>
</div>
<a id="a608a4570f8f6e4a8b7d97dd2fdaf8050" name="a608a4570f8f6e4a8b7d97dd2fdaf8050"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a608a4570f8f6e4a8b7d97dd2fdaf8050">&#9670;&#160;</a></span>flux_map_clear()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">void flux_map_clear </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Clear and deallocate the flux capture lookup map. </p>
<p>This function iterates through all entries in the UTHASH-based flux capture lookup map, removes each entry from the hash table, frees its memory, and sets the map pointer to NULL. This is used during cleanup operations and when rebuilding the map from scratch.</p>
<p>The function is safe to call even if the map is already NULL or empty.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context containing the flux_map to clear. Must not be NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This function does not free the flux_entries array or flux_captures utarray; it only clears the hash table used for O(1) lookup of flux captures. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00084">84</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="context_8h_source.html#l00314">aaruformat_context::flux_map</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l00790">aaruf_clear_flux_captures()</a>, <a class="el" href="flux_8c_source.html#l00171">flux_map_rebuild_from_entries()</a>, and <a class="el" href="flux_8c_source.html#l00307">process_flux_data_block()</a>.</p>
</div>
</div>
<a id="ae840a46bdea143ad49be3ba037376320" name="ae840a46bdea143ad49be3ba037376320"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae840a46bdea143ad49be3ba037376320">&#9670;&#160;</a></span>flux_map_rebuild_from_entries()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int32_t flux_map_rebuild_from_entries </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Rebuild the flux capture lookup map from the flux_entries array. </p>
<p>This function clears any existing flux capture lookup map and rebuilds it from the ctx-&gt;flux_entries array. The map provides O(1) lookup of flux captures by their (head, track, subtrack, captureIndex) identifier tuple, which is used by <a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> and other flux access functions.</p>
<p>The function iterates through all entries in ctx-&gt;flux_entries and adds each one to the hash table, mapping its identifier to its array index. If any entry fails to be added (due to memory allocation failure), the entire map is cleared and an error is returned.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context containing flux_entries and flux_map. Must not be NULL.</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or AARUF_ERROR_NOT_ENOUGH_MEMORY if memory allocation fails during map construction.</dd></dl>
<dl class="retval"><dt>Return values</dt><dd>
<table class="retval">
<tr><td class="paramname">AARUF_STATUS_OK</td><td>The map was successfully rebuilt (or no entries to process). </td></tr>
<tr><td class="paramname">AARUF_ERROR_NOT_ENOUGH_MEMORY</td><td>Memory allocation failed; the map is cleared.</td></tr>
</table>
</dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>If ctx-&gt;flux_entries is NULL or ctx-&gt;flux_data_header.entries is 0, the function clears the map and returns AARUF_STATUS_OK (no-op). </dd>
<dd>
On failure, the map is cleared to ensure a consistent state. </dd>
<dd>
This function is called automatically by <a class="el" href="#aac6f1ed284f46388319d99bff2a1f409" title="Parse and integrate a Flux Data block from the image stream into the context.">process_flux_data_block()</a> after successfully reading flux entries from the image.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#a608a4570f8f6e4a8b7d97dd2fdaf8050" title="Clear and deallocate the flux capture lookup map.">flux_map_clear()</a> for clearing the map </dd>
<dd>
<a class="el" href="#a3fd05dad98e7dedb15e256070bd73a88" title="Add or update a flux capture entry in the lookup map.">flux_map_add()</a> for adding individual entries </dd>
<dd>
<a class="el" href="#aac6f1ed284f46388319d99bff2a1f409" title="Parse and integrate a Flux Data block from the image stream into the context.">process_flux_data_block()</a> for when this is called during image opening </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00171">171</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="errors_8h_source.html#l00048">AARUF_ERROR_NOT_ENOUGH_MEMORY</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="flux_8h_source.html#l00160">FluxEntry::captureIndex</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="flux_8c_source.html#l00122">flux_map_add()</a>, <a class="el" href="flux_8c_source.html#l00084">flux_map_clear()</a>, <a class="el" href="flux_8h_source.html#l00157">FluxEntry::head</a>, <a class="el" href="flux_8h_source.html#l00159">FluxEntry::subtrack</a>, and <a class="el" href="flux_8h_source.html#l00158">FluxEntry::track</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l00307">process_flux_data_block()</a>, and <a class="el" href="close_8c_source.html#l04754">write_flux_blocks()</a>.</p>
</div>
</div>
<a id="aac6f1ed284f46388319d99bff2a1f409" name="aac6f1ed284f46388319d99bff2a1f409"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac6f1ed284f46388319d99bff2a1f409">&#9670;&#160;</a></span>process_flux_data_block()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void process_flux_data_block </td>
<td>(</td>
<td class="paramtype"><a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structIndexEntry.html">IndexEntry</a> *</td> <td class="paramname"><span class="paramname"><em>entry</em></span>&#160;)</td>
</tr>
</table>
</div><div class="memdoc">
<p>Parse and integrate a Flux Data block from the image stream into the context. </p>
<p>This function seeks to the byte offset specified by the supplied <code class="param">entry</code>, reads a <a class="el" href="structFluxHeader.html" title="Header structure for a FluxDataBlock containing flux capture metadata.">FluxHeader</a> followed by the declared number of <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a> records, validates the block through its CRC64, rebuilds the flux capture lookup map, and populates multiple fields in the provided <code class="param">ctx:</code> </p>
<ul>
<li>ctx-&gt;flux_data_header (identifier, entries, crc64)</li>
<li>ctx-&gt;flux_entries (raw array with ALL flux entries in on-disk order)</li>
<li>ctx-&gt;flux_capture_map (hash table mapping (head, track, subtrack, captureIndex) to entry indices)</li>
<li>ctx-&gt;imageInfo.ImageSize (incremented by sizeof(FluxEntry) * entries)</li>
</ul>
<p>Before reading new data, the function performs cleanup of any existing flux-related state:</p><ul>
<li>Frees and clears ctx-&gt;flux_captures if it exists (write-mode remnants)</li>
<li>Frees and clears ctx-&gt;flux_entries if it exists (from previous calls or partial reads)</li>
<li>Clears ctx-&gt;flux_capture_map (via <a class="el" href="#a608a4570f8f6e4a8b7d97dd2fdaf8050" title="Clear and deallocate the flux capture lookup map.">flux_map_clear()</a>)</li>
<li>Zeros ctx-&gt;flux_data_header</li>
</ul>
<p>After successfully reading and validating the flux entries, the function rebuilds the in-memory flux capture lookup map by calling <a class="el" href="#ae840a46bdea143ad49be3ba037376320" title="Rebuild the flux capture lookup map from the flux_entries array.">flux_map_rebuild_from_entries()</a>. This map enables O(1) lookup of flux captures by their identifiers (head, track, subtrack, captureIndex), which is used by <a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> and other flux access functions.</p>
<p>The function is intended for internal library use and is NOT part of the stable public API (no versioning guarantees). It is called on-demand (lazy loading) when flux data is first accessed, rather than during image opening, to avoid unnecessary I/O if flux data is never used.</p>
<p><b>Processing Flow:</b></p><ol type="1">
<li><b>Validation:</b> Check ctx and ctx-&gt;imageStream are valid</li>
<li><b>Cleanup:</b> Free existing flux_captures, flux_entries, and clear flux_capture_map</li>
<li><b>Seek:</b> Seek to entry-&gt;offset in the image stream</li>
<li><b>Read Header:</b> Read <a class="el" href="structFluxHeader.html" title="Header structure for a FluxDataBlock containing flux capture metadata.">FluxHeader</a> structure</li>
<li><b>Validate Identifier:</b> Verify identifier == FluxDataBlock</li>
<li><b>Allocate Entries:</b> Allocate memory for flux_entries array</li>
<li><b>Read Entries:</b> Read all <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a> structures from the stream</li>
<li><b>Validate CRC64:</b> Compute and verify CRC64 checksum over entries</li>
<li><b>Rebuild Map:</b> Call <a class="el" href="#ae840a46bdea143ad49be3ba037376320" title="Rebuild the flux capture lookup map from the flux_entries array.">flux_map_rebuild_from_entries()</a> to build lookup map</li>
<li><b>Update ImageSize:</b> Increment ctx-&gt;image_info.ImageSize</li>
</ol>
<p><b>Error &amp; early-return behavior (no exception mechanism, all via logging + early return):</b></p><ul>
<li>NULL <code class="param">ctx</code> or NULL ctx-&gt;imageStream: Logs FATAL and returns immediately; context left untouched.</li>
<li>Seek failure: FATAL + return; context left untouched (cleanup already performed).</li>
<li><a class="el" href="structFluxHeader.html" title="Header structure for a FluxDataBlock containing flux capture metadata.">FluxHeader</a> read short: flux_data_header zeroed, TRACE logged, return.</li>
<li>Identifier mismatch: flux_data_header zeroed, TRACE logged, return.</li>
<li>Allocation failure for flux_entries: flux_data_header zeroed, FATAL logged, return.</li>
<li>Short read of <a class="el" href="structFluxEntry.html" title="Metadata entry describing a single flux capture in the FluxDataBlock.">FluxEntry</a> array: flux_data_header zeroed, allocated flux_entries freed, FATAL logged, return.</li>
<li>CRC mismatch: TRACE logged and return; (NOTE: at this point flux_entries remain allocated and flux_data_header retains the just-read values, but the lookup map is not built, so entries are not accessible via lookup functions. Caller may wish to discard them or trigger re-read.)</li>
<li>Map rebuild failure: flux_entries freed, flux_data_header zeroed, FATAL logged, return.</li>
</ul>
<p><b>Memory management:</b></p><ul>
<li>Frees any pre-existing ctx-&gt;flux_captures (utarray) before processing</li>
<li>Frees any pre-existing ctx-&gt;flux_entries before allocating new ones</li>
<li>Allocates ctx-&gt;flux_entries with malloc() sized to entries * sizeof(FluxEntry)</li>
<li>On certain failure paths (short reads, map rebuild failure) allocated memory is freed</li>
<li>On CRC mismatch, allocated memory is kept but map is not built (entries not accessible via lookup)</li>
<li>The function is idempotent in terms of memory: it cleans up before processing, so repeated calls will not leak memory. However, the function is expected to be called exactly once per context lifetime during image opening.</li>
</ul>
<p><b>Flux Capture Lookup Map:</b> After successfully reading and validating flux entries, the function rebuilds the in-memory hash table (ctx-&gt;flux_capture_map) that maps flux capture identifiers to array indices. This enables efficient lookup of flux captures by their (head, track, subtrack, captureIndex) tuple. The map is built using UTHASH and is used by <a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> and other flux access functions. If map rebuild fails, the function cleans up all allocated resources and returns.</p>
<p><b>Thread safety:</b></p><ul>
<li>Not thread-safe: mutates shared state in <code class="param">ctx</code> without synchronization.</li>
<li>Must not be called concurrently with readers/writers referencing the same context.</li>
</ul>
<p><b>Preconditions (</p><dl class="section pre"><dt>Precondition</dt><dd>):<ul>
<li><code class="param">ctx</code> != NULL</li>
<li><code class="param">ctx-&gt;imageStream</code> is a valid FILE* opened for reading at least up to the block region.</li>
<li><code class="param">entry</code> != NULL and entry-&gt;offset points to the start of a well-formed Flux Data block.</li>
</ul>
</dd></dl>
<p><b>Postconditions (</p><dl class="section post"><dt>Postcondition</dt><dd>) on success (CRC valid and map rebuilt):<ul>
<li>ctx-&gt;flux_data_header.identifier == FluxDataBlock</li>
<li>ctx-&gt;flux_data_header.entries &gt; 0 implies ctx-&gt;flux_entries != NULL</li>
<li>ctx-&gt;flux_capture_map is populated with entries mapping identifiers to indices</li>
<li>ctx-&gt;imageInfo.ImageSize incremented by flux data size</li>
<li>ctx-&gt;flux_captures == NULL (cleared if it existed)</li>
</ul>
</dd></dl>
<p><b>Limitations / Caveats:</b></p><ul>
<li>No explicit status code: callers infer success by inspecting ctx-&gt;flux_data_header.entries and presence of ctx-&gt;flux_entries after invocation.</li>
<li>In case of CRC mismatch, flux_entries are retained but flux_capture_map is not built, so entries are not accessible via lookup functions. Caller may wish to discard them or trigger re-read.</li>
<li>The function is idempotent in terms of memory (cleans up before processing), but is expected to be called exactly once per context lifetime during image opening.</li>
</ul>
<p></b></b></p>
<p><b><b><b>Logging strategy:</b></p><ul>
<li>FATAL used for unrecoverable structural or resource errors (seek failure, allocation failure, map rebuild failure).</li>
<li>TRACE used for informational / soft failures (e.g., CRC mismatch, identifier mismatch, short read).</li>
</ul>
<p></b></b></p>
<p><b><b></p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Mutable pointer to an aaruformatContext receiving parsed flux metadata. </td></tr>
<tr><td class="paramname">entry</td><td>Pointer to the index entry describing this Flux Data block (offset required; size not strictly used beyond informational logging and sequential reading).</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>void This function does not return a status code; errors are reported via logging side effects.</dd></dl>
<dl class="section warning"><dt>Warning</dt><dd>Absence of a returned status requires defensive post-call validation by the caller. </dd>
<dd>
CRC mismatch leaves possibly invalid data in ctx-&gt;flux_entries, and the lookup map is not built, making entries inaccessible via lookup functions. </dd>
<dd>
Map rebuild failure results in complete cleanup of flux-related state, leaving the context without flux data even if the entries were successfully read and validated.</dd></dl>
<dl class="section see"><dt>See also</dt><dd><a class="el" href="#ae840a46bdea143ad49be3ba037376320" title="Rebuild the flux capture lookup map from the flux_entries array.">flux_map_rebuild_from_entries()</a> for the map rebuilding logic </dd>
<dd>
<a class="el" href="#a608a4570f8f6e4a8b7d97dd2fdaf8050" title="Clear and deallocate the flux capture lookup map.">flux_map_clear()</a> for the map clearing logic </dd>
<dd>
<a class="el" href="#a4592e2f67d77e1ee35d14cfca412add0" title="Read a specific flux capture&#39;s data and index buffers from the image.">aaruf_read_flux_capture()</a> for using the lookup map to access flux captures </dd></dl>
<p></b></b></p>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00307">307</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="crc64_8c_source.html#l00160">aaruf_crc64_data()</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="flux_8h_source.html#l00121">FluxHeader::crc64</a>, <a class="el" href="flux_8h_source.html#l00119">FluxHeader::entries</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="context_8h_source.html#l00313">aaruformat_context::flux_captures</a>, <a class="el" href="context_8h_source.html#l00311">aaruformat_context::flux_data_header</a>, <a class="el" href="context_8h_source.html#l00312">aaruformat_context::flux_entries</a>, <a class="el" href="flux_8c_source.html#l00084">flux_map_clear()</a>, <a class="el" href="flux_8c_source.html#l00171">flux_map_rebuild_from_entries()</a>, <a class="el" href="enums_8h_source.html#l00164">FluxDataBlock</a>, <a class="el" href="flux_8h_source.html#l00118">FluxHeader::identifier</a>, <a class="el" href="context_8h_source.html#l00263">aaruformat_context::image_info</a>, <a class="el" href="aaru_8h_source.html#l00935">ImageInfo::ImageSize</a>, <a class="el" href="context_8h_source.html#l00179">aaruformat_context::imageStream</a>, <a class="el" href="index_8h_source.html#l00112">IndexEntry::offset</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l00415">ensure_flux_entries_loaded()</a>.</p>
</div>
</div>
<a id="ac9145d7789804958ea126d136a45231b" name="ac9145d7789804958ea126d136a45231b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac9145d7789804958ea126d136a45231b">&#9670;&#160;</a></span>read_flux_payload_header()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int32_t read_flux_payload_header </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t</td> <td class="paramname"><span class="paramname"><em>payload_offset</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="structDataStreamPayloadHeader.html">DataStreamPayloadHeader</a> *</td> <td class="paramname"><span class="paramname"><em>header</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Read and validate a flux payload block header from the image stream. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context. Must not be NULL. </td></tr>
<tr><td class="paramname">payload_offset</td><td>File offset where the payload block starts. </td></tr>
<tr><td class="paramname">header</td><td>Output parameter for the read header. Must not be NULL. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00865">865</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="errors_8h_source.html#l00046">AARUF_ERROR_CANNOT_READ_BLOCK</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="enums_8h_source.html#l00165">DataStreamPayloadBlock</a>, <a class="el" href="flux_8h_source.html#l00245">DataStreamPayloadHeader::dataType</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="enums_8h_source.html#l00134">FluxData</a>, <a class="el" href="flux_8h_source.html#l00244">DataStreamPayloadHeader::identifier</a>, <a class="el" href="context_8h_source.html#l00179">aaruformat_context::imageStream</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a id="a8b2e6d3cc3b80a282d15c2a737eb427c" name="a8b2e6d3cc3b80a282d15c2a737eb427c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8b2e6d3cc3b80a282d15c2a737eb427c">&#9670;&#160;</a></span>read_lzma_compressed_payload()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int32_t read_lzma_compressed_payload </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>cmp_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>raw_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t **</td> <td class="paramname"><span class="paramname"><em>cmp_buffer</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t **</td> <td class="paramname"><span class="paramname"><em>payload</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Read and decompress an LZMA-compressed flux payload from the image stream. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context. Must not be NULL. </td></tr>
<tr><td class="paramname">cmp_length</td><td>Compressed length including LZMA properties. </td></tr>
<tr><td class="paramname">raw_length</td><td>Expected uncompressed length. </td></tr>
<tr><td class="paramname">cmp_buffer</td><td>Output parameter for compressed buffer pointer (caller must free). Can be NULL if allocation fails. </td></tr>
<tr><td class="paramname">payload</td><td>Output parameter for decompressed payload buffer pointer (caller must free). Can be NULL if allocation fails. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00971">971</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="errors_8h_source.html#l00056">AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK</a>, <a class="el" href="errors_8h_source.html#l00046">AARUF_ERROR_CANNOT_READ_BLOCK</a>, <a class="el" href="errors_8h_source.html#l00048">AARUF_ERROR_NOT_ENOUGH_MEMORY</a>, <a class="el" href="lzma_8c_source.html#l00039">aaruf_lzma_decode_buffer()</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="context_8h_source.html#l00179">aaruformat_context::imageStream</a>, <a class="el" href="consts_8h_source.html#l00082">LZMA_PROPERTIES_LENGTH</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a id="a99b0c18957e1cb755c1c5e967bb9b97b" name="a99b0c18957e1cb755c1c5e967bb9b97b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a99b0c18957e1cb755c1c5e967bb9b97b">&#9670;&#160;</a></span>read_uncompressed_payload()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int32_t read_uncompressed_payload </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="structaaruformat__context.html">aaruformat_context</a> *</td> <td class="paramname"><span class="paramname"><em>ctx</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>cmp_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>raw_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t **</td> <td class="paramname"><span class="paramname"><em>cmp_buffer</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint8_t **</td> <td class="paramname"><span class="paramname"><em>payload</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Read an uncompressed flux payload from the image stream. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ctx</td><td>Pointer to the aaruformat context. Must not be NULL. </td></tr>
<tr><td class="paramname">cmp_length</td><td>Compressed length (should equal raw_length for uncompressed). </td></tr>
<tr><td class="paramname">raw_length</td><td>Uncompressed length. </td></tr>
<tr><td class="paramname">cmp_buffer</td><td>Output parameter for compressed buffer pointer (caller must free). Can be NULL if allocation fails. </td></tr>
<tr><td class="paramname">payload</td><td>Output parameter for payload buffer pointer (same as cmp_buffer for uncompressed). </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or an error code on failure. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00921">921</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="errors_8h_source.html#l00056">AARUF_ERROR_CANNOT_DECOMPRESS_BLOCK</a>, <a class="el" href="errors_8h_source.html#l00046">AARUF_ERROR_CANNOT_READ_BLOCK</a>, <a class="el" href="errors_8h_source.html#l00048">AARUF_ERROR_NOT_ENOUGH_MEMORY</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, <a class="el" href="context_8h_source.html#l00179">aaruformat_context::imageStream</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a id="a0c36f4d6d0d0cec73810133a28c0eb6f" name="a0c36f4d6d0d0cec73810133a28c0eb6f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0c36f4d6d0d0cec73810133a28c0eb6f">&#9670;&#160;</a></span>validate_flux_payload_crcs()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">int32_t validate_flux_payload_crcs </td>
<td>(</td>
<td class="paramtype">const uint8_t *</td> <td class="paramname"><span class="paramname"><em>cmp_buffer</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>cmp_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t *</td> <td class="paramname"><span class="paramname"><em>payload</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t</td> <td class="paramname"><span class="paramname"><em>raw_length</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t</td> <td class="paramname"><span class="paramname"><em>expected_cmp_crc</em></span>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">uint64_t</td> <td class="paramname"><span class="paramname"><em>expected_raw_crc</em></span>&#160;)</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Validate CRC64 checksums for a flux payload block. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">cmp_buffer</td><td>Compressed buffer to validate. Can be NULL if cmp_length is 0. </td></tr>
<tr><td class="paramname">cmp_length</td><td>Compressed length. </td></tr>
<tr><td class="paramname">payload</td><td>Uncompressed payload buffer to validate. Can be NULL if raw_length is 0. </td></tr>
<tr><td class="paramname">raw_length</td><td>Uncompressed length. </td></tr>
<tr><td class="paramname">expected_cmp_crc</td><td>Expected CRC64 of compressed data. </td></tr>
<tr><td class="paramname">expected_raw_crc</td><td>Expected CRC64 of uncompressed data. </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>AARUF_STATUS_OK on success, or AARUF_ERROR_INVALID_BLOCK_CRC on mismatch. </dd></dl>
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l01048">1048</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">References <a class="el" href="crc64_8c_source.html#l00160">aaruf_crc64_data()</a>, <a class="el" href="errors_8h_source.html#l00057">AARUF_ERROR_INVALID_BLOCK_CRC</a>, <a class="el" href="errors_8h_source.html#l00077">AARUF_STATUS_OK</a>, <a class="el" href="log_8h_source.html#l00040">FATAL</a>, and <a class="el" href="log_8h_source.html#l00025">TRACE</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l01201">aaruf_read_flux_capture()</a>.</p>
</div>
</div>
<a name="doc-var-members" id="doc-var-members"></a><h2 id="header-doc-var-members" class="groupheader">Variable Documentation</h2>
<a id="af25f05916bee2f8489613b6a096c2cec" name="af25f05916bee2f8489613b6a096c2cec"></a>
<h2 class="memtitle"><span class="permalink"><a href="#af25f05916bee2f8489613b6a096c2cec">&#9670;&#160;</a></span>FLUX_CAPTURE_RECORD_ICD</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const UT_icd FLUX_CAPTURE_RECORD_ICD = {sizeof(<a class="el" href="structFluxCaptureRecord.html">FluxCaptureRecord</a>), NULL, NULL, <a class="el" href="#a548a8cb21d02fded8a5084c96bbf5e30">flux_capture_record_dtor</a>}</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p class="definition">Definition at line <a class="el" href="flux_8c_source.html#l00065">65</a> of file <a class="el" href="flux_8c_source.html">flux.c</a>.</p>
<p class="reference">Referenced by <a class="el" href="flux_8c_source.html#l00616">aaruf_write_flux_capture()</a>.</p>
</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="page-nav" class="page-nav-panel">
<div id="page-nav-resize-handle"></div>
<div id="page-nav-tree">
<div id="page-nav-contents">
</div><!-- page-nav-contents -->
</div><!-- page-nav-tree -->
</div><!-- page-nav -->
</div><!-- container -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li><li class="navelem"><a href="dir_b2e0cd1ddd0a904cb261e9b68779deb4.html">blocks</a></li><li class="navelem"><a href="flux_8c.html">flux.c</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.15.0 </li>
</ul>
</div>
</body>
</html>