ObjFW  Diff

Differences From Artifact [0544ae262f]:

To Artifact [4d2a1f1863]:


40
41
42
43
44
45
46
47
48

49
50
51
52
53
54



55
56
57


58
59
60
61
62
63
64
40
41
42
43
44
45
46

47
48
49
50
51
52


53
54
55



56
57
58
59
60
61
62
63
64







-

+




-
-
+
+
+
-
-
-
+
+







 */
@protocol OFSPXSocketDelegate <OFSequencedPacketSocketDelegate>
@optional
/**
 * @brief A method which is called when a socket connected.
 *
 * @param socket The socket which connected
 * @param node The node the socket connected to
 * @param network The network of the node the socket connected to
 * @param node The node the socket connected to
 * @param port The port of the node to which the socket connected
 * @param exception An exception that occurred while connecting, or nil on
 *		    success
 */
-     (void)socket: (OFSPXSocket *)socket
  didConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
-	 (void)socket: (OFSPXSocket *)socket
  didConnectToNetwork: (uint32_t)network
		 node: (unsigned char [_Nonnull IPX_NODE_LEN])node
	   network: (uint32_t)network
	      port: (uint16_t)port
	 exception: (nullable id)exception;
		 port: (uint16_t)port
	    exception: (nullable id)exception;
@end

/**
 * @class OFSPXSocket OFSPXSocket.h ObjFW/OFSPXSocket.h
 *
 * @brief A class which provides methods to create and use SPX sockets.
 *
81
82
83
84
85
86
87
88
89

90
91
92

93

94
95

96
97
98
99
100
101

102
103
104

105

106
107

108
109
110
111
112
113

114
115
116
117

118

119
120
121


122
123
124
125
126
127
128
129
130
131
132

133

134
135
136


137
138
139
140
141
142
143
144
145
146
147

148

149
150
151
152



153
154
155
156
157
158
159
160
161
162
163
164
165
81
82
83
84
85
86
87

88
89
90
91
92
93

94


95
96
97
98
99

100
101
102
103
104
105

106


107
108
109
110
111

112
113
114
115
116
117
118

119



120
121
122
123
124
125
126
127
128
129
130
131
132
133

134



135
136
137
138
139
140
141
142
143
144
145
146
147
148

149




150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165







-

+



+
-
+
-
-
+




-

+



+
-
+
-
-
+




-

+




+
-
+
-
-
-
+
+











+
-
+
-
-
-
+
+











+
-
+
-
-
-
-
+
+
+













 */
@property OF_NULLABLE_PROPERTY (assign, nonatomic)
    id <OFSPXSocketDelegate> delegate;

/**
 * @brief Connect the OFSPXSocket to the specified destination.
 *
 * @param node The node to connect to
 * @param network The network on which the node to connect to is
 * @param node The node to connect to
 * @param port The port (sometimes also called socket number) on the node to
 *	       connect to
 */
- (void)connectToNetwork: (uint32_t)network
- (void)connectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
		    node: (unsigned char [_Nonnull IPX_NODE_LEN])node
	      network: (uint32_t)network
		 port: (uint16_t)port;
		    port: (uint16_t)port;

/**
 * @brief Asynchronously connect the OFSPXSocket to the specified destination.
 *
 * @param node The node to connect to
 * @param network The network on which the node to connect to is
 * @param node The node to connect to
 * @param port The port (sometimes also called socket number) on the node to
 *	       connect to
 */
- (void)asyncConnectToNetwork: (uint32_t)network
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
			 node: (unsigned char [_Nonnull IPX_NODE_LEN])node
		   network: (uint32_t)network
		      port: (uint16_t)port;
			 port: (uint16_t)port;

/**
 * @brief Asynchronously connect the OFSPXSocket to the specified destination.
 *
 * @param node The node to connect to
 * @param network The network on which the node to connect to is
 * @param node The node to connect to
 * @param port The port (sometimes also called socket number) on the node to
 *	       connect to
 * @param runLoopMode The run loop mode in which to perform the async connect
 */
- (void)asyncConnectToNetwork: (uint32_t)network
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
			 node: (unsigned char [_Nonnull IPX_NODE_LEN])node
		   network: (uint32_t)network
		      port: (uint16_t)port
	       runLoopMode: (OFRunLoopMode)runLoopMode;
			 port: (uint16_t)port
		  runLoopMode: (OFRunLoopMode)runLoopMode;

#ifdef OF_HAVE_BLOCKS
/**
 * @brief Asynchronously connect the OFSPXSocket to the specified destination.
 *
 * @param node The node to connect to
 * @param network The network on which the node to connect to is
 * @param port The port (sometimes also called socket number) on the node to
 *	       connect to
 * @param block The block to execute once the connection has been established
 */
- (void)asyncConnectToNetwork: (uint32_t)network
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
			 node: (unsigned char [_Nonnull IPX_NODE_LEN])node
		   network: (uint32_t)network
		      port: (uint16_t)port
		     block: (OFSPXSocketAsyncConnectBlock)block;
			 port: (uint16_t)port
			block: (OFSPXSocketAsyncConnectBlock)block;

/**
 * @brief Asynchronously connect the OFSPXSocket to the specified destination.
 *
 * @param node The node to connect to
 * @param network The network on which the node to connect to is
 * @param port The port (sometimes also called socket number) on the node to
 *	       connect to
 * @param runLoopMode The run loop mode in which to perform the async connect
 * @param block The block to execute once the connection has been established
 */
- (void)asyncConnectToNetwork: (uint32_t)network
- (void)asyncConnectToNode: (unsigned char [_Nonnull IPX_NODE_LEN])node
			 node: (unsigned char [_Nonnull IPX_NODE_LEN])node
		   network: (uint32_t)network
		      port: (uint16_t)port
	       runLoopMode: (OFRunLoopMode)runLoopMode
		     block: (OFSPXSocketAsyncConnectBlock)block;
			 port: (uint16_t)port
		  runLoopMode: (OFRunLoopMode)runLoopMode
			block: (OFSPXSocketAsyncConnectBlock)block;
#endif

/**
 * @brief Bind the socket to the specified network, node and port.
 *
 * @param port The port (sometimes called socket number) to bind to. 0 means to
 *	       pick one and return it.
 * @return The address on which this socket can be reached
 */
- (OFSocketAddress)bindToPort: (uint16_t)port;
@end

OF_ASSUME_NONNULL_END