]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
2c85b752 | 2 | * Private HTTP definitions for CUPS. |
ef416fc2 | 3 | * |
378eeedf | 4 | * Copyright 2007-2018 by Apple Inc. |
2c85b752 | 5 | * Copyright 1997-2007 by Easy Software Products, all rights reserved. |
ef416fc2 | 6 | * |
378eeedf MS |
7 | * Licensed under Apache License v2.0. See the file "LICENSE" for more |
8 | * information. | |
ef416fc2 | 9 | */ |
10 | ||
11 | #ifndef _CUPS_HTTP_PRIVATE_H_ | |
12 | # define _CUPS_HTTP_PRIVATE_H_ | |
13 | ||
14 | /* | |
15 | * Include necessary headers... | |
16 | */ | |
17 | ||
71e16022 | 18 | # include "config.h" |
41e6c1f1 | 19 | # include <cups/language.h> |
5180a04c | 20 | # include <stddef.h> |
a74454a7 | 21 | # include <stdlib.h> |
ef416fc2 | 22 | |
23 | # ifdef __sun | |
ef416fc2 | 24 | # include <sys/select.h> |
25 | # endif /* __sun */ | |
26 | ||
27 | # include <limits.h> | |
28 | # ifdef WIN32 | |
29 | # include <io.h> | |
30 | # include <winsock2.h> | |
db8b865d | 31 | # define CUPS_SOCAST (const char *) |
ef416fc2 | 32 | # else |
33 | # include <unistd.h> | |
34 | # include <fcntl.h> | |
35 | # include <sys/socket.h> | |
db8b865d | 36 | # define CUPS_SOCAST |
ef416fc2 | 37 | # endif /* WIN32 */ |
38 | ||
f7deaa1a | 39 | # ifdef HAVE_GSSAPI |
eac3a0a0 MS |
40 | # ifdef HAVE_GSS_GSSAPI_H |
41 | # include <GSS/gssapi.h> | |
eac3a0a0 | 42 | # elif defined(HAVE_GSSAPI_GSSAPI_H) |
f7deaa1a | 43 | # include <gssapi/gssapi.h> |
eac3a0a0 | 44 | # elif defined(HAVE_GSSAPI_H) |
f7deaa1a | 45 | # include <gssapi.h> |
eac3a0a0 | 46 | # endif /* HAVE_GSS_GSSAPI_H */ |
f7deaa1a | 47 | # ifndef HAVE_GSS_C_NT_HOSTBASED_SERVICE |
48 | # define GSS_C_NT_HOSTBASED_SERVICE gss_nt_service_name | |
49 | # endif /* !HAVE_GSS_C_NT_HOSTBASED_SERVICE */ | |
50 | # endif /* HAVE_GSSAPI */ | |
51 | ||
b94498cf | 52 | # ifdef HAVE_AUTHORIZATION_H |
53 | # include <Security/Authorization.h> | |
54 | # endif /* HAVE_AUTHORIZATION_H */ | |
55 | ||
3dd9c340 | 56 | # if defined(__APPLE__) && !defined(_SOCKLEN_T) |
ef416fc2 | 57 | /* |
d4874933 | 58 | * macOS 10.2.x does not define socklen_t, and in fact uses an int instead of |
ef416fc2 | 59 | * unsigned type for length values... |
60 | */ | |
61 | ||
62 | typedef int socklen_t; | |
3dd9c340 | 63 | # endif /* __APPLE__ && !_SOCKLEN_T */ |
ef416fc2 | 64 | |
71e16022 | 65 | # include <cups/http.h> |
fa73b229 | 66 | # include "ipp-private.h" |
ef416fc2 | 67 | |
724e1819 | 68 | # ifdef HAVE_GNUTLS |
07ed0e9a MS |
69 | # include <gnutls/gnutls.h> |
70 | # include <gnutls/x509.h> | |
07ed0e9a MS |
71 | # elif defined(HAVE_CDSASSL) |
72 | # include <CoreFoundation/CoreFoundation.h> | |
73 | # include <Security/Security.h> | |
74 | # include <Security/SecureTransport.h> | |
eac3a0a0 MS |
75 | # ifdef HAVE_SECURETRANSPORTPRIV_H |
76 | # include <Security/SecureTransportPriv.h> | |
77 | # endif /* HAVE_SECURETRANSPORTPRIV_H */ | |
07ed0e9a MS |
78 | # ifdef HAVE_SECITEM_H |
79 | # include <Security/SecItem.h> | |
80 | # endif /* HAVE_SECITEM_H */ | |
81 | # ifdef HAVE_SECBASEPRIV_H | |
82 | # include <Security/SecBasePriv.h> | |
83 | # endif /* HAVE_SECBASEPRIV_H */ | |
84 | # ifdef HAVE_SECCERTIFICATE_H | |
85 | # include <Security/SecCertificate.h> | |
86 | # include <Security/SecIdentity.h> | |
87 | # endif /* HAVE_SECCERTIFICATE_H */ | |
9653cfdf MS |
88 | # ifdef HAVE_SECCERTIFICATEPRIV_H |
89 | # include <Security/SecCertificatePriv.h> | |
90 | # else | |
91 | # ifdef __cplusplus | |
92 | extern "C" { | |
93 | # endif /* __cplusplus */ | |
de8c34f8 | 94 | # ifndef _SECURITY_VERSION_GREATER_THAN_57610_ |
558883c6 MS |
95 | typedef CF_OPTIONS(uint32_t, SecKeyUsage) { |
96 | kSecKeyUsageAll = 0x7FFFFFFF | |
97 | }; | |
de8c34f8 | 98 | # endif /* !_SECURITY_VERSION_GREATER_THAN_57610_ */ |
558883c6 MS |
99 | extern const void * kSecCSRChallengePassword; |
100 | extern const void * kSecSubjectAltName; | |
101 | extern const void * kSecCertificateKeyUsage; | |
102 | extern const void * kSecCSRBasicContraintsPathLen; | |
103 | extern const void * kSecCertificateExtensions; | |
104 | extern const void * kSecCertificateExtensionsEncoded; | |
105 | extern const void * kSecOidCommonName; | |
106 | extern const void * kSecOidCountryName; | |
107 | extern const void * kSecOidStateProvinceName; | |
108 | extern const void * kSecOidLocalityName; | |
109 | extern const void * kSecOidOrganization; | |
110 | extern const void * kSecOidOrganizationalUnit; | |
9653cfdf MS |
111 | extern SecCertificateRef SecCertificateCreateWithBytes(CFAllocatorRef allocator, const UInt8 *bytes, CFIndex length); |
112 | extern bool SecCertificateIsValid(SecCertificateRef certificate, CFAbsoluteTime verifyTime); | |
113 | extern CFAbsoluteTime SecCertificateNotValidAfter(SecCertificateRef certificate); | |
558883c6 MS |
114 | extern SecCertificateRef SecGenerateSelfSignedCertificate(CFArrayRef subject, CFDictionaryRef parameters, SecKeyRef publicKey, SecKeyRef privateKey); |
115 | extern SecIdentityRef SecIdentityCreate(CFAllocatorRef allocator, SecCertificateRef certificate, SecKeyRef privateKey); | |
9653cfdf MS |
116 | # ifdef __cplusplus |
117 | } | |
118 | # endif /* __cplusplus */ | |
119 | # endif /* HAVE_SECCERTIFICATEPRIV_H */ | |
07ed0e9a MS |
120 | # ifdef HAVE_SECITEMPRIV_H |
121 | # include <Security/SecItemPriv.h> | |
122 | # endif /* HAVE_SECITEMPRIV_H */ | |
123 | # ifdef HAVE_SECIDENTITYSEARCHPRIV_H | |
124 | # include <Security/SecIdentitySearchPriv.h> | |
125 | # endif /* HAVE_SECIDENTITYSEARCHPRIV_H */ | |
126 | # ifdef HAVE_SECPOLICYPRIV_H | |
127 | # include <Security/SecPolicyPriv.h> | |
128 | # endif /* HAVE_SECPOLICYPRIV_H */ | |
129 | # elif defined(HAVE_SSPISSL) | |
2ece34a9 MS |
130 | # include <wincrypt.h> |
131 | # include <wintrust.h> | |
132 | # include <schannel.h> | |
133 | # define SECURITY_WIN32 | |
134 | # include <security.h> | |
135 | # include <sspi.h> | |
724e1819 | 136 | # endif /* HAVE_GNUTLS */ |
07ed0e9a MS |
137 | |
138 | # ifndef WIN32 | |
139 | # include <net/if.h> | |
ed26f50f | 140 | # include <resolv.h> |
07ed0e9a MS |
141 | # ifdef HAVE_GETIFADDRS |
142 | # include <ifaddrs.h> | |
143 | # else | |
144 | # include <sys/ioctl.h> | |
145 | # ifdef HAVE_SYS_SOCKIO_H | |
146 | # include <sys/sockio.h> | |
147 | # endif /* HAVE_SYS_SOCKIO_H */ | |
148 | # endif /* HAVE_GETIFADDRS */ | |
149 | # endif /* !WIN32 */ | |
150 | ||
a469f8a5 MS |
151 | # ifdef HAVE_LIBZ |
152 | # include <zlib.h> | |
153 | # endif /* HAVE_LIBZ */ | |
154 | ||
07ed0e9a MS |
155 | |
156 | /* | |
157 | * C++ magic... | |
158 | */ | |
159 | ||
160 | # ifdef __cplusplus | |
161 | extern "C" { | |
162 | # endif /* __cplusplus */ | |
163 | ||
164 | ||
eac3a0a0 MS |
165 | /* |
166 | * Constants... | |
167 | */ | |
168 | ||
02c88e67 MS |
169 | # define _HTTP_MAX_SBUFFER 65536 /* Size of (de)compression buffer */ |
170 | # define _HTTP_RESOLVE_DEFAULT 0 /* Just resolve with default options */ | |
171 | # define _HTTP_RESOLVE_STDERR 1 /* Log resolve progress to stderr */ | |
172 | # define _HTTP_RESOLVE_FQDN 2 /* Resolve to a FQDN */ | |
173 | # define _HTTP_RESOLVE_FAXOUT 4 /* Resolve FaxOut service? */ | |
174 | ||
175 | # define _HTTP_TLS_NONE 0 /* No TLS options */ | |
176 | # define _HTTP_TLS_ALLOW_RC4 1 /* Allow RC4 cipher suites */ | |
8f1fbdec MS |
177 | # define _HTTP_TLS_ALLOW_DH 2 /* Allow DH/DHE key negotiation */ |
178 | # define _HTTP_TLS_DENY_CBC 4 /* Deny CBC cipher suites */ | |
02c88e67 | 179 | # define _HTTP_TLS_SET_DEFAULT 128 /* Setting the default TLS options */ |
63aefcd5 | 180 | |
8f1fbdec MS |
181 | # define _HTTP_TLS_SSL3 0 /* Min/max version is SSL/3.0 */ |
182 | # define _HTTP_TLS_1_0 1 /* Min/max version is TLS/1.0 */ | |
183 | # define _HTTP_TLS_1_1 2 /* Min/max version is TLS/1.1 */ | |
184 | # define _HTTP_TLS_1_2 3 /* Min/max version is TLS/1.2 */ | |
185 | # define _HTTP_TLS_1_3 4 /* Min/max version is TLS/1.3 */ | |
186 | # define _HTTP_TLS_MAX 5 /* Highest known TLS version */ | |
187 | ||
eac3a0a0 | 188 | |
07ed0e9a MS |
189 | /* |
190 | * Types and functions for SSL support... | |
191 | */ | |
192 | ||
724e1819 | 193 | # ifdef HAVE_GNUTLS |
ef416fc2 | 194 | /* |
195 | * The GNU TLS library is more of a "bare metal" SSL/TLS library... | |
196 | */ | |
ef416fc2 | 197 | |
dd332638 | 198 | typedef gnutls_session_t http_tls_t; |
172bdf5d | 199 | typedef gnutls_certificate_credentials_t *http_tls_credentials_t; |
ef416fc2 | 200 | |
201 | # elif defined(HAVE_CDSASSL) | |
202 | /* | |
203 | * Darwin's Security framework provides its own SSL/TLS context structure | |
204 | * for its IO and protocol management... | |
205 | */ | |
206 | ||
07ed0e9a | 207 | # if !defined(HAVE_SECBASEPRIV_H) && defined(HAVE_CSSMERRORSTRING) /* Declare prototype for function in that header... */ |
7cf5915e | 208 | extern const char *cssmErrorString(int error); |
07ed0e9a | 209 | # endif /* !HAVE_SECBASEPRIV_H && HAVE_CSSMERRORSTRING */ |
07ed0e9a | 210 | # if !defined(HAVE_SECIDENTITYSEARCHPRIV_H) && defined(HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY) /* Declare prototype for function in that header... */ |
7cf5915e MS |
211 | extern OSStatus SecIdentitySearchCreateWithPolicy(SecPolicyRef policy, |
212 | CFStringRef idString, CSSM_KEYUSE keyUsage, | |
213 | CFTypeRef keychainOrArray, | |
214 | Boolean returnOnlyValidIdentities, | |
215 | SecIdentitySearchRef* searchRef); | |
07ed0e9a MS |
216 | # endif /* !HAVE_SECIDENTITYSEARCHPRIV_H && HAVE_SECIDENTITYSEARCHCREATEWITHPOLICY */ |
217 | # if !defined(HAVE_SECPOLICYPRIV_H) && defined(HAVE_SECPOLICYSETVALUE) /* Declare prototype for function in that header... */ | |
7cf5915e MS |
218 | extern OSStatus SecPolicySetValue(SecPolicyRef policyRef, |
219 | const CSSM_DATA *value); | |
07ed0e9a | 220 | # endif /* !HAVE_SECPOLICYPRIV_H && HAVE_SECPOLICYSETVALUE */ |
7cf5915e MS |
221 | |
222 | typedef SSLContextRef http_tls_t; | |
223 | typedef CFArrayRef http_tls_credentials_t; | |
ef416fc2 | 224 | |
cc754834 | 225 | # elif defined(HAVE_SSPISSL) |
07ed0e9a MS |
226 | /* |
227 | * Windows' SSPI library gets a CUPS wrapper... | |
228 | */ | |
229 | ||
2ece34a9 MS |
230 | typedef struct _http_sspi_s /**** SSPI/SSL data structure ****/ |
231 | { | |
232 | CredHandle creds; /* Credentials */ | |
233 | CtxtHandle context; /* SSL context */ | |
234 | BOOL contextInitialized; /* Is context init'd? */ | |
235 | SecPkgContext_StreamSizes streamSizes;/* SSL data stream sizes */ | |
236 | BYTE *decryptBuffer; /* Data pre-decryption*/ | |
237 | size_t decryptBufferLength; /* Length of decrypt buffer */ | |
238 | size_t decryptBufferUsed; /* Bytes used in buffer */ | |
239 | BYTE *readBuffer; /* Data post-decryption */ | |
240 | int readBufferLength; /* Length of read buffer */ | |
241 | int readBufferUsed; /* Bytes used in buffer */ | |
242 | BYTE *writeBuffer; /* Data pre-encryption */ | |
243 | int writeBufferLength; /* Length of write buffer */ | |
2ece34a9 MS |
244 | PCCERT_CONTEXT localCert, /* Local certificate */ |
245 | remoteCert; /* Remote (peer's) certificate */ | |
d777d26d | 246 | char error[256]; /* Most recent error message */ |
2ece34a9 MS |
247 | } _http_sspi_t; |
248 | typedef _http_sspi_t *http_tls_t; | |
17eecbf1 | 249 | typedef PCCERT_CONTEXT http_tls_credentials_t; |
07ed0e9a | 250 | |
7cf5915e | 251 | # else |
07ed0e9a MS |
252 | /* |
253 | * Otherwise define stub types since we have no SSL support... | |
254 | */ | |
255 | ||
7cf5915e | 256 | typedef void *http_tls_t; |
07ed0e9a | 257 | typedef void *http_tls_credentials_t; |
724e1819 | 258 | # endif /* HAVE_GNUTLS */ |
ef416fc2 | 259 | |
a469f8a5 MS |
260 | typedef enum _http_coding_e /**** HTTP content coding enumeration ****/ |
261 | { | |
262 | _HTTP_CODING_IDENTITY, /* No content coding */ | |
263 | _HTTP_CODING_GZIP, /* LZ77+gzip decompression */ | |
264 | _HTTP_CODING_DEFLATE, /* LZ77+zlib compression */ | |
265 | _HTTP_CODING_GUNZIP, /* LZ77+gzip decompression */ | |
266 | _HTTP_CODING_INFLATE /* LZ77+zlib decompression */ | |
267 | } _http_coding_t; | |
268 | ||
269 | typedef enum _http_mode_e /**** HTTP mode enumeration ****/ | |
270 | { | |
271 | _HTTP_MODE_CLIENT, /* Client connected to server */ | |
272 | _HTTP_MODE_SERVER /* Server connected (accepted) from client */ | |
273 | } _http_mode_t; | |
274 | ||
5ec1fd3d | 275 | # ifndef _HTTP_NO_PRIVATE |
a469f8a5 | 276 | struct _http_s /**** HTTP connection structure ****/ |
f7deaa1a | 277 | { |
278 | int fd; /* File descriptor for this socket */ | |
279 | int blocking; /* To block or not to block */ | |
280 | int error; /* Last error on read */ | |
281 | time_t activity; /* Time since last read/write */ | |
282 | http_state_t state; /* State of client */ | |
283 | http_status_t status; /* Status of last request */ | |
284 | http_version_t version; /* Protocol version */ | |
285 | http_keepalive_t keep_alive; /* Keep-alive supported? */ | |
85dda01c | 286 | struct sockaddr_in _hostaddr; /* Address of connected host (deprecated) */ |
f7deaa1a | 287 | char hostname[HTTP_MAX_HOST], |
288 | /* Name of connected host */ | |
378eeedf MS |
289 | _fields[HTTP_FIELD_ACCEPT_ENCODING][HTTP_MAX_VALUE]; |
290 | /* Field values up to Accept-Encoding (deprecated) */ | |
f7deaa1a | 291 | char *data; /* Pointer to data buffer */ |
292 | http_encoding_t data_encoding; /* Chunked or not */ | |
85dda01c | 293 | int _data_remaining;/* Number of bytes left (deprecated) */ |
f7deaa1a | 294 | int used; /* Number of bytes used in buffer */ |
295 | char buffer[HTTP_MAX_BUFFER]; | |
296 | /* Buffer for incoming data */ | |
5ec1fd3d | 297 | int _auth_type; /* Authentication in use (deprecated) */ |
7ec11630 | 298 | unsigned char _md5_state[88]; /* MD5 state (deprecated) */ |
f7deaa1a | 299 | char nonce[HTTP_MAX_VALUE]; |
300 | /* Nonce value */ | |
7ec11630 | 301 | unsigned nonce_count; /* Nonce count */ |
7cf5915e | 302 | http_tls_t tls; /* TLS state information */ |
f7deaa1a | 303 | http_encryption_t encryption; /* Encryption requirements */ |
a469f8a5 | 304 | |
f7deaa1a | 305 | /**** New in CUPS 1.1.19 ****/ |
85dda01c MS |
306 | fd_set *input_set; /* select() set for httpWait() (deprecated) */ |
307 | http_status_t expect; /* Expect: header */ | |
308 | char *cookie; /* Cookie value(s) */ | |
a469f8a5 | 309 | |
f7deaa1a | 310 | /**** New in CUPS 1.1.20 ****/ |
311 | char _authstring[HTTP_MAX_VALUE], | |
c1420c87 | 312 | /* Current Authorization value (deprecated) */ |
f7deaa1a | 313 | userpass[HTTP_MAX_VALUE]; |
85dda01c MS |
314 | /* Username:password string */ |
315 | int digest_tries; /* Number of tries for digest auth */ | |
a469f8a5 | 316 | |
f7deaa1a | 317 | /**** New in CUPS 1.2 ****/ |
85dda01c MS |
318 | off_t data_remaining; /* Number of bytes left */ |
319 | http_addr_t *hostaddr; /* Current host address and port */ | |
320 | http_addrlist_t *addrlist; /* List of valid addresses */ | |
f7deaa1a | 321 | char wbuffer[HTTP_MAX_BUFFER]; |
322 | /* Buffer for outgoing data */ | |
85dda01c | 323 | int wused; /* Write buffer bytes used */ |
a469f8a5 | 324 | |
f7deaa1a | 325 | /**** New in CUPS 1.3 ****/ |
c1420c87 | 326 | char *authstring; /* Current Authorization field */ |
f7deaa1a | 327 | # ifdef HAVE_GSSAPI |
85dda01c MS |
328 | gss_OID gssmech; /* Authentication mechanism */ |
329 | gss_ctx_id_t gssctx; /* Authentication context */ | |
330 | gss_name_t gssname; /* Authentication server name */ | |
f7deaa1a | 331 | # endif /* HAVE_GSSAPI */ |
b94498cf | 332 | # ifdef HAVE_AUTHORIZATION_H |
85dda01c | 333 | AuthorizationRef auth_ref; /* Authorization ref */ |
b94498cf | 334 | # endif /* HAVE_AUTHORIZATION_H */ |
a469f8a5 | 335 | |
7cf5915e MS |
336 | /**** New in CUPS 1.5 ****/ |
337 | http_tls_credentials_t tls_credentials; | |
85dda01c MS |
338 | /* TLS credentials */ |
339 | http_timeout_cb_t timeout_cb; /* Timeout callback */ | |
340 | void *timeout_data; /* User data pointer */ | |
341 | double timeout_value; /* Timeout in seconds */ | |
342 | int wait_value; /* httpWait value for timeout */ | |
eac3a0a0 MS |
343 | # ifdef HAVE_GSSAPI |
344 | char gsshost[256]; /* Hostname for Kerberos */ | |
345 | # endif /* HAVE_GSSAPI */ | |
a469f8a5 MS |
346 | |
347 | /**** New in CUPS 1.7 ****/ | |
cb7f98ee | 348 | int tls_upgrade; /* Non-zero if we are doing an upgrade */ |
a469f8a5 | 349 | _http_mode_t mode; /* _HTTP_MODE_CLIENT or _HTTP_MODE_SERVER */ |
a469f8a5 MS |
350 | # ifdef HAVE_LIBZ |
351 | _http_coding_t coding; /* _HTTP_CODING_xxx */ | |
352 | z_stream stream; /* (De)compression stream */ | |
291e4727 | 353 | Bytef *sbuffer; /* (De)compression buffer */ |
a469f8a5 | 354 | # endif /* HAVE_LIBZ */ |
7ec11630 MS |
355 | |
356 | /**** New in CUPS 2.3 ****/ | |
378eeedf MS |
357 | char *fields[HTTP_FIELD_MAX], |
358 | /* Allocated field values */ | |
359 | *default_fields[HTTP_FIELD_MAX]; | |
360 | /* Default field values, if any */ | |
f7deaa1a | 361 | }; |
5ec1fd3d | 362 | # endif /* !_HTTP_NO_PRIVATE */ |
f7deaa1a | 363 | |
364 | ||
ef416fc2 | 365 | /* |
366 | * Some OS's don't have hstrerror(), most notably Solaris... | |
367 | */ | |
368 | ||
369 | # ifndef HAVE_HSTRERROR | |
370 | extern const char *_cups_hstrerror(int error); | |
371 | # define hstrerror _cups_hstrerror | |
ef416fc2 | 372 | # endif /* !HAVE_HSTRERROR */ |
373 | ||
89d46774 | 374 | |
375 | /* | |
376 | * Some OS's don't have getifaddrs() and freeifaddrs()... | |
377 | */ | |
378 | ||
07ed0e9a MS |
379 | # if !defined(WIN32) && !defined(HAVE_GETIFADDRS) |
380 | # ifdef ifa_dstaddr | |
381 | # undef ifa_dstaddr | |
382 | # endif /* ifa_dstaddr */ | |
383 | # ifndef ifr_netmask | |
384 | # define ifr_netmask ifr_addr | |
385 | # endif /* !ifr_netmask */ | |
89d46774 | 386 | |
387 | struct ifaddrs /**** Interface Structure ****/ | |
388 | { | |
389 | struct ifaddrs *ifa_next; /* Next interface in list */ | |
390 | char *ifa_name; /* Name of interface */ | |
391 | unsigned int ifa_flags; /* Flags (up, point-to-point, etc.) */ | |
392 | struct sockaddr *ifa_addr, /* Network address */ | |
f301802f | 393 | *ifa_netmask; /* Address mask */ |
394 | union | |
395 | { | |
396 | struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */ | |
397 | struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */ | |
398 | } ifa_ifu; | |
399 | ||
89d46774 | 400 | void *ifa_data; /* Interface statistics */ |
401 | }; | |
402 | ||
07ed0e9a MS |
403 | # ifndef ifa_broadaddr |
404 | # define ifa_broadaddr ifa_ifu.ifu_broadaddr | |
405 | # endif /* !ifa_broadaddr */ | |
406 | # ifndef ifa_dstaddr | |
407 | # define ifa_dstaddr ifa_ifu.ifu_dstaddr | |
408 | # endif /* !ifa_dstaddr */ | |
f301802f | 409 | |
a74454a7 | 410 | extern int _cups_getifaddrs(struct ifaddrs **addrs); |
07ed0e9a | 411 | # define getifaddrs _cups_getifaddrs |
a74454a7 | 412 | extern void _cups_freeifaddrs(struct ifaddrs *addrs); |
07ed0e9a MS |
413 | # define freeifaddrs _cups_freeifaddrs |
414 | # endif /* !WIN32 && !HAVE_GETIFADDRS */ | |
415 | ||
89d46774 | 416 | |
839a51c8 | 417 | /* |
1ff0402e | 418 | * Prototypes... |
839a51c8 MS |
419 | */ |
420 | ||
22c9029b | 421 | extern void _httpAddrSetPort(http_addr_t *addr, int port); |
85dda01c MS |
422 | extern http_tls_credentials_t |
423 | _httpCreateCredentials(cups_array_t *credentials); | |
1106b00e MS |
424 | extern char *_httpDecodeURI(char *dst, const char *src, |
425 | size_t dstsize); | |
6d2f911b | 426 | extern void _httpDisconnect(http_t *http); |
5eb9da71 MS |
427 | extern char *_httpEncodeURI(char *dst, const char *src, |
428 | size_t dstsize); | |
7cf5915e | 429 | extern void _httpFreeCredentials(http_tls_credentials_t credentials); |
5eb9da71 | 430 | extern const char *_httpResolveURI(const char *uri, char *resolved_uri, |
eac3a0a0 | 431 | size_t resolved_size, int options, |
07ed0e9a MS |
432 | int (*cb)(void *context), |
433 | void *context); | |
41e6c1f1 | 434 | extern const char *_httpStatus(cups_lang_t *lang, http_status_t status); |
25731360 MS |
435 | extern void _httpTLSInitialize(void); |
436 | extern size_t _httpTLSPending(http_t *http); | |
437 | extern int _httpTLSRead(http_t *http, char *buf, int len); | |
438 | extern int _httpTLSSetCredentials(http_t *http); | |
8f1fbdec | 439 | extern void _httpTLSSetOptions(int options, int min_version, int max_version); |
25731360 MS |
440 | extern int _httpTLSStart(http_t *http); |
441 | extern void _httpTLSStop(http_t *http); | |
442 | extern int _httpTLSWrite(http_t *http, const char *buf, int len); | |
e60ec91f | 443 | extern int _httpUpdate(http_t *http, http_status_t *status); |
38e73f87 | 444 | extern int _httpWait(http_t *http, int msec, int usessl); |
6d2f911b MS |
445 | |
446 | ||
07ed0e9a MS |
447 | /* |
448 | * C++ magic... | |
449 | */ | |
450 | ||
451 | # ifdef __cplusplus | |
452 | } | |
453 | # endif /* __cplusplus */ | |
454 | ||
ef416fc2 | 455 | #endif /* !_CUPS_HTTP_PRIVATE_H_ */ |