File: zip_source_layered.html

package info (click to toggle)
libzip 1.11.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,652 kB
  • sloc: ansic: 17,309; sh: 85; perl: 55; makefile: 5
file content (222 lines) | stat: -rw-r--r-- 11,818 bytes parent folder | download
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
<!DOCTYPE html>
<html>
<!-- This is an automatically generated file.  Do not edit.
   zip_source_layered.mdoc -- create layered source from function
   Copyright (C) 2004-2022 Dieter Baron and Thomas Klausner
  
   This file is part of libzip, a library to manipulate ZIP archives.
   The authors can be contacted at <info@libzip.org>
  
   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions
   are met:
   1. Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
   2. Redistributions in binary form must reproduce the above copyright
      notice, this list of conditions and the following disclaimer in
      the documentation and/or other materials provided with the
      distribution.
   3. The names of the authors may not be used to endorse or promote
      products derived from this software without specific prior
      written permission.
  
   THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS
   OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
   WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
   DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
   GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
   IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
   OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
   IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   -->
<head>
  <meta charset="utf-8"/>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  <link rel="stylesheet" href="../nih-man.css" type="text/css" media="all"/>
  <title>ZIP_SOURCE_LAYERED(3)</title>
</head>
<body>
<table class="head">
  <tr>
    <td class="head-ltitle">ZIP_SOURCE_LAYERED(3)</td>
    <td class="head-vol">Library Functions Manual</td>
    <td class="head-rtitle">ZIP_SOURCE_LAYERED(3)</td>
  </tr>
</table>
<div class="manual-text">
<section class="Sh">
<h1 class="Sh" id="NAME"><a class="permalink" href="#NAME">NAME</a></h1>
<p class="Pp"><code class="Nm">zip_source_layered</code>,
    <code class="Nm">zip_source_layered_create</code> &#x2014;
    <span class="Nd">create layered data source from function</span></p>
</section>
<section class="Sh">
<h1 class="Sh" id="LIBRARY"><a class="permalink" href="#LIBRARY">LIBRARY</a></h1>
<p class="Pp">libzip (-lzip)</p>
</section>
<section class="Sh">
<h1 class="Sh" id="SYNOPSIS"><a class="permalink" href="#SYNOPSIS">SYNOPSIS</a></h1>
<p class="Pp"><code class="In">#include
  &lt;<a class="In">zip.h</a>&gt;</code></p>
<p class="Pp"><var class="Ft">zip_source_t *</var>
  <br/>
  <code class="Fn">zip_source_layered</code>(<var class="Fa" style="white-space: nowrap;">zip_t
    *archive</var>, <var class="Fa" style="white-space: nowrap;">zip_source_t
    *source</var>,
    <var class="Fa" style="white-space: nowrap;">zip_source_layered_callback
    fn</var>, <var class="Fa" style="white-space: nowrap;">void
    *userdata</var>);</p>
<p class="Pp"><var class="Ft">zip_source_t *</var>
  <br/>
  <code class="Fn">zip_source_layered_create</code>(<var class="Fa" style="white-space: nowrap;">zip_source_t
    *source</var>,
    <var class="Fa" style="white-space: nowrap;">zip_source_layered_callback
    fn</var>, <var class="Fa" style="white-space: nowrap;">void *userdata</var>,
    <var class="Fa" style="white-space: nowrap;">zip_error_t *error</var>);</p>
</section>
<section class="Sh">
<h1 class="Sh" id="DESCRIPTION"><a class="permalink" href="#DESCRIPTION">DESCRIPTION</a></h1>
<p class="Pp">The functions
    <a class="permalink" href="#zip_source_layered"><code class="Fn" id="zip_source_layered">zip_source_layered</code></a>()
    and
    <a class="permalink" href="#zip_source_layered_create"><code class="Fn" id="zip_source_layered_create">zip_source_layered_create</code></a>()
    create a layered zip source from the user-provided function
    <var class="Ar">fn</var>, which must be of the following type:</p>
