ObjFW
OFTLSHandshakeFailedException.h
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 "OFException.h"
17 
18 #ifndef OF_HAVE_SOCKETS
19 # error No sockets available!
20 #endif
21 
22 #import "OFTLSStream.h"
23 
24 OF_ASSUME_NONNULL_BEGIN
25 
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29 extern int _OFTLSHandshakeFailedException_reference;
30 #ifdef __cplusplus
31 }
32 #endif
33 
41 {
42  OFTLSStream *_stream;
43  OFString *_Nullable _host;
44  OFTLSStreamErrorCode _errorCode;
45  OF_RESERVE_IVARS(OFTLSHandshakeFailedException, 4)
46 }
47 
51 @property (readonly, nonatomic) OFTLSStream *stream;
52 
56 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *host;
57 
61 @property (readonly, nonatomic) OFTLSStreamErrorCode errorCode;
62 
71 + (instancetype)exceptionWithStream: (OFTLSStream *)stream
72  host: (nullable OFString *)host
73  errorCode: (OFTLSStreamErrorCode)errorCode;
74 
75 + (instancetype)exception OF_UNAVAILABLE;
76 
85 - (instancetype)initWithStream: (OFTLSStream *)stream
86  host: (nullable OFString *)host
87  errorCode: (OFTLSStreamErrorCode)errorCode
88  OF_DESIGNATED_INITIALIZER;
89 
90 - (instancetype)init OF_UNAVAILABLE;
91 @end
92 
93 OF_ASSUME_NONNULL_END
OFString * host
The host for the handshake.
Definition: OFTLSHandshakeFailedException.h:56
An exception indicating that a TLS handshake.
Definition: OFTLSHandshakeFailedException.h:40
A class that provides Transport Layer Security on top of a stream.
Definition: OFTLSStream.h:72
A class for handling strings.
Definition: OFString.h:134
OFTLSStreamErrorCode
An enum representing an error of an OFTLSStream.
Definition: OFTLSStream.h:28
The base class for all exceptions in ObjFW.
Definition: OFException.h:150