ObjFW
Loading...
Searching...
No Matches
OFSPXSocket.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
21#import "OFRunLoop.h"
22
23OF_ASSUME_NONNULL_BEGIN
24
27@class OFSPXSocket;
28@class OFString;
29
30#ifdef OF_HAVE_BLOCKS
39typedef void (^OFSPXSocketAsyncConnectBlock)(id _Nullable exception)
40 OF_DEPRECATED(ObjFW, 1, 2, "Use OFSPXSocketConnectedHandler 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 OFSPXSocketDelegate <OFSequencedPacketSocketDelegate>
63@optional
74- (void)socket: (OFSPXSocket *)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(OFSPXSocket, 4)
95}
96
103@property OF_NULLABLE_PROPERTY (assign, nonatomic)
104 id <OFSPXSocketDelegate> delegate;
105
116- (void)connectToNetwork: (uint32_t)network
117 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
118 port: (uint16_t)port;
119
128- (void)asyncConnectToNetwork: (uint32_t)network
129 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
130 port: (uint16_t)port;
131
142- (void)asyncConnectToNetwork: (uint32_t)network
143 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
144 port: (uint16_t)port
145 runLoopMode: (OFRunLoopMode)runLoopMode;
146
147#ifdef OF_HAVE_BLOCKS
159- (void)asyncConnectToNetwork: (uint32_t)network
160 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
161 port: (uint16_t)port
162 block: (OFSPXSocketAsyncConnectBlock)block
163 OF_DEPRECATED(ObjFW, 1, 2,
164 "Use -[asyncConnectToNetwork:node:port:handler:] instead");
165
175- (void)asyncConnectToNetwork: (uint32_t)network
176 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
177 port: (uint16_t)port
178 handler: (OFSPXSocketConnectedHandler)handler;
179
194- (void)asyncConnectToNetwork: (uint32_t)network
195 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
196 port: (uint16_t)port
197 runLoopMode: (OFRunLoopMode)runLoopMode
198 block: (OFSPXSocketAsyncConnectBlock)block
199 OF_DEPRECATED(ObjFW, 1, 2,
200 "Use -[asyncConnectToNetwork:node:port:runLoopMode:handler:] instead");
201
213- (void)asyncConnectToNetwork: (uint32_t)network
214 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
215 port: (uint16_t)port
216 runLoopMode: (OFRunLoopMode)runLoopMode
217 handler: (OFSPXSocketConnectedHandler)handler;
218#endif
219
233 bindToNetwork: (uint32_t)network
234 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
235 port: (uint16_t)port;
236@end
237
238OF_ASSUME_NONNULL_END
void(^ OFSPXSocketConnectedHandler)(OFSPXSocket *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 OFSPXSocket.h:52
void(^ OFSPXSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition OFSPXSocket.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 sockets.
Definition OFSPXSocket.h:93
A base class for sequenced packet sockets.
Definition OFSequencedPacketSocket.h:184
A class for handling strings.
Definition OFString.h:143
A struct which represents a host / port pair for a socket.
Definition OFSocket.h:189