<p class="Pp"><var class="Ft">typedef zip_int64_t</var>
    <code class="Fn">(*p_source_layered_callback)</code>(<var class="Fa">zip_source_t
    *source</var>, <var class="Fa">void *userdata</var>, <var class="Fa">void
    *data</var>, <var class="Fa">zip_uint64_t length</var>,
    <var class="Fa">zip_source_cmd_t cmd</var>);</p>
<p class="Pp"><var class="Ar">archive</var> or <var class="Ar">error</var> are
    used for reporting errors and can be <code class="Dv">NULL</code>.</p>
<p class="Pp">When called by the library, the first argument is the
    <var class="Ar">source</var> of the lower layer, the second argument is the
    <var class="Ar">userdata</var> argument supplied to the function. The next
    two arguments are a buffer <var class="Ar">data</var> of size
    <var class="Ar">length</var> when data is passed in or expected to be
    returned, or else <code class="Dv">NULL</code> and 0. The last argument,
    <var class="Ar">cmd</var>, specifies which action the function should
    perform.</p>
<p class="Pp">See
    <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a> for
    a description of the commands.</p>
<p class="Pp">A layered source transforms the data or metadata of the source
    below in some way. Layered sources can't support writing and are not
    sufficient to cleanly add support for additional compression or encryption
    methods. This may be revised in a later release of libzip.</p>
<p class="Pp">On success, the layered source takes ownership of
    <var class="Ar">source</var>. The caller should not free it.</p>
<p class="Pp">The interaction with the lower layer depends on the command:</p>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_ACCEPT_EMPTY"><a class="permalink" href="#ZIP_SOURCE_ACCEPT_EMPTY"><code class="Dv">ZIP_SOURCE_ACCEPT_EMPTY</code></a></h2>
<p class="Pp">If the layered source supports this command, the lower layer is
    not called automatically. Otherwise, the return value of the lower source is
    used.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_CLOSE"><a class="permalink" href="#ZIP_SOURCE_CLOSE"><code class="Dv">ZIP_SOURCE_CLOSE</code></a></h2>
<p class="Pp">The lower layer is closed after the callback returns.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_ERROR"><a class="permalink" href="#ZIP_SOURCE_ERROR"><code class="Dv">ZIP_SOURCE_ERROR</code></a></h2>
<p class="Pp">The lower layer is not called automatically. If you need to
    retrieve error information from the lower layer, use
    <a class="Xr" href="zip_error_set_from_source.html">zip_error_set_from_source(3)</a>
    or
    <a class="Xr" href="zip_source_pass_to_lower_layer.html">zip_source_pass_to_lower_layer(3)</a>.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_FREE"><a class="permalink" href="#ZIP_SOURCE_FREE"><code class="Dv">ZIP_SOURCE_FREE</code></a></h2>
<p class="Pp">The lower layer is freed after the callback returns.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_GET_FILE_ATTRIBUTES"><a class="permalink" href="#ZIP_SOURCE_GET_FILE_ATTRIBUTES"><code class="Dv">ZIP_SOURCE_GET_FILE_ATTRIBUTES</code></a></h2>
<p class="Pp">The attributes of the lower layer are merged with the attributes
    returned by the callback: information set by the callback wins over the
    lower layer, with the following exceptions: the higher
    <var class="Ar">version_needed</var> is used, and
    <var class="Ar">general_purpose_bit_flags</var> are only overwritten if the
    corresponding bit is set in
  <var class="Ar">general_purpose_bit_mask</var>.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_OPEN"><a class="permalink" href="#ZIP_SOURCE_OPEN"><code class="Dv">ZIP_SOURCE_OPEN</code></a></h2>
