ObjFW
OFTLSHandshakeFailedException.h
1 /*
2  * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFException.h"
21 
22 #ifndef OF_HAVE_SOCKETS
23 # error No sockets available!
24 #endif
25 
26 #import "OFTLSStream.h"
27 
28 OF_ASSUME_NONNULL_BEGIN
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 extern int _OFTLSHandshakeFailedException_reference OF_VISIBILITY_HIDDEN;
34 #ifdef __cplusplus
35 }
36 #endif
37 
45 {
46  OFTLSStream *_stream;
47  OFString *_Nullable _host;
48  OFTLSStreamErrorCode _errorCode;
49  OF_RESERVE_IVARS(OFTLSHandshakeFailedException, 4)
50 }
51 
55 @property (readonly, nonatomic) OFTLSStream *stream;
56 
60 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *host;
61 
65 @property (readonly, nonatomic) OFTLSStreamErrorCode errorCode;
66 
75 + (instancetype)exceptionWithStream: (OFTLSStream *)stream
76  host: (nullable OFString *)host
77  errorCode: (OFTLSStreamErrorCode)errorCode;
78 
79 + (instancetype)exception OF_UNAVAILABLE;
80 
89 - (instancetype)initWithStream: (OFTLSStream *)stream
90  host: (nullable OFString *)host
91  errorCode: (OFTLSStreamErrorCode)errorCode
92  OF_DESIGNATED_INITIALIZER;
93 
94 - (instancetype)init OF_UNAVAILABLE;
95 @end
96 
97 OF_ASSUME_NONNULL_END
An exception indicating that a TLS handshake.
Definition: OFTLSHandshakeFailedException.h:44
A class that provides Transport Layer Security on top of a stream.
Definition: OFTLSStream.h:75
A class for handling strings.
Definition: OFString.h:142
OFTLSStreamErrorCode
An enum representing an error of an OFTLSStream.
Definition: OFTLSStream.h:32
The base class for all exceptions in ObjFW.
Definition: OFException.h:156