comparison mupdf-source/thirdparty/curl/docs/libcurl/opts/CURLOPT_OPENSOCKETDATA.3 @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 .\" **************************************************************************
2 .\" * _ _ ____ _
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
7 .\" *
8 .\" * Copyright (C) 1998 - 2017, 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 https://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_OPENSOCKETDATA 3 "16 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
24 .SH NAME
25 CURLOPT_OPENSOCKETDATA \- custom pointer passed to open socket callback
26 .SH SYNOPSIS
27 #include <curl/curl.h>
28
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_OPENSOCKETDATA, void *pointer);
30 .SH DESCRIPTION
31 Pass a \fIpointer\fP that will be untouched by libcurl and passed as the first
32 argument in the opensocket callback set with \fICURLOPT_OPENSOCKETFUNCTION(3)\fP.
33 .SH DEFAULT
34 The default value of this parameter is NULL.
35 .SH PROTOCOLS
36 All
37 .SH EXAMPLE
38 .nf
39 /* make libcurl use the already established socket 'sockfd' */
40
41 static curl_socket_t opensocket(void *clientp,
42 curlsocktype purpose,
43 struct curl_sockaddr *address)
44 {
45 curl_socket_t sockfd;
46 sockfd = *(curl_socket_t *)clientp;
47 /* the actual externally set socket is passed in via the OPENSOCKETDATA
48 option */
49 return sockfd;
50 }
51
52 static int sockopt_callback(void *clientp, curl_socket_t curlfd,
53 curlsocktype purpose)
54 {
55 /* This return code was added in libcurl 7.21.5 */
56 return CURL_SOCKOPT_ALREADY_CONNECTED;
57 }
58
59 curl = curl_easy_init();
60 if(curl) {
61 /* libcurl will internally think that you connect to the host
62 * and port that you specify in the URL option. */
63 curl_easy_setopt(curl, CURLOPT_URL, "http://99.99.99.99:9999");
64 /* call this function to get a socket */
65 curl_easy_setopt(curl, CURLOPT_OPENSOCKETFUNCTION, opensocket);
66 curl_easy_setopt(curl, CURLOPT_OPENSOCKETDATA, &sockfd);
67
68 /* call this function to set options for the socket */
69 curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, sockopt_callback);
70
71 res = curl_easy_perform(curl);
72
73 curl_easy_cleanup(curl);
74 }
75 .fi
76 .SH AVAILABILITY
77 Added in 7.17.1
78 .SH RETURN VALUE
79 Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not.
80 .SH "SEE ALSO"
81 .BR CURLOPT_OPENSOCKETFUNCTION "(3), " CURLOPT_SOCKOPTFUNCTION "(3), "