]>
git.saurik.com Git - apple/security.git/blob - Network/https-protocol.h
a0fcce832de6ef25e9399ac30db9947bc461fb9e
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
{
41 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
;
57 class SecureHTTPConnection
: public HTTPConnection
, protected SSL
{
59 SecureHTTPConnection(Protocol
&proto
, const HostTarget
&tgt
);
60 ~SecureHTTPConnection();
66 sslConnecting
, // awaiting transport level connection
67 sslStartup
, // just connected
68 sslHandshaking
, // SSL handshake proceeding
69 sslConnected
// SSL established, I/O possible
72 void transit(Event event
, char *input
, size_t inputLength
);
78 bool deferStartSSL
; // protocol break for sub-protocols
81 bool sslActive
; // using SSL for I/O
83 // override I/O methods for TransferEngine::Client
84 size_t read(void *data
, size_t length
);
85 size_t write(const void *data
, size_t length
);
91 // A generic Transfer object. All HTTP transfers are transactional (headers in, optional data in,
92 // headers out, optional data out), so there's no reason to distinguish subclasses.
94 class SecureHTTPTransfer
: public HTTPTransfer
{
96 SecureHTTPTransfer(Protocol
&proto
,
97 const Target
&tgt
, Operation operation
, IPPort defaultPort
);
105 } // end namespace Network
106 } // end namespace Security
109 #endif //_H_HTTPS_PROTOCOL