ObjFW
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 file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
17 #import "OFRunLoop.h"
18 
19 OF_ASSUME_NONNULL_BEGIN
20 
23 @class OFSPXSocket;
24 @class OFString;
25 
26 #ifdef OF_HAVE_BLOCKS
33 typedef void (^OFSPXSocketAsyncConnectBlock)(id _Nullable exception);
34 #endif
35 
42 @optional
53 - (void)socket: (OFSPXSocket *)socket
54  didConnectToNetwork: (uint32_t)network
55  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
56  port: (uint16_t)port
57  exception: (nullable id)exception;
58 @end
59 
72 {
73  OF_RESERVE_IVARS(OFSPXSocket, 4)
74 }
75 
82 @property OF_NULLABLE_PROPERTY (assign, nonatomic)
83  id <OFSPXSocketDelegate> delegate;
84 
95 - (void)connectToNetwork: (uint32_t)network
96  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
97  port: (uint16_t)port;
98 
107 - (void)asyncConnectToNetwork: (uint32_t)network
108  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
109  port: (uint16_t)port;
110 
121 - (void)asyncConnectToNetwork: (uint32_t)network
122  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
123  port: (uint16_t)port
124  runLoopMode: (OFRunLoopMode)runLoopMode;
125 
126 #ifdef OF_HAVE_BLOCKS
136 - (void)asyncConnectToNetwork: (uint32_t)network
137  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
138  port: (uint16_t)port
139  block: (OFSPXSocketAsyncConnectBlock)block;
140 
152 - (void)asyncConnectToNetwork: (uint32_t)network
153  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
154  port: (uint16_t)port
155  runLoopMode: (OFRunLoopMode)runLoopMode
156  block: (OFSPXSocketAsyncConnectBlock)block;
157 #endif
158 
171 - (OFSocketAddress)
172  bindToNetwork: (uint32_t)network
173  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
174  port: (uint16_t)port;
175 @end
176 
177 OF_ASSUME_NONNULL_END
void(^ OFSPXSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition: OFSPXSocket.h:33
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:38
A class which provides methods to create and use SPX sockets.
Definition: OFSPXSocket.h:72
A base class for sequenced packet sockets.
Definition: OFSequencedPacketSocket.h:128
A class for handling strings.
Definition: OFString.h:135
Definition: OFSPXSocket.h:41
A delegate for OFSequencedPacketSocket.
Definition: OFSequencedPacketSocket.h:69
A struct which represents a host / port pair for a socket.
Definition: OFSocket.h:182