]>
Commit | Line | Data |
---|---|---|
ef416fc2 | 1 | /* |
f7faf1f5 | 2 | * "$Id: http-private.h 5504 2006-05-10 18:57:46Z mike $" |
ef416fc2 | 3 | * |
4 | * Private HTTP definitions for the Common UNIX Printing System (CUPS). | |
5 | * | |
6 | * Copyright 1997-2005 by Easy Software Products, all rights reserved. | |
7 | * | |
8 | * These coded instructions, statements, and computer programs are the | |
9 | * property of Easy Software Products and are protected by Federal | |
10 | * copyright law. Distribution and use rights are outlined in the file | |
11 | * "LICENSE.txt" which should have been included with this file. If this | |
12 | * file is missing or damaged please contact Easy Software Products | |
13 | * at: | |
14 | * | |
15 | * Attn: CUPS Licensing Information | |
16 | * Easy Software Products | |
17 | * 44141 Airport View Drive, Suite 204 | |
18 | * Hollywood, Maryland 20636 USA | |
19 | * | |
20 | * Voice: (301) 373-9600 | |
21 | * EMail: cups-info@cups.org | |
22 | * WWW: http://www.cups.org | |
23 | * | |
24 | * This file is subject to the Apple OS-Developed Software exception. | |
25 | */ | |
26 | ||
27 | #ifndef _CUPS_HTTP_PRIVATE_H_ | |
28 | # define _CUPS_HTTP_PRIVATE_H_ | |
29 | ||
30 | /* | |
31 | * Include necessary headers... | |
32 | */ | |
33 | ||
a74454a7 | 34 | # include <stdlib.h> |
35 | # include <config.h> | |
ef416fc2 | 36 | |
37 | # ifdef __sun | |
38 | /* | |
39 | * Define FD_SETSIZE to CUPS_MAX_FDS on Solaris to get the correct version of | |
40 | * select() for large numbers of file descriptors. | |
41 | */ | |
42 | ||
43 | # define FD_SETSIZE CUPS_MAX_FDS | |
44 | # include <sys/select.h> | |
45 | # endif /* __sun */ | |
46 | ||
47 | # include <limits.h> | |
48 | # ifdef WIN32 | |
49 | # include <io.h> | |
50 | # include <winsock2.h> | |
51 | # else | |
52 | # include <unistd.h> | |
53 | # include <fcntl.h> | |
54 | # include <sys/socket.h> | |
55 | # define closesocket(f) close(f) | |
56 | # endif /* WIN32 */ | |
57 | ||
4400e98d | 58 | # if defined(__sgi) || (defined(__APPLE__) && !defined(_SOCKLEN_T)) |
ef416fc2 | 59 | /* |
4400e98d | 60 | * IRIX and MacOS X 10.2.x do not define socklen_t, and in fact use an int instead of |
ef416fc2 | 61 | * unsigned type for length values... |
62 | */ | |
63 | ||
64 | typedef int socklen_t; | |
4400e98d | 65 | # endif /* __sgi || (__APPLE__ && !_SOCKLEN_T) */ |
ef416fc2 | 66 | |
67 | # include "http.h" | |
fa73b229 | 68 | # include "ipp-private.h" |
ef416fc2 | 69 | |
70 | # if defined HAVE_LIBSSL | |
71 | /* | |
72 | * The OpenSSL library provides its own SSL/TLS context structure for its | |
73 | * IO and protocol management... | |
74 | */ | |
75 | ||
76 | # include <openssl/err.h> | |
77 | # include <openssl/rand.h> | |
78 | # include <openssl/ssl.h> | |
79 | ||
80 | typedef SSL http_tls_t; | |
81 | ||
82 | # elif defined HAVE_GNUTLS | |
83 | /* | |
84 | * The GNU TLS library is more of a "bare metal" SSL/TLS library... | |
85 | */ | |
86 | # include <gnutls/gnutls.h> | |
87 | ||
88 | typedef struct | |
89 | { | |
90 | gnutls_session session; /* GNU TLS session object */ | |
91 | void *credentials; /* GNU TLS credentials object */ | |
92 | } http_tls_t; | |
93 | ||
94 | # elif defined(HAVE_CDSASSL) | |
95 | /* | |
96 | * Darwin's Security framework provides its own SSL/TLS context structure | |
97 | * for its IO and protocol management... | |
98 | */ | |
99 | ||
100 | # include <Security/SecureTransport.h> | |
101 | ||
89d46774 | 102 | typedef struct /**** CDSA connection information ****/ |
103 | { | |
104 | SSLContextRef session; /* CDSA session object */ | |
105 | CFArrayRef certsArray; /* Certificates array */ | |
106 | } http_tls_t; | |
ef416fc2 | 107 | |
e53920b9 | 108 | typedef union _cdsa_conn_ref_u /**** CDSA Connection reference union |
109 | **** used to resolve 64-bit casting | |
110 | **** warnings. | |
111 | ****/ | |
112 | { | |
113 | SSLConnectionRef connection; /* SSL connection pointer */ | |
114 | int sock; /* Socket */ | |
115 | } cdsa_conn_ref_t; | |
116 | ||
ef416fc2 | 117 | extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data, |
118 | size_t *dataLength); | |
119 | extern OSStatus _httpWriteCDSA(SSLConnectionRef connection, const void *data, | |
120 | size_t *dataLength); | |
121 | # endif /* HAVE_LIBSSL */ | |
122 | ||
123 | /* | |
124 | * Some OS's don't have hstrerror(), most notably Solaris... | |
125 | */ | |
126 | ||
127 | # ifndef HAVE_HSTRERROR | |
128 | extern const char *_cups_hstrerror(int error); | |
129 | # define hstrerror _cups_hstrerror | |
130 | # elif defined(_AIX) || defined(__osf__) | |
131 | /* | |
132 | * AIX and Tru64 UNIX don't provide a prototype but do provide the function... | |
133 | */ | |
134 | extern const char *hstrerror(int error); | |
135 | # endif /* !HAVE_HSTRERROR */ | |
136 | ||
89d46774 | 137 | |
138 | /* | |
139 | * Some OS's don't have getifaddrs() and freeifaddrs()... | |
140 | */ | |
141 | ||
142 | # include <net/if.h> | |
143 | # ifdef HAVE_GETIFADDRS | |
144 | # include <ifaddrs.h> | |
145 | # else | |
146 | # include <sys/ioctl.h> | |
147 | # ifdef HAVE_SYS_SOCKIO_H | |
148 | # include <sys/sockio.h> | |
149 | # endif /* HAVE_SYS_SOCKIO_H */ | |
150 | ||
151 | # ifdef ifa_dstaddr | |
152 | # undef ifa_dstaddr | |
153 | # endif /* ifa_dstaddr */ | |
154 | # ifndef ifr_netmask | |
155 | # define ifr_netmask ifr_addr | |
156 | # endif /* !ifr_netmask */ | |
157 | ||
158 | struct ifaddrs /**** Interface Structure ****/ | |
159 | { | |
160 | struct ifaddrs *ifa_next; /* Next interface in list */ | |
161 | char *ifa_name; /* Name of interface */ | |
162 | unsigned int ifa_flags; /* Flags (up, point-to-point, etc.) */ | |
163 | struct sockaddr *ifa_addr, /* Network address */ | |
f301802f | 164 | *ifa_netmask; /* Address mask */ |
165 | union | |
166 | { | |
167 | struct sockaddr *ifu_broadaddr; /* Broadcast address of this interface. */ | |
168 | struct sockaddr *ifu_dstaddr; /* Point-to-point destination address. */ | |
169 | } ifa_ifu; | |
170 | ||
89d46774 | 171 | void *ifa_data; /* Interface statistics */ |
172 | }; | |
173 | ||
f301802f | 174 | # ifndef ifa_broadaddr |
175 | # define ifa_broadaddr ifa_ifu.ifu_broadaddr | |
176 | # endif /* !ifa_broadaddr */ | |
177 | # ifndef ifa_dstaddr | |
178 | # define ifa_dstaddr ifa_ifu.ifu_dstaddr | |
179 | # endif /* !ifa_dstaddr */ | |
180 | ||
a74454a7 | 181 | extern int _cups_getifaddrs(struct ifaddrs **addrs); |
89d46774 | 182 | # define getifaddrs _cups_getifaddrs |
a74454a7 | 183 | extern void _cups_freeifaddrs(struct ifaddrs *addrs); |
89d46774 | 184 | # define freeifaddrs _cups_freeifaddrs |
185 | # endif /* HAVE_GETIFADDRS */ | |
186 | ||
ef416fc2 | 187 | #endif /* !_CUPS_HTTP_PRIVATE_H_ */ |
188 | ||
189 | /* | |
f7faf1f5 | 190 | * End of "$Id: http-private.h 5504 2006-05-10 18:57:46Z mike $". |
ef416fc2 | 191 | */ |