Comment: | Split OFConnectSocketFailedException in subclasses |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
179b60bfb408c08914c9713af6a56ffe |
User & Date: | js on 2022-10-22 17:29:39 |
Other Links: | manifest | tags |
2022-10-22
| ||
17:40 | Rename OFListen{ -> OnSocket}FailedException check-in: df7f59b26c user: js tags: trunk | |
17:29 | Split OFConnectSocketFailedException in subclasses check-in: 179b60bfb4 user: js tags: trunk | |
16:53 | Rename OFAccept{ -> Socket}FailedException check-in: e171cfe7e5 user: js tags: trunk | |
Modified src/OFIPSocketAsyncConnector.m from [964b049ea4] to [11edaa9dd3].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #import "OFIPSocketAsyncConnector.h" #import "OFData.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFTimer.h" | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #import "OFIPSocketAsyncConnector.h" #import "OFData.h" #import "OFTCPSocket.h" #import "OFThread.h" #import "OFTimer.h" #import "OFConnectIPSocketFailedException.h" #import "OFInvalidFormatException.h" @implementation OFIPSocketAsyncConnector - (instancetype)initWithSocket: (id)sock host: (OFString *)host port: (uint16_t)port delegate: (id)delegate |
︙ | ︙ | |||
122 123 124 125 126 127 128 | } [self didConnect]; } - (id)of_connectionFailedExceptionForErrNo: (int)errNo { | | | | | | | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | } [self didConnect]; } - (id)of_connectionFailedExceptionForErrNo: (int)errNo { return [OFConnectIPSocketFailedException exceptionWithHost: _host port: _port socket: _socket errNo: errNo]; } - (void)tryNextAddressWithRunLoopMode: (OFRunLoopMode)runLoopMode { OFSocketAddress address = *(const OFSocketAddress *) [_socketAddresses itemAtIndex: _socketAddressesIndex++]; int errNo; OFSocketAddressSetPort(&address, _port); if (![_socket of_createSocketForAddress: &address errNo: &errNo]) { if (_socketAddressesIndex >= _socketAddresses.count) { _exception = [[OFConnectIPSocketFailedException alloc] initWithHost: _host port: _port socket: _socket errNo: errNo]; [self didConnect]; return; } |
︙ | ︙ | |||
183 184 185 186 187 188 189 | delegate: self]; return; } else { #endif [_socket of_closeSocket]; if (_socketAddressesIndex >= _socketAddresses.count) { | | | 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | delegate: self]; return; } else { #endif [_socket of_closeSocket]; if (_socketAddressesIndex >= _socketAddresses.count) { _exception = [[OFConnectIPSocketFailedException alloc] initWithHost: _host port: _port socket: _socket errNo: errNo]; [self didConnect]; return; } |
︙ | ︙ |
Modified src/OFSPXSocket.h from [7047954772] to [62171025db].
︙ | ︙ | |||
85 86 87 88 89 90 91 | /** * @brief Connect the OFSPXSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to | | | 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | /** * @brief Connect the OFSPXSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectSPXSocketFailedException Connecting failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (void)connectToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; /** |
︙ | ︙ |
Modified src/OFSPXSocket.m from [f57aab987d] to [4bb1b2f501].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyConnectedException.h" #import "OFBindIPXSocketFailedException.h" | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyConnectedException.h" #import "OFBindIPXSocketFailedException.h" #import "OFConnectSPXSocketFailedException.h" #import "OFNotOpenException.h" #ifndef NSPROTO_SPX # define NSPROTO_SPX 0 #endif static const uint8_t SPXPacketType = 5; |
︙ | ︙ | |||
162 163 164 165 166 167 168 | #ifdef OF_HAVE_BLOCKS } #endif } - (id)of_connectionFailedExceptionForErrNo: (int)errNo { | | | | | | | 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | #ifdef OF_HAVE_BLOCKS } #endif } - (id)of_connectionFailedExceptionForErrNo: (int)errNo { return [OFConnectSPXSocketFailedException exceptionWithNetwork: _network node: _node port: _port socket: _socket errNo: errNo]; } @end @implementation OFSPXSocket @dynamic delegate; - (int)of_createSocketForAddress: (const OFSocketAddress *)address |
︙ | ︙ | |||
227 228 229 230 231 232 233 | node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port { OFSocketAddress address = OFSocketAddressMakeIPX(network, node, port); int errNo; if (![self of_createSocketForAddress: &address errNo: &errNo]) | | | | 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port { OFSocketAddress address = OFSocketAddressMakeIPX(network, node, port); int errNo; if (![self of_createSocketForAddress: &address errNo: &errNo]) @throw [OFConnectSPXSocketFailedException exceptionWithNetwork: network node: node port: port socket: self errNo: errNo]; if (![self of_connectSocketToAddress: &address errNo: &errNo]) { [self of_closeSocket]; @throw [OFConnectSPXSocketFailedException exceptionWithNetwork: network node: node port: port socket: self errNo: errNo]; } } |
︙ | ︙ |
Modified src/OFSPXStreamSocket.h from [5118ed386d] to [454aa9fc7f].
︙ | ︙ | |||
86 87 88 89 90 91 92 | /** * @brief Connect the OFSPXStreamSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to | | | 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | /** * @brief Connect the OFSPXStreamSocket to the specified destination. * * @param network The network on which the node to connect to is * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectSPXSocketFailedException Connecting failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (void)connectToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; /** |
︙ | ︙ | |||
164 165 166 167 168 169 170 | * * @param network The IPX network to bind to. 0 means the current network. * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @return The address on which this socket can be reached | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | * * @param network The IPX network to bind to. 0 means the current network. * @param node The IPX network to bind to. An all zero node means the * computer's node. * @param port The port (sometimes called socket number) to bind to. 0 means to * pick one and return via the returned socket address. * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (OFSocketAddress) bindToNetwork: (uint32_t)network node: (const unsigned char [_Nonnull IPX_NODE_LEN])node port: (uint16_t)port; @end OF_ASSUME_NONNULL_END |
Modified src/OFSPXStreamSocket.m from [0a64a8186a] to [3d76de2dbb].
︙ | ︙ | |||
21 22 23 24 25 26 27 | #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyConnectedException.h" #import "OFBindIPXSocketFailedException.h" | | | 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | #import "OFRunLoop.h" #import "OFRunLoop+Private.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFAlreadyConnectedException.h" #import "OFBindIPXSocketFailedException.h" #import "OFConnectSPXSocketFailedException.h" #import "OFNotOpenException.h" #ifndef NSPROTO_SPX # define NSPROTO_SPX 0 #endif static const uint8_t SPXPacketType = 5; |
︙ | ︙ | |||
164 165 166 167 168 169 170 | #ifdef OF_HAVE_BLOCKS } #endif } - (id)of_connectionFailedExceptionForErrNo: (int)errNo { | | | | | | | 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | #ifdef OF_HAVE_BLOCKS } #endif } - (id)of_connectionFailedExceptionForErrNo: (int)errNo { return [OFConnectSPXSocketFailedException exceptionWithNetwork: _network node: _node port: _port socket: _socket errNo: errNo]; } @end @implementation OFSPXStreamSocket @dynamic delegate; - (int)of_createSocketForAddress: (const OFSocketAddress *)address |
︙ | ︙ | |||
229 230 231 232 233 234 235 | node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port { OFSocketAddress address = OFSocketAddressMakeIPX(network, node, port); int errNo; if (![self of_createSocketForAddress: &address errNo: &errNo]) | | | | 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port { OFSocketAddress address = OFSocketAddressMakeIPX(network, node, port); int errNo; if (![self of_createSocketForAddress: &address errNo: &errNo]) @throw [OFConnectSPXSocketFailedException exceptionWithNetwork: network node: node port: port socket: self errNo: errNo]; if (![self of_connectSocketToAddress: &address errNo: &errNo]) { [self of_closeSocket]; @throw [OFConnectSPXSocketFailedException exceptionWithNetwork: network node: node port: port socket: self errNo: errNo]; } } |
︙ | ︙ |
Modified src/OFTCPSocket.h from [cc82674b9e] to [522e53453c].
︙ | ︙ | |||
152 153 154 155 156 157 158 | + (uint16_t)SOCKS5Port; /** * @brief Connects the OFTCPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to | | | 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | + (uint16_t)SOCKS5Port; /** * @brief Connects the OFTCPSocket to the specified destination. * * @param host The host to connect to * @param port The port on the host to connect to * @throw OFConnectIPSocketFailedException Connecting failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (void)connectToHost: (OFString *)host port: (uint16_t)port; /** * @brief Asynchronously connects the OFTCPSocket to the specified destination. * |
︙ | ︙ |
Modified src/OFTCPSocketSOCKS5Connector.m from [5536c6da5c] to [f6cfb53e62].
︙ | ︙ | |||
19 20 21 22 23 24 25 | #include <errno.h> #import "OFTCPSocketSOCKS5Connector.h" #import "OFData.h" #import "OFRunLoop.h" #import "OFString.h" | | | 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #include <errno.h> #import "OFTCPSocketSOCKS5Connector.h" #import "OFData.h" #import "OFRunLoop.h" #import "OFString.h" #import "OFConnectIPSocketFailedException.h" enum { stateSendAuthentication = 1, stateReadVersion, stateSendRequest, stateReadResponse, stateReadAddress, |
︙ | ︙ | |||
140 141 142 143 144 145 146 | runLoopMode = [OFRunLoop currentRunLoop].currentMode; switch (_SOCKS5State) { case stateReadVersion: SOCKSVersion = buffer; if (SOCKSVersion[0] != 5 || SOCKSVersion[1] != 0) { | | | 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | runLoopMode = [OFRunLoop currentRunLoop].currentMode; switch (_SOCKS5State) { case stateReadVersion: SOCKSVersion = buffer; if (SOCKSVersion[0] != 5 || SOCKSVersion[1] != 0) { _exception = [[OFConnectIPSocketFailedException alloc] initWithHost: _host port: _port socket: self errNo: EPROTONOSUPPORT]; [self didConnect]; return false; } |
︙ | ︙ | |||
169 170 171 172 173 174 175 | _SOCKS5State = stateSendRequest; [_socket asyncWriteData: _request runLoopMode: runLoopMode]; return false; case stateReadResponse: response = buffer; if (response[0] != 5 || response[2] != 0) { | | | 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | _SOCKS5State = stateSendRequest; [_socket asyncWriteData: _request runLoopMode: runLoopMode]; return false; case stateReadResponse: response = buffer; if (response[0] != 5 || response[2] != 0) { _exception = [[OFConnectIPSocketFailedException alloc] initWithHost: _host port: _port socket: self errNo: EPROTONOSUPPORT]; [self didConnect]; return false; } |
︙ | ︙ | |||
212 213 214 215 216 217 218 | errNo = EPROTO; #else errNo = 0; #endif break; } | | | 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | errNo = EPROTO; #else errNo = 0; #endif break; } _exception = [[OFConnectIPSocketFailedException alloc] initWithHost: _host port: _port socket: _socket errNo: errNo]; [self didConnect]; return false; } |
︙ | ︙ | |||
242 243 244 245 246 247 248 | case 4: /* IPv6 */ _SOCKS5State = stateReadAddress; [_socket asyncReadIntoBuffer: _buffer exactLength: 16 + 2 runLoopMode: runLoopMode]; return false; default: | | | 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | case 4: /* IPv6 */ _SOCKS5State = stateReadAddress; [_socket asyncReadIntoBuffer: _buffer exactLength: 16 + 2 runLoopMode: runLoopMode]; return false; default: _exception = [[OFConnectIPSocketFailedException alloc] initWithHost: _host port: _port socket: self errNo: EPROTONOSUPPORT]; [self didConnect]; return false; } |
︙ | ︙ |
Modified src/OFUNIXStreamSocket.h from [fd1fe5978d] to [3d105f3c9b].
︙ | ︙ | |||
50 51 52 53 54 55 56 | @property OF_NULLABLE_PROPERTY (assign, nonatomic) id <OFUNIXStreamSocketDelegate> delegate; /** * @brief Connects the OFUNIXStreamSocket to the specified destination. * * @param path The path to connect to | | | 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | @property OF_NULLABLE_PROPERTY (assign, nonatomic) id <OFUNIXStreamSocketDelegate> delegate; /** * @brief Connects the OFUNIXStreamSocket to the specified destination. * * @param path The path to connect to * @throw OFConnectUNIXSocketFailedException Connecting failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (void)connectToPath: (OFString *)path; /** * @brief Binds the socket to the specified host and port. * |
︙ | ︙ |
Modified src/OFUNIXStreamSocket.m from [5f6af41045] to [ff26304fa1].
︙ | ︙ | |||
22 23 24 25 26 27 28 | #import "OFUNIXStreamSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFAlreadyConnectedException.h" #import "OFBindUNIXSocketFailedException.h" | | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | #import "OFUNIXStreamSocket.h" #import "OFSocket.h" #import "OFSocket+Private.h" #import "OFString.h" #import "OFAlreadyConnectedException.h" #import "OFBindUNIXSocketFailedException.h" #import "OFConnectUNIXSocketFailedException.h" @implementation OFUNIXStreamSocket @dynamic delegate; - (void)connectToPath: (OFString *)path { OFSocketAddress address; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) int flags; #endif if (_socket != OFInvalidSocketHandle) @throw [OFAlreadyConnectedException exceptionWithSocket: self]; address = OFSocketAddressMakeUNIX(path); if ((_socket = socket(address.sockaddr.un.sun_family, SOCK_STREAM | SOCK_CLOEXEC, 0)) == OFInvalidSocketHandle) @throw [OFConnectUNIXSocketFailedException exceptionWithPath: path socket: self errNo: OFSocketErrNo()]; _canBlock = true; #if SOCK_CLOEXEC == 0 && defined(HAVE_FCNTL) && defined(FD_CLOEXEC) if ((flags = fcntl(_socket, F_GETFD, 0)) != -1) fcntl(_socket, F_SETFD, flags | FD_CLOEXEC); #endif if (connect(_socket, (struct sockaddr *)&address.sockaddr, address.length) != 0) { int errNo = OFSocketErrNo(); closesocket(_socket); _socket = OFInvalidSocketHandle; @throw [OFConnectUNIXSocketFailedException exceptionWithPath: path socket: self errNo: errNo]; } } - (void)bindToPath: (OFString *)path |
︙ | ︙ |
Modified src/ObjFW.h from [f33758b828] to [8723793ddc].
︙ | ︙ | |||
163 164 165 166 167 168 169 170 171 172 173 174 175 176 | # import "OFConditionBroadcastFailedException.h" # import "OFConditionSignalFailedException.h" # import "OFConditionStillWaitingException.h" # import "OFConditionWaitFailedException.h" #endif #ifdef OF_HAVE_SOCKETS # import "OFConnectSocketFailedException.h" #endif #import "OFCopyItemFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFCreateSymbolicLinkFailedException.h" #ifdef OF_WINDOWS # import "OFCreateWindowsRegistryKeyFailedException.h" #endif | > > > > > > > | 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 | # import "OFConditionBroadcastFailedException.h" # import "OFConditionSignalFailedException.h" # import "OFConditionStillWaitingException.h" # import "OFConditionWaitFailedException.h" #endif #ifdef OF_HAVE_SOCKETS # import "OFConnectSocketFailedException.h" # import "OFConnectIPSocketFailedException.h" # ifdef OF_HAVE_UNIX_SOCKETS # import "OFConnectUNIXSocketFailedException.h" # endif # ifdef OF_HAVE_IPX # import "OFConnectSPXSocketFailedException.h" # endif #endif #import "OFCopyItemFailedException.h" #import "OFCreateDirectoryFailedException.h" #import "OFCreateSymbolicLinkFailedException.h" #ifdef OF_WINDOWS # import "OFCreateWindowsRegistryKeyFailedException.h" #endif |
︙ | ︙ |
Modified src/exceptions/Makefile from [449638fc56] to [3ffa6b7f15].
︙ | ︙ | |||
51 52 53 54 55 56 57 58 | ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} SRCS_FILES = OFChangeCurrentDirectoryFailedException.m \ OFGetCurrentDirectoryFailedException.m SRCS_PLUGINS = OFLoadPluginFailedException.m SRCS_SOCKETS = OFAcceptSocketFailedException.m \ OFAlreadyConnectedException.m \ OFBindSocketFailedException.m \ | > | | > | > | 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | ${USE_SRCS_THREADS} \ ${USE_SRCS_WINDOWS} SRCS_FILES = OFChangeCurrentDirectoryFailedException.m \ OFGetCurrentDirectoryFailedException.m SRCS_PLUGINS = OFLoadPluginFailedException.m SRCS_SOCKETS = OFAcceptSocketFailedException.m \ OFAlreadyConnectedException.m \ OFBindIPSocketFailedException.m \ OFBindSocketFailedException.m \ OFConnectIPSocketFailedException.m \ OFConnectSocketFailedException.m \ OFDNSQueryFailedException.m \ OFHTTPRequestFailedException.m \ OFListenFailedException.m \ OFObserveKernelEventsFailedException.m \ OFResolveHostFailedException.m \ OFTLSHandshakeFailedException.m \ ${USE_SRCS_IPX} \ ${USE_SRCS_UNIX_SOCKETS} SRCS_IPX = OFBindIPXSocketFailedException.m \ OFConnectSPXSocketFailedException.m SRCS_UNIX_SOCKETS = OFBindUNIXSocketFailedException.m \ OFConnectUNIXSocketFailedException.m SRCS_THREADS = OFConditionBroadcastFailedException.m \ OFConditionSignalFailedException.m \ OFConditionStillWaitingException.m \ OFConditionWaitFailedException.m \ OFThreadJoinFailedException.m \ OFThreadStartFailedException.m \ OFThreadStillRunningException.m |
︙ | ︙ |
Modified src/exceptions/OFAcceptSocketFailedException.m from [da410bacce] to [701680e6d7].
︙ | ︙ | |||
22 23 24 25 26 27 28 | @synthesize socket = _socket, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } | | | | | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | @synthesize socket = _socket, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo { return [[[self alloc] initWithSocket: sock errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithSocket: (id)sock errNo: (int)errNo { self = [super init]; _socket = [sock retain]; _errNo = errNo; return self; } - (void)dealloc { |
︙ | ︙ |
Modified src/exceptions/OFAlreadyConnectedException.m from [055eee0622] to [9abd285501].
︙ | ︙ | |||
17 18 19 20 21 22 23 | #import "OFAlreadyConnectedException.h" #import "OFString.h" @implementation OFAlreadyConnectedException @synthesize socket = _socket; | | | | | | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | #import "OFAlreadyConnectedException.h" #import "OFString.h" @implementation OFAlreadyConnectedException @synthesize socket = _socket; + (instancetype)exceptionWithSocket: (id)sock { return [[[self alloc] initWithSocket: sock] autorelease]; } - (instancetype)init { return [self initWithSocket: nil]; } - (instancetype)initWithSocket: (id)sock { self = [super init]; _socket = [sock retain]; return self; } - (void)dealloc { [_socket release]; |
︙ | ︙ |
Added src/exceptions/OFConnectIPSocketFailedException.h version [f85ab38f4c].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 | /* * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFConnectSocketFailedException.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFConnectIPSocketFailedException \ * OFConnectIPSocketFailedException.h \ * ObjFW/OFConnectIPSocketFailedException.h * * @brief An exception indicating that an IP connection could not be * established. */ OF_SUBCLASSING_RESTRICTED @interface OFConnectIPSocketFailedException: OFConnectSocketFailedException { OFString *_Nullable _host; uint16_t _port; } /** * @brief The host to which the connection failed. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *host; /** * @brief The port on the host to which the connection failed. */ @property (readonly, nonatomic) uint16_t port; /** * @brief Creates a new, autoreleased connect IP socket failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return A new, autoreleased connect IP socket failed exception */ + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; + (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo OF_UNAVAILABLE; /** * @brief Initializes an already allocated connect IP socket failed exception. * * @param host The host to which the connection failed * @param port The port on the host to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return An initialized connect IP socket failed exception */ - (instancetype)initWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo OF_DESIGNATED_INITIALIZER; - (instancetype)initWithSocket: (id)socket errNo: (int)errNo OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/OFConnectIPSocketFailedException.m version [b9f4e412ce].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | /* * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFConnectIPSocketFailedException.h" #import "OFString.h" @implementation OFConnectIPSocketFailedException @synthesize host = _host, port = _port; + (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)sock errNo: (int)errNo { return [[[self alloc] initWithHost: host port: port socket: sock errNo: errNo] autorelease]; } - (instancetype)initWithSocket: (id)sock errNo: (int)errNo { OF_INVALID_INIT_METHOD } - (instancetype)initWithHost: (OFString *)host port: (uint16_t)port socket: (id)sock errNo: (int)errNo { self = [super initWithSocket: sock errNo: errNo]; @try { _host = [host copy]; _port = port; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_host release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"A connection to %@ on port %" @PRIu16 @" could not be " @"established in socket of type %@: %@", _host, _port, [_socket class], OFStrError(_errNo)]; } @end |
Added src/exceptions/OFConnectSPXSocketFailedException.h version [acdfa9213b].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | /* * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFConnectSocketFailedException.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFConnectSPXSocketFailedException \ * OFConnectSPXSocketFailedException.h \ * ObjFW/OFConnectSocketFailedException.h * * @brief An exception indicating that an SPX connection could not be * established. */ OF_SUBCLASSING_RESTRICTED @interface OFConnectSPXSocketFailedException: OFConnectSocketFailedException { uint32_t _network; unsigned char _node[IPX_NODE_LEN]; uint16_t _port; } /** * @brief The IPX network of the node to which the connection failed. */ @property (readonly, nonatomic) uint32_t network; /** * @brief The IPX port on the host to which the connection failed. */ @property (readonly, nonatomic) uint16_t port; /** * @brief Creates a new, autoreleased connect SPX socket failed exception. * * @param network The IPX network of the node to which the connection failed * @param node The node to which the connection failed * @param port The port on the node to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return A new, autoreleased connect SPX socket failed exception */ + (instancetype) exceptionWithNetwork: (uint32_t)network node: (const unsigned char [_Nullable IPX_NODE_LEN])node port: (uint16_t)port socket: (id)socket errNo: (int)errNo; + (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo OF_UNAVAILABLE; /** * @brief Initializes an already allocated connect SPX socket failed exception. * * @param network The IPX network of the node to which the connection failed * @param node The node to which the connection failed * @param port The port on the node to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return An initialized connect SPX socket failed exception */ - (instancetype) initWithNetwork: (uint32_t)network node: (const unsigned char [_Nullable IPX_NODE_LEN])node port: (uint16_t)port socket: (id)socket errNo: (int)errNo OF_DESIGNATED_INITIALIZER; - (instancetype)initWithSocket: (id)socket errNo: (int)errNo OF_UNAVAILABLE; /** * @brief Get the IPX node to which the connection failed. * * @param node A pointer to where to write the node to */ - (void)getNode: (unsigned char [_Nonnull IPX_NODE_LEN])node; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/OFConnectSPXSocketFailedException.m version [35220eec8e].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | /* * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #include <string.h> #import "OFConnectSPXSocketFailedException.h" #import "OFData.h" #import "OFString.h" @implementation OFConnectSPXSocketFailedException @synthesize network = _network, port = _port; + (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithNetwork: (uint32_t)network node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port socket: (id)sock errNo: (int)errNo { return [[[self alloc] initWithNetwork: network node: node port: port socket: sock errNo: errNo] autorelease]; } - (instancetype)initWithSocket: (id)sock errNo: (int)errNo { OF_INVALID_INIT_METHOD } - (instancetype)initWithNetwork: (uint32_t)network node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port socket: (id)sock errNo: (int)errNo { self = [super initWithSocket: sock errNo: errNo]; @try { _network = network; memcpy(_node, node, IPX_NODE_LEN); _port = port; } @catch (id e) { [self release]; @throw e; } return self; } - (void)getNode: (unsigned char [IPX_NODE_LEN])node { memcpy(node, _node, sizeof(_node)); } - (OFString *)description { OFData *node = [OFData dataWithItems: _node count: sizeof(_node)]; return [OFString stringWithFormat: @"A connection to %@ port %" @PRIu16 @" on network %" @PRIX32 " could not be established in socket of type %@: %@", node, _port, _network, [_socket class], OFStrError(_errNo)]; } @end |
Modified src/exceptions/OFConnectSocketFailedException.h from [33cd7aa514] to [8f2d911f53].
︙ | ︙ | |||
28 29 30 31 32 33 34 | * OFConnectSocketFailedException.h \ * ObjFW/OFConnectSocketFailedException.h * * @brief An exception indicating that a connection could not be established. */ @interface OFConnectSocketFailedException: OFException { | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < | < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < | | 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | * OFConnectSocketFailedException.h \ * ObjFW/OFConnectSocketFailedException.h * * @brief An exception indicating that a connection could not be established. */ @interface OFConnectSocketFailedException: OFException { id _socket; int _errNo; OF_RESERVE_IVARS(OFConnectSocketFailedException, 4) } /** * @brief The socket which could not connect. */ @property (readonly, nonatomic) id socket; /** * @brief The errno of the error that occurred. */ @property (readonly, nonatomic) int errNo; /** * @brief Creates a new, autoreleased connect socket failed exception. * * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return A new, autoreleased connect socket failed exception */ + (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo; + (instancetype)exception OF_UNAVAILABLE; /** * @brief Initializes an already allocated connect socket failed exception. * * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return An initialized connect socket failed exception */ - (instancetype)initWithSocket: (id)socket errNo: (int)errNo OF_DESIGNATED_INITIALIZER; - (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END |
Modified src/exceptions/OFConnectSocketFailedException.m from [029f1fa82c] to [cadbcb9d65].
︙ | ︙ | |||
15 16 17 18 19 20 21 | #include "config.h" #import "OFConnectSocketFailedException.h" #import "OFString.h" @implementation OFConnectSocketFailedException | < < < < < < < < < < < < | < < | < < | < < < < < < < < < > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < < < < < < < < < < < < < < < | | | | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | #include "config.h" #import "OFConnectSocketFailedException.h" #import "OFString.h" @implementation OFConnectSocketFailedException @synthesize socket = _socket, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo { return [[[self alloc] initWithSocket: sock errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithSocket: (id)sock errNo: (int)errNo { self = [super init]; @try { _socket = [sock retain]; _errNo = errNo; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_socket release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"A connection to could not be established in socket of type " @"%@: %@", [_socket class], OFStrError(_errNo)]; } @end |
Added src/exceptions/OFConnectUNIXSocketFailedException.h version [9ffd06e788].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | /* * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFConnectSocketFailedException.h" OF_ASSUME_NONNULL_BEGIN /** * @class OFConnectUNIXSocketFailedException \ * OFConnectUNIXSocketFailedException.h \ * ObjFW/OFConnectUNIXSocketFailedException.h * * @brief An exception indicating that a UNIX socket connection could not be * established. */ OF_SUBCLASSING_RESTRICTED @interface OFConnectUNIXSocketFailedException: OFConnectSocketFailedException { OFString *_Nullable _path; } /** * @brief The path to which the connection failed. */ @property OF_NULLABLE_PROPERTY (readonly, nonatomic) OFString *path; /** * @brief Creates a new, autoreleased connect UNIX socket failed exception. * * @param path The path to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return A new, autoreleased connect UNIX socket failed exception */ + (instancetype)exceptionWithPath: (OFString *)path socket: (id)socket errNo: (int)errNo; + (instancetype)exceptionWithSocket: (id)socket errNo: (int)errNo OF_UNAVAILABLE; /** * @brief Initializes an already allocated connect UNIX socket failed exception. * * @param path The path to which the connection failed * @param socket The socket which could not connect * @param errNo The errno of the error that occurred * @return An initialized connect UNIX socket failed exception */ - (instancetype)initWithPath: (OFString *)path socket: (id)socket errNo: (int)errNo OF_DESIGNATED_INITIALIZER; - (instancetype)initWithSocket: (id)socket errNo: (int)errNo OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END |
Added src/exceptions/OFConnectUNIXSocketFailedException.m version [f1376977d4].
> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | /* * Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #include "config.h" #import "OFConnectUNIXSocketFailedException.h" #import "OFString.h" @implementation OFConnectUNIXSocketFailedException @synthesize path = _path; + (instancetype)exceptionWithSocket: (id)sock errNo: (int)errNo { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithPath: (OFString *)path socket: (id)sock errNo: (int)errNo { return [[[self alloc] initWithPath: path socket: sock errNo: errNo] autorelease]; } - (instancetype)initWithSocket: (id)sock errNo: (int)errNo { OF_INVALID_INIT_METHOD } - (instancetype)initWithPath: (OFString *)path socket: (id)sock errNo: (int)errNo { self = [super initWithSocket: sock errNo: errNo]; @try { _path = [path copy]; } @catch (id e) { [self release]; @throw e; } return self; } - (void)dealloc { [_path release]; [super dealloc]; } - (OFString *)description { return [OFString stringWithFormat: @"A connection to %@ could not be established in socket of type " @"%@: %@", _path, [_socket class], OFStrError(_errNo)]; } @end |
Modified src/exceptions/OFListenFailedException.m from [45e185da77] to [81694d22f0].
︙ | ︙ | |||
22 23 24 25 26 27 28 | @synthesize socket = _socket, backlog = _backlog, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } | | | | < < | | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | @synthesize socket = _socket, backlog = _backlog, errNo = _errNo; + (instancetype)exception { OF_UNRECOGNIZED_SELECTOR } + (instancetype)exceptionWithSocket: (id)sock backlog: (int)backlog errNo: (int)errNo { return [[[self alloc] initWithSocket: sock backlog: backlog errNo: errNo] autorelease]; } - (instancetype)init { OF_INVALID_INIT_METHOD } - (instancetype)initWithSocket: (id)sock backlog: (int)backlog errNo: (int)errNo { self = [super init]; _socket = [sock retain]; _backlog = backlog; _errNo = errNo; return self; } - (void)dealloc |
︙ | ︙ |