ObjFW
Loading...
Searching...
No Matches
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
23OF_ASSUME_NONNULL_BEGIN
24
28@class OFString;
29
30#ifdef OF_HAVE_BLOCKS
39typedef void (^OFSPXStreamSocketAsyncConnectBlock)(id _Nullable exception)
40 OF_DEPRECATED(ObjFW, 1, 2, "Use OFSPXStreamSocketConnectedHandler instead");
41
53 uint32_t network, const unsigned char node[_Nonnull IPX_NODE_LEN],
54 uint16_t port, id _Nullable exception);
55#endif
56
62@protocol OFSPXStreamSocketDelegate <OFStreamSocketDelegate>
63@optional
74- (void)socket: (OFSPXStreamSocket *)socket
75 didConnectToNetwork: (uint32_t)network
76 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
77 port: (uint16_t)port
78 exception: (nullable id)exception;
79@end
80
93{
94 OF_RESERVE_IVARS(OFSPXStreamSocket, 4)
95}
96
103@property OF_NULLABLE_PROPERTY (assign, nonatomic)
104 id <OFSPXStreamSocketDelegate> delegate;
105
116- (void)connectToNetwork: (uint32_t)network
117 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
118 port: (uint16_t)port;
119
129- (void)asyncConnectToNetwork: (uint32_t)network
130 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
131 port: (uint16_t)port;
132
144- (void)asyncConnectToNetwork: (uint32_t)network
145 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
146 port: (uint16_t)port
147 runLoopMode: (OFRunLoopMode)runLoopMode;
148
149#ifdef OF_HAVE_BLOCKS
162- (void)asyncConnectToNetwork: (uint32_t)network
163 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
164 port: (uint16_t)port
166 OF_DEPRECATED(ObjFW, 1, 2,
167 "Use -[asyncConnectToNetwork:node:port:handler:] instead");
168
179- (void)asyncConnectToNetwork: (uint32_t)network
180 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
181 port: (uint16_t)port
182 handler: (OFSPXStreamSocketConnectedHandler)handler;
183
199- (void)asyncConnectToNetwork: (uint32_t)network
200 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
201 port: (uint16_t)port
202 runLoopMode: (OFRunLoopMode)runLoopMode
204 OF_DEPRECATED(ObjFW, 1, 2,
205 "Use -[asyncConnectToNetwork:node:port:runLoopMode:handler:] instead");
206
219- (void)asyncConnectToNetwork: (uint32_t)network
220 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
221 port: (uint16_t)port
222 runLoopMode: (OFRunLoopMode)runLoopMode
223 handler: (OFSPXStreamSocketConnectedHandler)handler;
224#endif
225
239 bindToNetwork: (uint32_t)network
240 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
241 port: (uint16_t)port;
242@end
243
244OF_ASSUME_NONNULL_END
void(^ OFSPXStreamSocketConnectedHandler)(OFSPXStreamSocket *socket, uint32_t network, const unsigned char node[IPX_NODE_LEN], uint16_t port, id exception)
A handler which is called when the socket connected.
Definition OFSPXStreamSocket.h:52
void(^ OFSPXStreamSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition OFSPXStreamSocket.h:39
A class for storing constant strings using the @"" literal.
Definition OFConstantString.h:42
A class which provides methods to create and use SPX stream sockets.
Definition OFSPXStreamSocket.h:93
A class which provides methods to create and use stream sockets.
Definition OFStreamSocket.h:88
A class for handling strings.
Definition OFString.h:143
A struct which represents a host / port pair for a socket.
Definition OFSocket.h:189