57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
-
-
+
+
+
-
-
-
-
-
+
+
+
|
*
* @brief A class that provides Transport Layer Security on top of a stream.
*
* This class is a class cluster and returns a suitable OFTLSStream subclass,
* if available.
*
* Subclasses need to override @ref lowlevelReadIntoBuffer:length:,
* @ref lowlevelWriteBuffer:length: and
* @ref asyncPerformClientHandshakeWithHost:runLoopMode:. The method
* @ref lowlevelWriteBuffer:length:,
* @ref lowlevelHasDataInReadBuffer and
* @ref asyncPerformClientHandshakeWithHost:runLoopMode:.
* @ref hasDataInReadBuffer should be overridden to return `true` if the TLS
* stream has cached unprocessed data internally, while returning
* `self.underlyingStream.hasDataInReadBuffer` if it does not have any
* unprocessed data. In order to get access to the underlying stream,
* @ref underlyingStream can be used.
*
* In order to get access to the underlying stream, @ref underlyingStream can
* be used.
*/
@interface OFTLSStream: OFStream <OFReadyForReadingObserving,
OFReadyForWritingObserving>
{
OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving>
*_underlyingStream;
bool _verifiesCertificates;
|
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
|
-
+
+
+
+
-
+
-
+
-
+
-
+
|
* stream.
*
* @param stream The stream to use as underlying stream. Must not be closed
* before the TLS stream is closed.
* @return A new, autoreleased TLS stream
*/
+ (instancetype)streamWithStream: (OFStream <OFReadyForReadingObserving,
OFReadyForWritingObserving> *)stream;
OFReadyForWritingObserving> *)stream;
/**
* @brief Initializes the TLS stream with the specified stream as its
* underlying stream.
*
* @note The delegate of the specified stream will be changed to the TLS
* stream. You must not change this before the TLS session is completed.
*
* @param stream The stream to use as underlying stream. Must not be closed
* before the TLS stream is closed.
* @return An initialized TLS stream
*/
- (instancetype)initWithStream: (OFStream <OFReadyForReadingObserving,
OFReadyForWritingObserving> *)stream
OFReadyForWritingObserving> *)stream
OF_DESIGNATED_INITIALIZER;
/**
* @brief Asynchronously performs the TLS client handshake for the specified
* host and calls the delegate afterwards.
*
* @param host The host to perform the handshake with
* @throw OFTLSHandshakeFailedException The TLS handshake failed
* @throw OFAlreadyConnectedException The handshake was already performed
* @throw OFAlreadyOpenException The handshake was already performed
*/
- (void)asyncPerformClientHandshakeWithHost: (OFString *)host;
/**
* @brief Asynchronously performs the TLS client handshake for the specified
* host and calls the delegate afterwards.
*
* @param host The host to perform the handshake with
* @param runLoopMode The run loop mode in which to perform the async handshake
* @throw OFTLSHandshakeFailedException The TLS handshake failed
* @throw OFAlreadyConnectedException The handshake was already performed
* @throw OFAlreadyOpenException The handshake was already performed
*/
- (void)asyncPerformClientHandshakeWithHost: (OFString *)host
runLoopMode: (OFRunLoopMode)runLoopMode;
/**
* @brief Performs the TLS client handshake for the specified host.
*
* @param host The host to perform the handshake with
* @throw OFTLSHandshakeFailedException The TLS handshake failed
* @throw OFAlreadyConnectedException The handshake was already performed
* @throw OFAlreadyOpenException The handshake was already performed
*/
- (void)performClientHandshakeWithHost: (OFString *)host;
@end
#ifdef __cplusplus
extern "C" {
#endif
|