diff options
author | Daniel Stenberg <daniel@haxx.se> | 2006-08-29 14:39:33 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2006-08-29 14:39:33 +0000 |
commit | 5acadc9cd7a1ff40ffa8d57214c90d8c788b2b03 (patch) | |
tree | 3c417bc272e9a97f8ae763406c8151cea2fa7d74 /include | |
parent | 2ff609dd43cb5c1c0da893c080132a48a2d4c73b (diff) |
David McCreedy added CURLOPT_SOCKOPTFUNCTION and CURLOPT_SOCKOPTDATA to
allow applications to set their own socket options.
Diffstat (limited to 'include')
-rw-r--r-- | include/curl/curl.h | 53 | ||||
-rw-r--r-- | include/curl/multi.h | 40 |
2 files changed, 53 insertions, 40 deletions
diff --git a/include/curl/curl.h b/include/curl/curl.h index f4166cb58..6f0be2c9f 100644 --- a/include/curl/curl.h +++ b/include/curl/curl.h @@ -133,6 +133,47 @@ extern "C" { #undef FILESIZEBITS #endif +#if defined(_WIN32) && !defined(WIN32) +/* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we + make this adjustment to catch this. */ +#define WIN32 1 +#endif + +#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \ + !defined(__CYGWIN__) || defined(__MINGW32__) +#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H)) +/* The check above prevents the winsock2 inclusion if winsock.h already was + included, since they can't co-exist without problems */ +#include <winsock2.h> +#endif +#else + +/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish + libc5-based Linux systems. Only include it on system that are known to + require it! */ +#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix) +#include <sys/select.h> +#endif + +#ifndef _WIN32_WCE +#include <sys/socket.h> +#endif +#include <sys/time.h> +#include <sys/types.h> +#endif + +#ifndef curl_socket_typedef +/* socket typedef */ +#ifdef WIN32 +typedef SOCKET curl_socket_t; +#define CURL_SOCKET_BAD INVALID_SOCKET +#else +typedef int curl_socket_t; +#define CURL_SOCKET_BAD -1 +#endif +#define curl_socket_typedef +#endif /* curl_socket_typedef */ + struct curl_httppost { struct curl_httppost *next; /* next entry in the list */ char *name; /* pointer to allocated name */ @@ -184,6 +225,14 @@ typedef size_t (*curl_read_callback)(char *buffer, size_t nitems, void *instream); +typedef enum { + CURLSOCKTYPE_IPCXN, /* socket created for a specific IP connection */ + CURLSOCKTYPE_LAST /* never use */ +} curlsocktype; + +typedef int (*curl_sockopt_callback)(void *clientp, + curl_socket_t curlfd, + curlsocktype purpose); #ifndef CURL_NO_OLDIES /* not used since 7.10.8, will be removed in a future release */ @@ -982,6 +1031,10 @@ typedef enum { /* Pointer to command string to send if USER/PASS fails. */ CINIT(FTP_ALTERNATIVE_TO_USER, OBJECTPOINT, 147), + /* callback function for setting socket options */ + CINIT(SOCKOPTFUNCTION, FUNCTIONPOINT, 148), + CINIT(SOCKOPTDATA, OBJECTPOINT, 149), + CURLOPT_LASTENTRY /* the last unused */ } CURLoption; diff --git a/include/curl/multi.h b/include/curl/multi.h index 6811ce798..1beda8a92 100644 --- a/include/curl/multi.h +++ b/include/curl/multi.h @@ -37,34 +37,6 @@ file descriptors simultaneous easily. */ -#if defined(_WIN32) && !defined(WIN32) -/* Chris Lewis mentioned that he doesn't get WIN32 defined, only _WIN32 so we - make this adjustment to catch this. */ -#define WIN32 1 -#endif - -#if defined(WIN32) && !defined(_WIN32_WCE) && !defined(__GNUC__) && \ - !defined(__CYGWIN__) || defined(__MINGW32__) -#if !(defined(_WINSOCKAPI_) || defined(_WINSOCK_H)) -/* The check above prevents the winsock2 inclusion if winsock.h already was - included, since they can't co-exist without problems */ -#include <winsock2.h> -#endif -#else - -/* HP-UX systems version 9, 10 and 11 lack sys/select.h and so does oldish - libc5-based Linux systems. Only include it on system that are known to - require it! */ -#if defined(_AIX) || defined(NETWARE) || defined(__NetBSD__) || defined(__minix) -#include <sys/select.h> -#endif - -#ifndef _WIN32_WCE -#include <sys/socket.h> -#endif -#include <sys/time.h> -#include <sys/types.h> -#endif /* * This header file should not really need to include "curl.h" since curl.h @@ -83,18 +55,6 @@ extern "C" { typedef void CURLM; -#ifndef curl_socket_typedef -/* Public socket typedef */ -#ifdef WIN32 -typedef SOCKET curl_socket_t; -#define CURL_SOCKET_BAD INVALID_SOCKET -#else -typedef int curl_socket_t; -#define CURL_SOCKET_BAD -1 -#endif -#define curl_socket_typedef -#endif /* curl_socket_typedef */ - typedef enum { CURLM_CALL_MULTI_PERFORM = -1, /* please call curl_multi_perform() or curl_multi_socket*() soon */ |