ObjFW  Diff

Differences From Artifact [441994c3e5]:

To Artifact [24146b1f99]:

  • File src/OFUDPSocket.h — part of check-in [d526d938d7] at 2015-11-21 18:35:39 on branch trunk — Remove OF_NULLABLE / OF_NONNULL

    Now that Clang switched to use _Nullable and _Nonnull instead of
    __nullable / __nonnull, there is no longer a conflict with glibc, which
    means we can just define _Nullable / _Nonnull to nothing if they are not
    understood by the compiler (which did not work with __nullable /
    __nonnull due to this conflict).

    This also defines _Null_unspecified to nothing if unavailable. (user: js, size: 9885) [annotate] [blame] [check-ins using]


45
46
47
48
49
50
51
52

53
54
55
56
57
58
59
60
61
62
63
64
65
66
67

68
69
70
71
72
73
74
45
46
47
48
49
50
51

52
53
54
55
56
57
58
59
60
61
62
63
64
65
66

67
68
69
70
71
72
73
74







-
+














-
+







 * @param port The port of the host / port pair
 * @param address The address of the resolved host / port pair
 * @param exception An exception which occurred while resolving or nil on
 *		    success
 */
typedef void (^of_udp_socket_async_resolve_block_t)(OFString *host,
    uint16_t port, of_udp_socket_address_t address,
    OFException *OF_NULLABLE exception);
    OFException *_Nullable exception);

/*!
 * @brief A block which is called when a packet has been received.
 *
 * @param socket The UDP which received a packet
 * @param buffer The buffer the packet has been written to
 * @param length The length of the packet
 * @param sender The address of the sender of the packet
 * @param exception An exception which occurred while receiving or nil on
 *		    success
 * @return A bool whether the same block should be used for the next receive
 */
typedef bool (^of_udp_socket_async_receive_block_t)(OFUDPSocket *socket,
    void *buffer, size_t length, of_udp_socket_address_t sender,
    OFException *OF_NULLABLE exception);
    OFException *_Nullable exception);
#endif

/*!
 * @class OFUDPSocket OFUDPSocket.h ObjFW/OFUDPSocket.h
 *
 * @brief A class which provides functions to create and use UDP sockets.
 *
153
154
155
156
157
158
159
160
161


162
163
164
165
166
167
168
153
154
155
156
157
158
159


160
161
162
163
164
165
166
167
168







-
-
+
+







 *
 * @param host A pointer to an OFString*. If it is not NULL, it will be set to
 *	       the host of the host / port pair.
 * @param port A pointer to an uint16_t. If it is not NULL, the port of the
 *	       host / port pair will be written to it.
 * @param address The address for which the host and port should be retrieved
 */
+ (void)getHost: (OFString *__autoreleasing OF_NONNULL *OF_NULLABLE)host
	andPort: (uint16_t *OF_NULLABLE)port
+ (void)getHost: (OFString *__autoreleasing _Nonnull *_Nullable)host
	andPort: (uint16_t *_Nullable)port
     forAddress: (of_udp_socket_address_t*)address;

/*!
 * @brief Binds the socket to the specified host and port.
 *
 * @param host The host to bind to. Use `@"0.0.0.0"` for IPv4 or `@"::"` for
 *	       IPv6 to bind to all.