ObjFW
OFTLSStream.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFStream.h"
17 #import "OFRunLoop.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
23 @class OFTLSStream;
24 
28 typedef enum {
34 
50 - (void)stream: (OFTLSStream *)stream
51  didPerformClientHandshakeWithHost: (OFString *)host
52  exception: (nullable id)exception;
53 @end
54 
74 {
76  *_underlyingStream;
77  bool _verifiesCertificates;
78  OF_RESERVE_IVARS(OFTLSStream, 4)
79 }
80 
84 @property (readonly, nonatomic) OFStream <OFReadyForReadingObserving,
85  OFReadyForWritingObserving> *underlyingStream;
86 
93 @property OF_NULLABLE_PROPERTY (assign, nonatomic)
94  id <OFTLSStreamDelegate> delegate;
95 
99 @property (nonatomic) bool verifiesCertificates;
101 - (instancetype)init OF_UNAVAILABLE;
102 
111 + (instancetype)streamWithStream: (OFStream <OFReadyForReadingObserving,
112  OFReadyForWritingObserving> *)stream;
113 
122 - (instancetype)initWithStream: (OFStream <OFReadyForReadingObserving,
124  OF_DESIGNATED_INITIALIZER;
125 
134 - (void)asyncPerformClientHandshakeWithHost: (OFString *)host;
135 
145 - (void)asyncPerformClientHandshakeWithHost: (OFString *)host
146  runLoopMode: (OFRunLoopMode)runLoopMode;
147 
155 - (void)performClientHandshakeWithHost: (OFString *)host;
156 @end
157 
158 #ifdef __cplusplus
159 extern "C" {
160 #endif
161 
168 extern Class OFTLSStreamImplementation;
169 
177  OFTLSStreamErrorCode errorCode);
178 #ifdef __cplusplus
179 }
180 #endif
181 
182 OF_ASSUME_NONNULL_END
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:37
A class that provides Transport Layer Security on top of a stream.
Definition: OFTLSStream.h:72
An unknown error.
Definition: OFTLSStream.h:30
A base class for different types of streams.
Definition: OFStream.h:186
A class for handling strings.
Definition: OFString.h:134
OFString * OFTLSStreamErrorCodeDescription(OFTLSStreamErrorCode errorCode)
Returns a string description for the TLS stream error code.
Definition: OFTLSStream.m:48
OFTLSStreamErrorCode
An enum representing an error of an OFTLSStream.
Definition: OFTLSStream.h:28
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Initialization of the TLS context failed.
Definition: OFTLSStream.h:32
Class OFTLSStreamImplementation
The implementation for OFTLSStream to use.
Definition: OFTLSStream.m:33