summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2007-10-03 08:45:00 +0000
committerDaniel Stenberg <daniel@haxx.se>2007-10-03 08:45:00 +0000
commitce1cfcb7a6a0956c3101f5a6eb20961024e55d84 (patch)
tree17c181f52f1e3ff91434e31086b0dca103b4c8b0 /include
parentce81cd21d3865270867d68935c9700dbaf5b5fcc (diff)
downloadcurl-ce1cfcb7a6a0956c3101f5a6eb20961024e55d84.tar.gz
Alexey Pesternikov introduced CURLOPT_OPENSOCKETFUNCTION and
CURLOPT_OPENSOCKETDATA to set a callback that allows an application to replace the socket() call used by libcurl. It basically allows the app to change address, protocol or whatever of the socket. (I also did some whitespace indent/cleanups in lib/url.c which kind of hides some of these changes, sorry for mixing those in.)
Diffstat (limited to 'include')
-rw-r--r--include/curl/curl.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h
index 52acc564a..37058254d 100644
--- a/include/curl/curl.h
+++ b/include/curl/curl.h
@@ -246,6 +246,19 @@ typedef int (*curl_sockopt_callback)(void *clientp,
curl_socket_t curlfd,
curlsocktype purpose);
+struct Curl_sockaddr {
+ int family;
+ int socktype;
+ int protocol;
+ socklen_t addrlen;
+ struct sockaddr addr;
+};
+
+typedef curl_socket_t
+(*curl_opensocket_callback)(void* clentp,
+ curlsocktype purpose,
+ struct Curl_sockaddr* address);
+
#ifndef CURL_NO_OLDIES
/* not used since 7.10.8, will be removed in a future release */
typedef int (*curl_passwd_callback)(void *clientp,
@@ -1135,6 +1148,13 @@ typedef enum {
/* used by scp/sftp to verify the host's public key */
CINIT(SSH_HOST_PUBLIC_KEY_MD5, OBJECTPOINT, 162),
+ /* Callback function for opening socket (instead of socket(2)). Optionally,
+ callback is able change the address or refuse to connect returning
+ CURL_SOCKET_BAD. The callback should have type
+ curl_opensocket_callback */
+ CINIT(OPENSOCKETFUNCTION, FUNCTIONPOINT, 163),
+ CINIT(OPENSOCKETDATA, OBJECTPOINT, 164),
+
CURLOPT_LASTENTRY /* the last unused */
} CURLoption;