]> git.ipfire.org Git - thirdparty/cups.git/blame - cups/http-private.h
Load cups into easysw/current.
[thirdparty/cups.git] / cups / http-private.h
CommitLineData
ef416fc2 1/*
89d46774 2 * "$Id: http-private.h 5428 2006-04-18 20:45:30Z 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
34# include "config.h"
35
36# ifdef __sun
37/*
38 * Define FD_SETSIZE to CUPS_MAX_FDS on Solaris to get the correct version of
39 * select() for large numbers of file descriptors.
40 */
41
42# define FD_SETSIZE CUPS_MAX_FDS
43# include <sys/select.h>
44# endif /* __sun */
45
46# include <limits.h>
47# ifdef WIN32
48# include <io.h>
49# include <winsock2.h>
50# else
51# include <unistd.h>
52# include <fcntl.h>
53# include <sys/socket.h>
54# define closesocket(f) close(f)
55# endif /* WIN32 */
56
4400e98d 57# if defined(__sgi) || (defined(__APPLE__) && !defined(_SOCKLEN_T))
ef416fc2 58/*
4400e98d 59 * IRIX and MacOS X 10.2.x do not define socklen_t, and in fact use an int instead of
ef416fc2 60 * unsigned type for length values...
61 */
62
63typedef int socklen_t;
4400e98d 64# endif /* __sgi || (__APPLE__ && !_SOCKLEN_T) */
ef416fc2 65
66# include "http.h"
fa73b229 67# include "ipp-private.h"
ef416fc2 68
69# if defined HAVE_LIBSSL
70/*
71 * The OpenSSL library provides its own SSL/TLS context structure for its
72 * IO and protocol management...
73 */
74
75# include <openssl/err.h>
76# include <openssl/rand.h>
77# include <openssl/ssl.h>
78
79typedef SSL http_tls_t;
80
81# elif defined HAVE_GNUTLS
82/*
83 * The GNU TLS library is more of a "bare metal" SSL/TLS library...
84 */
85# include <gnutls/gnutls.h>
86
87typedef struct
88{
89 gnutls_session session; /* GNU TLS session object */
90 void *credentials; /* GNU TLS credentials object */
91} http_tls_t;
92
93# elif defined(HAVE_CDSASSL)
94/*
95 * Darwin's Security framework provides its own SSL/TLS context structure
96 * for its IO and protocol management...
97 */
98
99# include <Security/SecureTransport.h>
100
89d46774 101typedef struct /**** CDSA connection information ****/
102{
103 SSLContextRef session; /* CDSA session object */
104 CFArrayRef certsArray; /* Certificates array */
105} http_tls_t;
ef416fc2 106
e53920b9 107typedef union _cdsa_conn_ref_u /**** CDSA Connection reference union
108 **** used to resolve 64-bit casting
109 **** warnings.
110 ****/
111{
112 SSLConnectionRef connection; /* SSL connection pointer */
113 int sock; /* Socket */
114} cdsa_conn_ref_t;
115
ef416fc2 116extern OSStatus _httpReadCDSA(SSLConnectionRef connection, void *data,
117 size_t *dataLength);
118extern OSStatus _httpWriteCDSA(SSLConnectionRef connection, const void *data,
119 size_t *dataLength);
120# endif /* HAVE_LIBSSL */
121
122/*
123 * Some OS's don't have hstrerror(), most notably Solaris...
124 */
125
126# ifndef HAVE_HSTRERROR
127extern const char *_cups_hstrerror(int error);
128# define hstrerror _cups_hstrerror
129# elif defined(_AIX) || defined(__osf__)
130/*
131 * AIX and Tru64 UNIX don't provide a prototype but do provide the function...
132 */
133extern const char *hstrerror(int error);
134# endif /* !HAVE_HSTRERROR */
135
89d46774 136
137/*
138 * Some OS's don't have getifaddrs() and freeifaddrs()...
139 */
140
141# include <net/if.h>
142# ifdef HAVE_GETIFADDRS
143# include <ifaddrs.h>
144# else
145# include <sys/ioctl.h>
146# ifdef HAVE_SYS_SOCKIO_H
147# include <sys/sockio.h>
148# endif /* HAVE_SYS_SOCKIO_H */
149
150# ifdef ifa_dstaddr
151# undef ifa_dstaddr
152# endif /* ifa_dstaddr */
153# ifndef ifr_netmask
154# define ifr_netmask ifr_addr
155# endif /* !ifr_netmask */
156
157struct ifaddrs /**** Interface Structure ****/
158{
159 struct ifaddrs *ifa_next; /* Next interface in list */
160 char *ifa_name; /* Name of interface */
161 unsigned int ifa_flags; /* Flags (up, point-to-point, etc.) */
162 struct sockaddr *ifa_addr, /* Network address */
163 *ifa_netmask, /* Address mask */
164 *ifa_dstaddr; /* Broadcast or destination address */
165 void *ifa_data; /* Interface statistics */
166};
167
168static int _cups_getifaddrs(struct ifaddrs **addrs);
169# define getifaddrs _cups_getifaddrs
170static void _cups_freeifaddrs(struct ifaddrs *addrs);
171# define freeifaddrs _cups_freeifaddrs
172# endif /* HAVE_GETIFADDRS */
173
ef416fc2 174#endif /* !_CUPS_HTTP_PRIVATE_H_ */
175
176/*
89d46774 177 * End of "$Id: http-private.h 5428 2006-04-18 20:45:30Z mike $".
ef416fc2 178 */