ObjFW
OFSPXStreamSocket.h
Go to the documentation of this file.
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 "OFStreamSocket.h"
21 #import "OFRunLoop.h"
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
27 @class OFSPXStreamSocket;
28 @class OFString;
29 
30 #ifdef OF_HAVE_BLOCKS
31 
37 typedef void (^OFSPXStreamSocketAsyncConnectBlock)(id _Nullable exception);
38 #endif
39 
47 @optional
58 - (void)socket: (OFSPXStreamSocket *)socket
59  didConnectToNetwork: (uint32_t)network
60  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
61  port: (uint16_t)port
62  exception: (nullable id)exception;
63 @end
64 
77 {
78  OF_RESERVE_IVARS(OFSPXStreamSocket, 4)
79 }
80 
87 @property OF_NULLABLE_PROPERTY (assign, nonatomic)
89 
100 - (void)connectToNetwork: (uint32_t)network
101  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
102  port: (uint16_t)port;
103 
113 - (void)asyncConnectToNetwork: (uint32_t)network
114  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
115  port: (uint16_t)port;
116 
128 - (void)asyncConnectToNetwork: (uint32_t)network
129  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
130  port: (uint16_t)port
131  runLoopMode: (OFRunLoopMode)runLoopMode;
132 
133 #ifdef OF_HAVE_BLOCKS
134 
144 - (void)asyncConnectToNetwork: (uint32_t)network
145  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
146  port: (uint16_t)port
148 
161 - (void)asyncConnectToNetwork: (uint32_t)network
162  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
163  port: (uint16_t)port
164  runLoopMode: (OFRunLoopMode)runLoopMode
166 #endif
167 
180 - (OFSocketAddress)
181  bindToNetwork: (uint32_t)network
182  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
183  port: (uint16_t)port;
184 @end
185 
186 OF_ASSUME_NONNULL_END
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:41
A class which provides methods to create and use SPX stream sockets.
Definition: OFSPXStreamSocket.h:76
A struct which represents a host / port pair for a socket.
Definition: OFSocket.h:186
A class for handling strings.
Definition: OFString.h:138
void(^ OFSPXStreamSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition: OFSPXStreamSocket.h:37
A class which provides methods to create and use stream sockets.
Definition: OFStreamSocket.h:69