ObjFW
OFSPXSocket.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2023 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
27 
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 
120 - (void)asyncConnectToNetwork: (uint32_t)network
121  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
122  port: (uint16_t)port
123  runLoopMode: (OFRunLoopMode)runLoopMode;
124 
125 #ifdef OF_HAVE_BLOCKS
126 
135 - (void)asyncConnectToNetwork: (uint32_t)network
136  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
137  port: (uint16_t)port
138  block: (OFSPXSocketAsyncConnectBlock)block;
139 
150 - (void)asyncConnectToNetwork: (uint32_t)network
151  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
152  port: (uint16_t)port
153  runLoopMode: (OFRunLoopMode)runLoopMode
154  block: (OFSPXSocketAsyncConnectBlock)block;
155 #endif
156 
169 - (OFSocketAddress)
170  bindToNetwork: (uint32_t)network
171  node: (const unsigned char [_Nonnull IPX_NODE_LEN])node
172  port: (uint16_t)port;
173 @end
174 
175 OF_ASSUME_NONNULL_END
A class for storing constant strings using the @"" literal.
Definition: OFConstantString.h:37
A struct which represents a host / port pair for a socket.
Definition: OFSocket.h:182
A class for handling strings.
Definition: OFString.h:134
A base class for sequenced packet sockets.
Definition: OFSequencedPacketSocket.h:125
A class which provides methods to create and use SPX sockets.
Definition: OFSPXSocket.h:71
A delegate for OFSequencedPacketSocket.
void(^ OFSPXSocketAsyncConnectBlock)(id exception)
A block which is called when the socket connected.
Definition: OFSPXSocket.h:33