ObjFW
Loading...
Searching...
No Matches
OFTLSStream.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2008-2024 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
19OF_ASSUME_NONNULL_BEGIN
20
23@class OFTLSStream;
24
34
40@protocol OFTLSStreamDelegate <OFStreamDelegate>
50- (void)stream: (OFTLSStream *)stream
51 didPerformClientHandshakeWithHost: (OFString *)host
52 exception: (nullable id)exception;
53@end
54
74{
75 OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving>
76 *_underlyingStream;
77 bool _verifiesCertificates;
78 OF_RESERVE_IVARS(OFTLSStream, 4)
79}
80
84@property (readonly, nonatomic) OFStream <OFReadyForReadingObserving,
85 OFReadyForWritingObserving> *underlyingStream;
93@property OF_NULLABLE_PROPERTY (assign, nonatomic)
94 id <OFTLSStreamDelegate> delegate;
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,
123 OFReadyForWritingObserving> *)stream
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
159extern "C" {
160#endif
168extern Class OFTLSStreamImplementation;
169
177 OFTLSStreamErrorCode errorCode);
178#ifdef __cplusplus
179}
180#endif
181
182OF_ASSUME_NONNULL_END
OFTLSStreamErrorCode
An enum representing an error of an OFTLSStream.
Definition OFTLSStream.h:28
@ OFTLSStreamErrorCodeInitializationFailed
Initialization of the TLS context failed.
Definition OFTLSStream.h:32
@ OFTLSStreamErrorCodeUnknown
An unknown error.
Definition OFTLSStream.h:30
OFString * OFTLSStreamErrorCodeDescription(OFTLSStreamErrorCode errorCode)
Returns a string description for the TLS stream error code.
Definition OFTLSStream.m:48
Class OFTLSStreamImplementation
The implementation for OFTLSStream to use.
Definition OFTLSStream.m:33
A class for storing constant strings using the @"" literal.
Definition OFConstantString.h:38
A base class for different types of streams.
Definition OFStream.h:188
A class for handling strings.
Definition OFString.h:135
A class that provides Transport Layer Security on top of a stream.
Definition OFTLSStream.h:75
This protocol is implemented by classes which can be observed for readiness for reading by OFKernelEv...
Definition OFKernelEventObserver.h:84
This protocol is implemented by classes which can be observed for readiness for writing by OFKernelEv...
Definition OFKernelEventObserver.h:99