Revert "Update to 7.44.0"
[platform/upstream/curl.git] / docs / libcurl / opts / CURLOPT_SEEKFUNCTION.3
1 .\" **************************************************************************
2 .\" *                                  _   _ ____  _
3 .\" *  Project                     ___| | | |  _ \| |
4 .\" *                             / __| | | | |_) | |
5 .\" *                            | (__| |_| |  _ <| |___
6 .\" *                             \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al.
9 .\" *
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at http://curl.haxx.se/docs/copyright.html.
13 .\" *
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
17 .\" *
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
20 .\" *
21 .\" **************************************************************************
22 .\"
23 .TH CURLOPT_SEEKFUNCTION 3 "16 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
24 .SH NAME
25 CURLOPT_SEEKFUNCTION \- user callback for seeking in input stream
26 .SH SYNOPSIS
27 .nf
28 #include <curl/curl.h>
29
30 /* These are the return codes for the seek callbacks */
31 #define CURL_SEEKFUNC_OK       0
32 #define CURL_SEEKFUNC_FAIL     1 /* fail the entire transfer */
33 #define CURL_SEEKFUNC_CANTSEEK 2 /* tell libcurl seeking can't be done, so
34                                     libcurl might try other means instead */
35
36 int seek_callback(void *userp, curl_off_t offset, int origin);
37
38 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SEEKFUNCTION, seek_callback);
39 .SH DESCRIPTION
40 Pass a pointer to your callback function, which should match the prototype
41 shown above.
42
43 This function gets called by libcurl to seek to a certain position in the
44 input stream and can be used to fast forward a file in a resumed upload
45 (instead of reading all uploaded bytes with the normal read
46 function/callback). It is also called to rewind a stream when doing a HTTP PUT
47 or POST with a multi-pass authentication method. The function shall work like
48 fseek(3) or lseek(3) and it gets SEEK_SET, SEEK_CUR or SEEK_END as argument
49 for \fIorigin\fP, although libcurl currently only passes SEEK_SET.
50
51 \fIuserp\fP is the pointer you set with \fICURLOPT_SEEKDATA(3)\fP.
52
53 The callback function must return \fICURL_SEEKFUNC_OK\fP on success,
54 \fICURL_SEEKFUNC_FAIL\fP to cause the upload operation to fail or
55 \fICURL_SEEKFUNC_CANTSEEK\fP to indicate that while the seek failed, libcurl
56 is free to work around the problem if possible. The latter can sometimes be
57 done by instead reading from the input or similar.
58
59 If you forward the input arguments directly to fseek(3) or lseek(3), note that
60 the data type for \fIoffset\fP is not the same as defined for curl_off_t on
61 many systems!
62 .SH DEFAULT
63 By default, this is NULL and unused.
64 .SH PROTOCOLS
65 HTTP, FTP, SFTP
66 .SH EXAMPLE
67 TODO
68 .SH AVAILABILITY
69 Added in 7.18.0
70 .SH RETURN VALUE
71 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
72 .SH "SEE ALSO"
73 .BR CURLOPT_SEEKDATA "(3), " CURLOPT_IOCTLFUNCTION "(3), "