Comment: | OF[IS]PX(Stream)Socket: Bind with network & node |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
b29f11ed2560705f353f4749fadae8db |
User & Date: | js on 2022-10-22 16:41:01 |
Other Links: | manifest | tags |
2022-10-22
| ||
16:50 | Rename OFConnect{ion -> Socket}FailedException check-in: 43b57ece47 user: js tags: trunk | |
16:41 | OF[IS]PX(Stream)Socket: Bind with network & node check-in: b29f11ed25 user: js tags: trunk | |
16:00 | Split OFBindSocketFailedException into subclasses check-in: 72db6b3c6f user: js tags: trunk | |
Modified src/OFIPXSocket.h from [ef99df60be] to [9798b4504d].
︙ | |||
63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 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 | + + + - + + + + + | @property OF_NULLABLE_PROPERTY (assign, nonatomic) id <OFIPXSocketDelegate> delegate; /** * @brief Bind the socket to the specified network, node and port with the * specified packet type. * * @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. * @param packetType The packet type to use on the socket * @return The address on which this socket can be reached * @throw OFBindIPXSocketFailedException Binding failed * @throw OFAlreadyConnectedException The socket is already bound */ |
Modified src/OFIPXSocket.m from [0a75c9cc64] to [1dc137a6b3].
︙ | |||
27 28 29 30 31 32 33 | 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | + + + - + - - + - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + | #import "OFAlreadyConnectedException.h" #import "OFBindIPXSocketFailedException.h" @implementation OFIPXSocket @dynamic delegate; - (OFSocketAddress)bindToNetwork: (uint32_t)network node: (const unsigned char [IPX_NODE_LEN])node port: (uint16_t)port |
︙ |
Modified src/OFSPXSocket.h from [dd73febed0] to [771a7f3ff3].
︙ | |||
48 49 50 51 52 53 54 | 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | - + | * @param node The node the socket connected to * @param port The port of the node to which the socket connected * @param exception An exception that occurred while connecting, or nil on * success */ - (void)socket: (OFSPXSocket *)socket didConnectToNetwork: (uint32_t)network |
︙ | |||
89 90 91 92 93 94 95 | 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | - + - + - + - + - + + + + - + + + + | * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectionFailedException Connecting failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (void)connectToNetwork: (uint32_t)network |
Modified src/OFSPXSocket.m from [58b6b2aee3] to [fcf21cbe34].
︙ | |||
52 53 54 55 56 57 58 | 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 | - + - + | #ifdef OF_HAVE_BLOCKS OFSPXSocketAsyncConnectBlock _block; #endif } - (instancetype)initWithSocket: (OFSPXSocket *)socket network: (uint32_t)network |
︙ | |||
220 221 222 223 224 225 226 | 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | - + | - (void)of_closeSocket { closesocket(_socket); _socket = OFInvalidSocketHandle; } - (void)connectToNetwork: (uint32_t)network |
︙ | |||
247 248 249 250 251 252 253 | 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 | - + - + - + - + - + + + - - + - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + | port: port socket: self errNo: errNo]; } } - (void)asyncConnectToNetwork: (uint32_t)network |
Modified src/OFSPXStreamSocket.h from [d15837842c] to [2d291aead3].
︙ | |||
49 50 51 52 53 54 55 | 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | - + | * @param node The node the socket connected to * @param port The port of the node to which the socket connected * @param exception An exception that occurred while connecting, or nil on * success */ - (void)socket: (OFSPXStreamSocket *)socket didConnectToNetwork: (uint32_t)network |
︙ | |||
90 91 92 93 94 95 96 | 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | - + - + - + - + - + + + + - + + + + | * @param node The node to connect to * @param port The port (sometimes also called socket number) on the node to * connect to * @throw OFConnectionFailedException Connecting failed * @throw OFAlreadyConnectedException The socket is already connected or bound */ - (void)connectToNetwork: (uint32_t)network |
Modified src/OFSPXStreamSocket.m from [2dd457649f] to [a3edaa05ec].
︙ | |||
53 54 55 56 57 58 59 | 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 | - + - + | #ifdef OF_HAVE_BLOCKS OFSPXStreamSocketAsyncConnectBlock _block; #endif } - (instancetype)initWithSocket: (OFSPXStreamSocket *)socket network: (uint32_t)network |
︙ | |||
222 223 224 225 226 227 228 | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | - + | - (void)of_closeSocket { closesocket(_socket); _socket = OFInvalidSocketHandle; } - (void)connectToNetwork: (uint32_t)network |
︙ | |||
249 250 251 252 253 254 255 | 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 | - + - + - + - + - + + + - - + - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + - - - - + + + + + + | port: port socket: self errNo: errNo]; } } - (void)asyncConnectToNetwork: (uint32_t)network |
Modified src/OFSocket.h from [6ae41ef6ce] to [ed92d6e459].
︙ | |||
302 303 304 305 306 307 308 | 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 | - + | /** * @brief Gets the IPX node of the specified @ref OFSocketAddress. * * @param address The address on which to get the IPX node * @param node A byte array to store the IPX node of the address */ |
︙ |
Modified src/OFSocket.m from [65b91d8086] to [85e7c00ebd].
︙ | |||
923 924 925 926 927 928 929 | 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 | - + | if (address->family != OFSocketAddressFamilyIPX) @throw [OFInvalidArgumentException exception]; memcpy(address->sockaddr.ipx.sipx_node, node, IPX_NODE_LEN); } void |
Modified src/exceptions/OFBindIPXSocketFailedException.h from [27c4435d00] to [348112e28c].
︙ | |||
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 | 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 95 96 97 98 99 100 101 102 | + + + + + + + + + - - - - + + + + + + + + + - - - - + + + + + + + + + + + + + + | * ObjFW/OFBindIPXSocketFailedException.h * * @brief An exception indicating that binding an IPX socket failed. */ OF_SUBCLASSING_RESTRICTED @interface OFBindIPXSocketFailedException: OFBindSocketFailedException { uint32_t _network; unsigned char _node[IPX_NODE_LEN]; uint16_t _port; uint8_t _packetType; } /** * @brief The IPX network on which binding failed. */ @property (readonly, nonatomic) uint32_t network; /** * @brief The IPX port on which binding failed. */ @property (readonly, nonatomic) uint16_t port; /** * @brief The IPX packet type for which binding failed. */ @property (readonly, nonatomic) uint8_t packetType; /** * @brief Creates a new, autoreleased bind IPX socket failed exception. * * @param network The IPX network to which binding failed * @param node The IPX node to which binding failed * @param port The IPX port to which binding failed * @param packetType The IPX packet type for which binding failed * @param socket The socket which could not be bound * @param errNo The errno of the error that occurred * @return A new, autoreleased bind IPX socket failed exception */ |
Modified src/exceptions/OFBindIPXSocketFailedException.m from [b4a5fc6e68] to [ae7cdae06b].
︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 | 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 | + + + - + - - - - + + + + + + + - - - - + + + + + + - - - - + + + + + + + + + + + + + + + + - - - + + + + | * 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 "OFBindIPXSocketFailedException.h" #import "OFData.h" #import "OFString.h" @implementation OFBindIPXSocketFailedException |
Modified src/exceptions/OFConnectionFailedException.h from [3f23880b21] to [b07c5b14da].
︙ | |||
110 111 112 113 114 115 116 | 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | - + | * @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 connection failed exception */ + (instancetype) exceptionWithNetwork: (uint32_t)network |
︙ | |||
153 154 155 156 157 158 159 | 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 | + - - - - - + + + + + | * @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 connection failed exception */ - (instancetype) |
Modified src/exceptions/OFConnectionFailedException.m from [2c0b32486f] to [d635dfc0b4].
︙ | |||
44 45 46 47 48 49 50 | 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 | - + | { return [[[self alloc] initWithPath: path socket: sock errNo: errNo] autorelease]; } + (instancetype)exceptionWithNetwork: (uint32_t)network |
︙ | |||
95 96 97 98 99 100 101 | 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | - + | @throw e; } return self; } - (instancetype)initWithNetwork: (uint32_t)network |
︙ |
Modified tests/OFIPXSocketTests.m from [e80e3e99da] to [59b38899e7].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 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 | + - - + + + + + - - + + - - + + + | #import "TestsAppDelegate.h" static OFString *const module = @"OFIPXSocket"; @implementation TestsAppDelegate (OFIPXSocketTests) - (void)IPXSocketTests { const unsigned char zeroNode[IPX_NODE_LEN] = { 0 }; void *pool = objc_autoreleasePoolPush(); OFIPXSocket *sock; OFSocketAddress address1, address2; char buffer[5]; TEST(@"+[socket]", (sock = [OFIPXSocket socket])) @try { |
︙ |
Modified tests/OFSPXSocketTests.m from [8c56b24eef] to [2398c8daff].
︙ | |||
48 49 50 51 52 53 54 | 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 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 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | - + + - - + + + + - + - + - + - + - + - + - + | [[OFRunLoop mainRunLoop] stop]; return false; } - (void)socket: (OFSPXSocket *)sock didConnectToNetwork: (uint32_t)network |
︙ |
Modified tests/OFSPXStreamSocketTests.m from [1b61f46c13] to [5afcf8a434].
︙ | |||
48 49 50 51 52 53 54 | 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 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | - + + - - + + + + - - + + - - + + - - + + - + | [[OFRunLoop mainRunLoop] stop]; return false; } - (void)socket: (OFSPXStreamSocket *)sock didConnectToNetwork: (uint32_t)network |
︙ | |||
136 137 138 139 140 141 142 | 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 | - + - + - + | memcmp(buffer, "He", 2) == 0 && [sockClient readIntoBuffer: buffer length: 3] == 3 && memcmp(buffer, "llo", 3) == 0) TEST(@"-[remoteAddress]", (address2 = sockAccepted.remoteAddress) && OFSocketAddressIPXNetwork(address2) == network && |
︙ |