ObjFW
OFConnectionFailedException.h
1 /*
2  * Copyright (c) 2008-2021 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 "socket.h"
23 
24 OF_ASSUME_NONNULL_BEGIN
25 
33 {
34  id _socket;
35  OFString *_host;
36  uint16_t _port;
37  unsigned char _node[IPX_NODE_LEN];
38  uint32_t _network;
39  int _errNo;
40 }
41 
45 @property (readonly, nonatomic) id socket;
46 
50 @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *host;
51 
55 @property (readonly, nonatomic) uint16_t port;
56 
60 @property (readonly, nonatomic) unsigned char *node;
61 
65 @property (readonly, nonatomic) uint32_t network;
66 
70 @property (readonly, nonatomic) int errNo;
71 
72 + (instancetype)exception OF_UNAVAILABLE;
73 
83 + (instancetype)exceptionWithHost: (nullable OFString *)host
84  port: (uint16_t)port
85  socket: (id)socket
86  errNo: (int)errNo;
87 
98 + (instancetype)exceptionWithNode: (unsigned char [_Nullable IPX_NODE_LEN])node
99  network: (uint32_t)network
100  port: (uint16_t)port
101  socket: (id)socket
102  errNo: (int)errNo;
103 
104 - (instancetype)init OF_UNAVAILABLE;
105 
115 - (instancetype)initWithHost: (nullable OFString *)host
116  port: (uint16_t)port
117  socket: (id)socket
118  errNo: (int)errNo;
119 
130 - (instancetype)initWithNode: (unsigned char [_Nullable IPX_NODE_LEN])node
131  network: (uint32_t)network
132  port: (uint16_t)port
133  socket: (id)socket
134  errNo: (int)errNo;
135 @end
136 
137 OF_ASSUME_NONNULL_END
An exception indicating that a connection could not be established.
Definition: OFConnectionFailedException.h:33
OFString * host
The host to which the connection failed.
Definition: OFConnectionFailedException.h:50
The base class for all exceptions in ObjFW.
Definition: OFException.h:147
A class for handling strings.
Definition: OFString.h:132