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
37typedef void (^OFSPXSocketAsyncConnectBlock)(id _Nullable exception);
38#endif
39
45@protocol OFSPXSocketDelegate <OFSequencedPacketSocketDelegate>
46@optional
57- (void)socket: (OFSPXSocket *)socket
58 didConnectToNetwork: (uint32_t)network
59 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
60 port: (uint16_t)port
61 exception: (nullable id)exception;
62@end
63
76{
77 OF_RESERVE_IVARS(OFSPXSocket, 4)
78}
79
86@property OF_NULLABLE_PROPERTY (assign, nonatomic)
87 id <OFSPXSocketDelegate> delegate;
88
99- (void)connectToNetwork: (uint32_t)network
100 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
101 port: (uint16_t)port;
102
111- (void)asyncConnectToNetwork: (uint32_t)network
112 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
113 port: (uint16_t)port;
114
125- (void)asyncConnectToNetwork: (uint32_t)network
126 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
127 port: (uint16_t)port
128 runLoopMode: (OFRunLoopMode)runLoopMode;
129
130#ifdef OF_HAVE_BLOCKS
140- (void)asyncConnectToNetwork: (uint32_t)network
141 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
142 port: (uint16_t)port
143 block: (OFSPXSocketAsyncConnectBlock)block;
144
156- (void)asyncConnectToNetwork: (uint32_t)network
157 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
158 port: (uint16_t)port
159 runLoopMode: (OFRunLoopMode)runLoopMode
160 block: (OFSPXSocketAsyncConnectBlock)block;
161#endif
162
176 bindToNetwork: (uint32_t)network
177 node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
178 port: (uint16_t)port;
179@end
180
181OF_ASSUME_NONNULL_END
void(^ OFSPXSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition OFSPXSocket.h:37
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:76
A base class for sequenced packet sockets.
Definition OFSequencedPacketSocket.h:132
A class for handling strings.
Definition OFString.h:139
A struct which represents a host / port pair for a socket.
Definition OFSocket.h:186