]>
git.saurik.com Git - apple/security.git/blob - Network/https-protocol.h
2 * Copyright (c) 2000-2001 Apple Computer, Inc. All Rights Reserved.
4 * The contents of this file constitute Original Code as defined in and are
5 * subject to the Apple Public Source License Version 1.2 (the 'License').
6 * You may not use this file except in compliance with the License. Please obtain
7 * a copy of the License at http://www.apple.com/publicsource and read it before
10 * This Original Code and all software distributed under the License are
11 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS
12 * OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT
13 * LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
14 * PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. Please see the License for the
15 * specific language governing rights and limitations under the License.
20 // https-protocol - SSL based HTTP
22 #ifndef _H_HTTPS_PROTOCOL
23 #define _H_HTTPS_PROTOCOL
25 #include "http-protocol.h"
26 #include <Security/securetransport++.h>
34 // The protocol object for https.
35 // This is heavily based on the HTTP protocol, which provides hooks to filter
36 // the I/O channels to implement the crypto. Refer to HTTP for all the protocol
39 class SecureHTTPProtocol
: public HTTPProtocol
{
40 class SecureHTTPTransfer
;
42 static const IPPort defaultHttpsPort
= 443;
44 SecureHTTPProtocol(Manager
&mgr
);
47 const char *name() const;
48 SecureHTTPTransfer
*makeTransfer(const Target
&target
, Operation operation
);
52 // Our persistent connection object
54 typedef SecureTransport
<Socket
> SSL
;
56 class SecureHTTPConnection
: public HTTPConnection
, protected SSL
{
58 SecureHTTPConnection(Protocol
&proto
, const HostTarget
&tgt
);
59 ~SecureHTTPConnection();
65 sslConnecting
, // awaiting transport level connection
66 sslStartup
, // just connected
67 sslHandshaking
, // SSL handshake proceeding
68 sslConnected
// SSL established, I/O possible
71 void transit(Event event
, char *input
, size_t inputLength
);
77 bool deferStartSSL
; // protocol break for sub-protocols
80 bool sslActive
; // using SSL for I/O
82 // override I/O methods for TransferEngine::Client
83 size_t read(void *data
, size_t length
);
84 size_t write(const void *data
, size_t length
);
90 // A generic Transfer object. All HTTP transfers are transactional (headers in, optional data in,
91 // headers out, optional data out), so there's no reason to distinguish subclasses.
93 class SecureHTTPTransfer
: public HTTPTransfer
{
95 SecureHTTPTransfer(Protocol
&proto
,
96 const Target
&tgt
, Operation operation
, IPPort defaultPort
);
104 } // end namespace Network
105 } // end namespace Security
108 #endif //_H_HTTPS_PROTOCOL