1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
<!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.9.7"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>liblzma (XZ Utils): lzma/index_hash.h File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<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">liblzma (XZ Utils)<span id="projectnumber"> 5.4.5</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.7 -->
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main Page</span></a></li>
<li><a href="annotated.html"><span>Data Structures</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File List</span></a></li>
<li><a href="globals.html"><span>Globals</span></a></li>
</ul>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_b17a1d403082bd69a703ed987cf158fb.html">lzma</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="summary">
<a href="#typedef-members">Typedefs</a> |
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">index_hash.h File Reference</div></div>
</div><!--header-->
<div class="contents">
<p>Validate Index by using a hash function.
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
Typedefs</h2></td></tr>
<tr class="memitem:a2db9f438838c8ff72a8a6fd3fc856f8c"><td class="memItemLeft" align="right" valign="top"><a id="a2db9f438838c8ff72a8a6fd3fc856f8c" name="a2db9f438838c8ff72a8a6fd3fc856f8c"></a>
typedef struct lzma_index_hash_s </td><td class="memItemRight" valign="bottom"><b>lzma_index_hash</b></td></tr>
<tr class="memdesc:a2db9f438838c8ff72a8a6fd3fc856f8c"><td class="mdescLeft"> </td><td class="mdescRight">Opaque data type to hold the Index hash. <br /></td></tr>
<tr class="separator:a2db9f438838c8ff72a8a6fd3fc856f8c"><td class="memSeparator" colspan="2"> </td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:aaafae4967a4a266d97dc34a98bfcabfb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="index__hash_8h.html#aaafae4967a4a266d97dc34a98bfcabfb">lzma_index_hash_init</a> (<a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> *index_hash, const <a class="el" href="structlzma__allocator.html">lzma_allocator</a> *allocator) lzma_nothrow lzma_attr_warn_unused_result</td></tr>
<tr class="memdesc:aaafae4967a4a266d97dc34a98bfcabfb"><td class="mdescLeft"> </td><td class="mdescRight">Allocate and initialize a new lzma_index_hash structure. <br /></td></tr>
<tr class="separator:aaafae4967a4a266d97dc34a98bfcabfb"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a7dacb41b9ec1c8df5d33dfdae97743b3"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="index__hash_8h.html#a7dacb41b9ec1c8df5d33dfdae97743b3">lzma_index_hash_end</a> (<a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> *index_hash, const <a class="el" href="structlzma__allocator.html">lzma_allocator</a> *allocator) lzma_nothrow</td></tr>
<tr class="memdesc:a7dacb41b9ec1c8df5d33dfdae97743b3"><td class="mdescLeft"> </td><td class="mdescRight">Deallocate lzma_index_hash structure. <br /></td></tr>
<tr class="separator:a7dacb41b9ec1c8df5d33dfdae97743b3"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a2bdbe4f0b5fa2fadb7528447feaaa97f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="index__hash_8h.html#a2bdbe4f0b5fa2fadb7528447feaaa97f">lzma_index_hash_append</a> (<a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> *index_hash, <a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> unpadded_size, <a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> uncompressed_size) lzma_nothrow lzma_attr_warn_unused_result</td></tr>
<tr class="memdesc:a2bdbe4f0b5fa2fadb7528447feaaa97f"><td class="mdescLeft"> </td><td class="mdescRight">Add a new Record to an Index hash. <br /></td></tr>
<tr class="separator:a2bdbe4f0b5fa2fadb7528447feaaa97f"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a891eb955284c9117155f92eb0ddba44c"><td class="memItemLeft" align="right" valign="top"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="index__hash_8h.html#a891eb955284c9117155f92eb0ddba44c">lzma_index_hash_decode</a> (<a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> *index_hash, const uint8_t *in, size_t *in_pos, size_t in_size) lzma_nothrow lzma_attr_warn_unused_result</td></tr>
<tr class="memdesc:a891eb955284c9117155f92eb0ddba44c"><td class="mdescLeft"> </td><td class="mdescRight">Decode and validate the Index field. <br /></td></tr>
<tr class="separator:a891eb955284c9117155f92eb0ddba44c"><td class="memSeparator" colspan="2"> </td></tr>
<tr class="memitem:a0f8ab3b57b117f9547866156755c917f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="index__hash_8h.html#a0f8ab3b57b117f9547866156755c917f">lzma_index_hash_size</a> (const <a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> *index_hash) lzma_nothrow lzma_attr_pure</td></tr>
<tr class="memdesc:a0f8ab3b57b117f9547866156755c917f"><td class="mdescLeft"> </td><td class="mdescRight">Get the size of the Index field as bytes. <br /></td></tr>
<tr class="separator:a0f8ab3b57b117f9547866156755c917f"><td class="memSeparator" colspan="2"> </td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Validate Index by using a hash function. </p>
<dl class="section note"><dt>Note</dt><dd>Never include this file directly. Use <<a class="el" href="lzma_8h.html" title="The public API of liblzma data compression library.">lzma.h</a>> instead.</dd></dl>
<p>Hashing makes it possible to use constant amount of memory to validate Index of arbitrary size. </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="aaafae4967a4a266d97dc34a98bfcabfb" name="aaafae4967a4a266d97dc34a98bfcabfb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aaafae4967a4a266d97dc34a98bfcabfb">◆ </a></span>lzma_index_hash_init()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * lzma_index_hash_init </td>
<td>(</td>
<td class="paramtype"><a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * </td>
<td class="paramname"><em>index_hash</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structlzma__allocator.html">lzma_allocator</a> * </td>
<td class="paramname"><em>allocator</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Allocate and initialize a new lzma_index_hash structure. </p>
<p>If index_hash is NULL, this function allocates and initializes a new lzma_index_hash structure and returns a pointer to it. If allocation fails, NULL is returned.</p>
<p>If index_hash is non-NULL, this function reinitializes the lzma_index_hash structure and returns the same pointer. In this case, return value cannot be NULL or a different pointer than the index_hash that was given as an argument.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">index_hash</td><td>Pointer to a lzma_index_hash structure or NULL. </td></tr>
<tr><td class="paramname">allocator</td><td><a class="el" href="structlzma__allocator.html" title="Custom functions for memory handling.">lzma_allocator</a> for custom allocator functions. Set to NULL to use malloc() and free().</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Initialized lzma_index_hash structure on success or NULL on failure. </dd></dl>
</div>
</div>
<a id="a7dacb41b9ec1c8df5d33dfdae97743b3" name="a7dacb41b9ec1c8df5d33dfdae97743b3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7dacb41b9ec1c8df5d33dfdae97743b3">◆ </a></span>lzma_index_hash_end()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void lzma_index_hash_end </td>
<td>(</td>
<td class="paramtype"><a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * </td>
<td class="paramname"><em>index_hash</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const <a class="el" href="structlzma__allocator.html">lzma_allocator</a> * </td>
<td class="paramname"><em>allocator</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Deallocate lzma_index_hash structure. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">index_hash</td><td>Pointer to a lzma_index_hash structure to free. </td></tr>
<tr><td class="paramname">allocator</td><td><a class="el" href="structlzma__allocator.html" title="Custom functions for memory handling.">lzma_allocator</a> for custom allocator functions. Set to NULL to use malloc() and free(). </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a2bdbe4f0b5fa2fadb7528447feaaa97f" name="a2bdbe4f0b5fa2fadb7528447feaaa97f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2bdbe4f0b5fa2fadb7528447feaaa97f">◆ </a></span>lzma_index_hash_append()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> lzma_index_hash_append </td>
<td>(</td>
<td class="paramtype"><a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * </td>
<td class="paramname"><em>index_hash</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> </td>
<td class="paramname"><em>unpadded_size</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> </td>
<td class="paramname"><em>uncompressed_size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Add a new Record to an Index hash. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">index_hash</td><td>Pointer to a lzma_index_hash structure </td></tr>
<tr><td class="paramname">unpadded_size</td><td>Unpadded Size of a Block </td></tr>
<tr><td class="paramname">uncompressed_size</td><td>Uncompressed Size of a Block</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Possible lzma_ret values:<ul>
<li>LZMA_OK</li>
<li>LZMA_DATA_ERROR: Compressed or uncompressed size of the Stream or size of the Index field would grow too big.</li>
<li>LZMA_PROG_ERROR: Invalid arguments or this function is being used when <a class="el" href="index__hash_8h.html#a891eb955284c9117155f92eb0ddba44c" title="Decode and validate the Index field.">lzma_index_hash_decode()</a> has already been used. </li>
</ul>
</dd></dl>
</div>
</div>
<a id="a891eb955284c9117155f92eb0ddba44c" name="a891eb955284c9117155f92eb0ddba44c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a891eb955284c9117155f92eb0ddba44c">◆ </a></span>lzma_index_hash_decode()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="base_8h.html#a8494e0457e1463d6d2b6836018d87b6e">lzma_ret</a> lzma_index_hash_decode </td>
<td>(</td>
<td class="paramtype"><a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * </td>
<td class="paramname"><em>index_hash</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const uint8_t * </td>
<td class="paramname"><em>in</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t * </td>
<td class="paramname"><em>in_pos</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">size_t </td>
<td class="paramname"><em>in_size</em> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Decode and validate the Index field. </p>
<p>After telling the sizes of all Blocks with <a class="el" href="index__hash_8h.html#a2bdbe4f0b5fa2fadb7528447feaaa97f" title="Add a new Record to an Index hash.">lzma_index_hash_append()</a>, the actual Index field is decoded with this function. Specifically, once decoding of the Index field has been started, no more Records can be added using <a class="el" href="index__hash_8h.html#a2bdbe4f0b5fa2fadb7528447feaaa97f" title="Add a new Record to an Index hash.">lzma_index_hash_append()</a>.</p>
<p>This function doesn't use <a class="el" href="structlzma__stream.html" title="Passing data to and from liblzma.">lzma_stream</a> structure to pass the input data. Instead, the input buffer is specified using three arguments. This is because it matches better the internal APIs of liblzma.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir"></td><td class="paramname">index_hash</td><td>Pointer to a lzma_index_hash structure </td></tr>
<tr><td class="paramdir"></td><td class="paramname">in</td><td>Pointer to the beginning of the input buffer </td></tr>
<tr><td class="paramdir">[out]</td><td class="paramname">in_pos</td><td>in[*in_pos] is the next byte to process </td></tr>
<tr><td class="paramdir"></td><td class="paramname">in_size</td><td>in[in_size] is the first byte not to process</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Possible lzma_ret values:<ul>
<li>LZMA_OK: So far good, but more input is needed.</li>
<li>LZMA_STREAM_END: Index decoded successfully and it matches the Records given with <a class="el" href="index__hash_8h.html#a2bdbe4f0b5fa2fadb7528447feaaa97f" title="Add a new Record to an Index hash.">lzma_index_hash_append()</a>.</li>
<li>LZMA_DATA_ERROR: Index is corrupt or doesn't match the information given with <a class="el" href="index__hash_8h.html#a2bdbe4f0b5fa2fadb7528447feaaa97f" title="Add a new Record to an Index hash.">lzma_index_hash_append()</a>.</li>
<li>LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size.</li>
<li>LZMA_PROG_ERROR </li>
</ul>
</dd></dl>
</div>
</div>
<a id="a0f8ab3b57b117f9547866156755c917f" name="a0f8ab3b57b117f9547866156755c917f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0f8ab3b57b117f9547866156755c917f">◆ </a></span>lzma_index_hash_size()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="vli_8h.html#a1dbc0ffc3e72748f64df8f7f71898272">lzma_vli</a> lzma_index_hash_size </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="index__hash_8h.html#a2db9f438838c8ff72a8a6fd3fc856f8c">lzma_index_hash</a> * </td>
<td class="paramname"><em>index_hash</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the size of the Index field as bytes. </p>
<p>This is needed to verify the Backward Size field in the Stream Footer.</p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">index_hash</td><td>Pointer to a lzma_index_hash structure</td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Size of the Index field in bytes. </dd></dl>
</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.7
</small></address>
</body>
</html>
|