ObjFW
OFSPXSocket.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2021 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 (^of_spx_socket_async_connect_block_t)(id _Nullable exception);
34 #endif
35 
42 @optional
53 - (void)socket: (OFSPXSocket *)socket
54  didConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
55  network: (uint32_t)network
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 
93 - (void)connectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
94  network: (uint32_t)network
95  port: (uint16_t)port;
96 
105 - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
106  network: (uint32_t)network
107  port: (uint16_t)port;
108 
118 - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
119  network: (uint32_t)network
120  port: (uint16_t)port
121  runLoopMode: (of_run_loop_mode_t)runLoopMode;
122 
123 #ifdef OF_HAVE_BLOCKS
133 - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
134  network: (uint32_t)network
135  port: (uint16_t)port
137 
148 - (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
149  network: (uint32_t)network
150  port: (uint16_t)port
151  runLoopMode: (of_run_loop_mode_t)runLoopMode
153 #endif
154 
162 - (of_socket_address_t)bindToPort: (uint16_t)port;
163 @end
164 
165 OF_ASSUME_NONNULL_END
void(^ of_spx_socket_async_connect_block_t)(id _Nullable exception)
A block which is called when the socket connected.
Definition: OFSPXSocket.h:33
struct objc_object * id
A pointer to any object.
Definition: ObjFWRT.h:90
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:72
A base class for sequenced packet sockets.
Definition: OFSequencedPacketSocket.h:130
A class for handling strings.
Definition: OFString.h:132
Definition: OFSPXSocket.h:41
A delegate for OFSequencedPacketSocket.
Definition: OFSequencedPacketSocket.h:71
A struct which represents a host / port pair for a socket.
Definition: socket.h:136