<p class="Pp">The lower layer is opened before the callback is called.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_READ"><a class="permalink" href="#ZIP_SOURCE_READ"><code class="Dv">ZIP_SOURCE_READ</code></a></h2>
<p class="Pp">The lower layer is not called automatically.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_SEEK"><a class="permalink" href="#ZIP_SOURCE_SEEK"><code class="Dv">ZIP_SOURCE_SEEK</code></a></h2>
<p class="Pp">The lower layer is not called automatically.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_STAT"><a class="permalink" href="#ZIP_SOURCE_STAT"><code class="Dv">ZIP_SOURCE_STAT</code></a></h2>
<p class="Pp"><var class="Ar">data</var> contains the stat information from the
    lower layer when the callback is called.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_SUPPORTS"><a class="permalink" href="#ZIP_SOURCE_SUPPORTS"><code class="Dv">ZIP_SOURCE_SUPPORTS</code></a></h2>
<p class="Pp"><var class="Ar">data</var> contains the bitmap of commands
    supported by the lower layer when the callback is called. Since layered
    sources can't support writing, all commands related to writing are stripped
    from the returned support bitmap.</p>
</section>
<section class="Ss">
<h2 class="Ss" id="ZIP_SOURCE_TELL"><a class="permalink" href="#ZIP_SOURCE_TELL"><code class="Dv">ZIP_SOURCE_TELL</code></a></h2>
<p class="Pp">The lower layer is not called automatically.</p>
</section>
</section>
<section class="Sh">
<h1 class="Sh" id="RETURN_VALUES"><a class="permalink" href="#RETURN_VALUES">RETURN
  VALUES</a></h1>
<p class="Pp">Upon successful completion, the created source is returned.
    Otherwise, <code class="Dv">NULL</code> is returned and the error code in
    <var class="Ar">archive</var> or <var class="Ar">error</var> is set to
    indicate the error (unless it is <code class="Dv">NULL</code>).</p>
</section>
<section class="Sh">
<h1 class="Sh" id="ERRORS"><a class="permalink" href="#ERRORS">ERRORS</a></h1>
<p class="Pp"><code class="Fn">zip_source_layered</code>() fails if:</p>
<dl class="Bl-tag">
  <dt id="ZIP_ER_MEMORY">[<a class="permalink" href="#ZIP_ER_MEMORY"><code class="Er">ZIP_ER_MEMORY</code></a>]</dt>
  <dd>Required memory could not be allocated.</dd>
</dl>
</section>
<section class="Sh">
<h1 class="Sh" id="SEE_ALSO"><a class="permalink" href="#SEE_ALSO">SEE
  ALSO</a></h1>
<p class="Pp"><a class="Xr" href="libzip.html">libzip(3)</a>,
    <a class="Xr" href="zip_file_add.html">zip_file_add(3)</a>,
    <a class="Xr" href="zip_file_attributes_init.html">zip_file_attributes_init(3)</a>,
    <a class="Xr" href="zip_file_replace.html">zip_file_replace(3)</a>,
    <a class="Xr" href="zip_source.html">zip_source(5)</a>,
    <a class="Xr" href="zip_source_function.html">zip_source_function(3)</a>,
    <a class="Xr" href="zip_source_pass_to_lower_layer.html">zip_source_pass_to_lower_layer(3)</a></p>
</section>
<section class="Sh">
<h1 class="Sh" id="HISTORY"><a class="permalink" href="#HISTORY">HISTORY</a></h1>
<p class="Pp"><code class="Fn">zip_source_layered</code>() and
    <code class="Fn">zip_source_layered_create</code>() were added in libzip
    1.10.</p>
</section>
<section class="Sh">
<h1 class="Sh" id="AUTHORS"><a class="permalink" href="#AUTHORS">AUTHORS</a></h1>
<p class="Pp"><span class="An">Dieter Baron</span>
    &lt;<a class="Mt" href="mailto:dillo@nih.at">dillo@nih.at</a>&gt; and
    <span class="An">Thomas Klausner</span>
    &lt;<a class="Mt" href="mailto:wiz@gatalith.at">wiz@gatalith.at</a>&gt;</p>
</section>
</div>
<table class="foot">
  <tr>
    <td class="foot-date">January 20, 2023</td>
    <td class="foot-os">NiH</td>
  </tr>
</table>
</body>
</html>