ObjFW
OFBindFailedException.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  /* IP */
36  OFString *_host;
37  uint16_t _port;
38  /* IPX */
39  uint8_t _packetType;
40  int _errNo;
41 }
42 
46 @property (readonly, nonatomic) OFString *host;
47 
51 @property (readonly, nonatomic) uint16_t port;
52 
56 @property (readonly, nonatomic) uint8_t packetType;
57 
61 @property (readonly, nonatomic) id socket;
62 
66 @property (readonly, nonatomic) int errNo;
67 
68 + (instancetype)exception OF_UNAVAILABLE;
69 
79 + (instancetype)exceptionWithHost: (OFString *)host
80  port: (uint16_t)port
81  socket: (id)socket
82  errNo: (int)errNo;
83 
93 + (instancetype)exceptionWithPort: (uint16_t)port
94  packetType: (uint8_t)packetType
95  socket: (id)socket
96  errNo: (int)errNo;
97 
98 - (instancetype)init OF_UNAVAILABLE;
99 
109 - (instancetype)initWithHost: (OFString *)host
110  port: (uint16_t)port
111  socket: (id)socket
112  errNo: (int)errNo;
113 
123 - (instancetype)initWithPort: (uint16_t)port
124  packetType: (uint8_t)packetType
125  socket: (id)socket
126  errNo: (int)errNo;
127 @end
128 
129 OF_ASSUME_NONNULL_END
An exception indicating that binding a socket failed.
Definition: OFBindFailedException.h:33
The base class for all exceptions in ObjFW.
Definition: OFException.h:147
A class for handling strings.
Definition: OFString.h:132