Index: src/OFRunLoop+Private.h ================================================================== --- src/OFRunLoop+Private.h +++ src/OFRunLoop+Private.h @@ -64,11 +64,11 @@ selector: (SEL)selector context: (nullable id)context; + (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)socket buffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (nullable id)context; # ifdef OF_HAVE_BLOCKS + (void)of_addAsyncReadForStream: (OFStream *) @@ -99,14 +99,14 @@ block: (of_udp_socket_async_receive_block_t) block; + (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)socket buffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block; # endif + (void)of_cancelAsyncRequestsForObject: (id)object; #endif - (void)of_removeTimer: (OFTimer *)timer; @end OF_ASSUME_NONNULL_END Index: src/OFRunLoop.m ================================================================== --- src/OFRunLoop.m +++ src/OFRunLoop.m @@ -121,11 +121,11 @@ # ifdef OF_HAVE_BLOCKS of_udp_socket_async_send_block_t _block; # endif const void *_buffer; size_t _length; - of_udp_socket_address_t _receiver; + of_socket_address_t _receiver; } @end @implementation OFRunLoop_QueueItem - (bool)handleObject: (id)object @@ -376,11 +376,11 @@ @implementation OFRunLoop_UDPReceiveQueueItem - (bool)handleObject: (id)object { size_t length; - of_udp_socket_address_t address; + of_socket_address_t address; id exception = nil; @try { length = [object receiveIntoBuffer: _buffer length: _length @@ -394,13 +394,13 @@ if (_block != NULL) return _block(object, _buffer, length, address, exception); else { # endif bool (*func)(id, SEL, OFUDPSocket *, void *, size_t, - of_udp_socket_address_t, id, id) = + of_socket_address_t, id, id) = (bool (*)(id, SEL, OFUDPSocket *, void *, size_t, - of_udp_socket_address_t, id, id)) + of_socket_address_t, id, id)) [_target methodForSelector: _selector]; return func(_target, _selector, object, _buffer, length, address, _context, exception); # ifdef OF_HAVE_BLOCKS @@ -438,13 +438,13 @@ return (_length > 0); } else { # endif size_t (*func)(id, SEL, OFUDPSocket *, const void *, size_t, - of_udp_socket_address_t *, id, id) = + of_socket_address_t *, id, id) = (size_t (*)(id, SEL, OFUDPSocket *, const void *, size_t, - of_udp_socket_address_t *, id, id)) + of_socket_address_t *, id, id)) [_target methodForSelector: _selector]; _length = func(_target, _selector, object, &_buffer, (exception == nil ? _length : 0), &_receiver, _context, exception); @@ -625,11 +625,11 @@ } + (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)sock buffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (id)context { ADD_WRITE(OFRunLoop_UDPSendQueueItem, sock, { @@ -715,11 +715,11 @@ } + (void)of_addAsyncSendForUDPSocket: (OFUDPSocket *)sock buffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block { ADD_WRITE(OFRunLoop_UDPSendQueueItem, sock, { queueItem->_block = [block copy]; queueItem->_buffer = buffer; Index: src/OFUDPSocket.h ================================================================== --- src/OFUDPSocket.h +++ src/OFUDPSocket.h @@ -24,20 +24,10 @@ /*! @file */ @class OFUDPSocket; -/*! - * @struct of_udp_socket_address_t OFUDPSocket.h ObjFW/OFUDPSocket.h - * - * @brief A struct which represents a host / port pair for a UDP socket. - */ -typedef struct OF_BOXABLE { - struct sockaddr_storage address; - socklen_t length; -} of_udp_socket_address_t; - #ifdef OF_HAVE_BLOCKS /*! * @brief A block which is called when the host / port pair for the UDP socket * has been resolved. * @@ -46,11 +36,11 @@ * @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, id _Nullable exception); + uint16_t port, of_socket_address_t address, id _Nullable exception); /*! * @brief A block which is called when a packet has been received. * * @param socket The UDP socket which received a packet @@ -60,11 +50,11 @@ * @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, + void *buffer, size_t length, of_socket_address_t sender, id _Nullable exception); /*! * @brief A block which is called when a packet has been sent. * @@ -83,25 +73,24 @@ * buffer, length and receiver can be specified while the callback * stays the same. */ typedef size_t (^of_udp_socket_async_send_block_t)(OFUDPSocket *socket, const void *_Nonnull *_Nonnull buffer, size_t bytesSent, - of_udp_socket_address_t *_Nonnull receiver, id exception); + of_socket_address_t *_Nonnull receiver, id exception); #endif /*! * @class OFUDPSocket OFUDPSocket.h ObjFW/OFUDPSocket.h * * @brief A class which provides methods to create and use UDP sockets. * - * Addresses are of type @ref of_udp_socket_address_t. You can use + * Addresses are of type @ref of_socket_address_t. You can use * @ref resolveAddressForHost:port:address: to create an address for a host / * port pair and @ref getHost:andPort:forAddress: to get the host / port pair * for an address. If you want to compare two addresses, you can use - * @ref of_udp_socket_address_equal and you can use - * @ref of_udp_socket_address_hash to get a hash to use in e.g. - * @ref OFMapTable. + * @ref of_socket_address_equal and you can use @ref of_socket_address_hash to + * get a hash to use in e.g. @ref OFMapTable. * * @warning Even though the OFCopying protocol is implemented, it does *not* * return an independent copy of the socket, but instead retains it. * This is so that the socket can be used as a key for a dictionary, * so context can be associated with a socket. Using a socket in more @@ -133,11 +122,11 @@ * @param address A pointer to the address that should be filled with the * host / port pair */ + (void)resolveAddressForHost: (OFString *)host port: (uint16_t)port - address: (of_udp_socket_address_t *)address; + address: (of_socket_address_t *)address; #ifdef OF_HAVE_THREADS /*! * @brief Asynchronously resolves the specified host and creates an address for * the host / port pair. @@ -146,11 +135,11 @@ * @param port The port for the resulting address * @param target The target on which to call the selector once the host has been * resolved * @param selector The selector to call on the target. The signature must be * `void (OFString *host, uint16_t port, - * of_udp_socket_address_t address, id context, id exception)`. + * of_socket_address_t address, id context, id exception)`. * @param context A context object to pass along to the target */ + (void)asyncResolveAddressForHost: (OFString *)host port: (uint16_t)port target: (id)target @@ -181,11 +170,11 @@ * 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 _Nonnull *_Nullable)host andPort: (nullable uint16_t *)port - forAddress: (of_udp_socket_address_t *)address; + forAddress: (of_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 @@ -202,17 +191,17 @@ * * If the buffer is too small, the datagram is truncated. * * @param buffer The buffer to write the datagram to * @param length The length of the buffer - * @param sender A pointer to an @ref of_udp_socket_address_t, which will be - * set to the address of the sender + * @param sender A pointer to an @ref of_socket_address_t, which will be set to + * the address of the sender * @return The length of the received datagram */ - (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length - sender: (of_udp_socket_address_t *)sender; + sender: (of_socket_address_t *)sender; /*! * @brief Asynchronously receives a datagram and stores it into the specified * buffer. * @@ -226,11 +215,11 @@ * when more datagrams have been received. If you want the next * method in the queue to handle the datagram received next, you * need to return false from the method. * @param selector The selector to call on the target. The signature must be * `bool (OFUDPSocket *socket, void *buffer, size_t length, - * of_udp_socket_address_t sender, id context, id exception)`. + * of_socket_address_t sender, id context, id exception)`. * @param context A context object to pass along to the target */ - (void)asyncReceiveIntoBuffer: (void *)buffer length: (size_t)length target: (id)target @@ -261,39 +250,39 @@ /*! * @brief Sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer - * @param receiver A pointer to an @ref of_udp_socket_address_t to which the + * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent */ - (void)sendBuffer: (const void *)buffer length: (size_t)length - receiver: (const of_udp_socket_address_t *)receiver; + receiver: (const of_socket_address_t *)receiver; /*! * @brief Asynchronously sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer - * @param receiver A pointer to an @ref of_udp_socket_address_t to which the + * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent * @param target The target on which the selector should be called when the * packet has been sent. The method should return the length for * the next send with the same callback or 0 if it should not * repeat. The buffer and receiver may be changed, so that every * time a new buffer, length and receiver can be specified while * the callback stays the same. * @param selector The selector to call on the target. The signature must be * `size_t (OFUDPSocket *socket, const void **buffer, - * size_t bytesSent, of_udp_socket_address_t *receiver, - * id context, id exception)`. + * size_t bytesSent, of_socket_address_t *receiver, id context, + * id exception)`. * @param context A context object to pass along to the target */ - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (nullable id)context; #ifdef OF_HAVE_BLOCKS @@ -300,21 +289,21 @@ /*! * @brief Asynchronously sends the specified datagram to the specified address. * * @param buffer The buffer to send as a datagram * @param length The length of the buffer - * @param receiver A pointer to an @ref of_udp_socket_address_t to which the + * @param receiver A pointer to an @ref of_socket_address_t to which the * datagram should be sent * @param block The block to call when the packet has been sent. It should * return the length for the next send with the same callback or 0 * if it should not repeat. The buffer and receiver may be * changed, so that every time a new buffer, length and receiver * can be specified while the callback stays the same. */ - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block; #endif /*! * @brief Cancels all pending asynchronous requests on the socket. @@ -329,27 +318,10 @@ @end #ifdef __cplusplus extern "C" { #endif -/*! - * @brief Compares two of_udp_socket_address_t for equality. - * - * @param address1 The address to compare with the second address - * @param address2 The second address - * @return Whether the two addresses are equal - */ -extern bool of_udp_socket_address_equal(of_udp_socket_address_t *address1, - of_udp_socket_address_t *address2); - -/*! - * @brief Returns the hash for the specified of_udp_socket_address_t. - * - * @param address The address to hash - * @return The hash for the specified of_udp_socket_address_t - */ -extern uint32_t of_udp_socket_address_hash(of_udp_socket_address_t *address); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/OFUDPSocket.m ================================================================== --- src/OFUDPSocket.m +++ src/OFUDPSocket.m @@ -54,11 +54,11 @@ SEL _selector; id _context; # ifdef OF_HAVE_BLOCKS of_udp_socket_async_resolve_block_t _block; # endif - of_udp_socket_address_t _address; + of_socket_address_t _address; id _exception; } - (instancetype)initWithSourceThread: (OFThread *)sourceThread host: (OFString *)host @@ -144,13 +144,13 @@ if (_block != NULL) _block(_host, _port, _address, _exception); else { # endif void (*func)(id, SEL, OFString *, uint16_t, - of_udp_socket_address_t, id, id) = + of_socket_address_t, id, id) = (void (*)(id, SEL, OFString *, uint16_t, - of_udp_socket_address_t, id, id)) + of_socket_address_t, id, id)) [_target methodForSelector: _selector]; func(_target, _selector, _host, _port, _address, _context, _exception); # ifdef OF_HAVE_BLOCKS @@ -179,122 +179,10 @@ return nil; } @end #endif -bool -of_udp_socket_address_equal(of_udp_socket_address_t *address1, - of_udp_socket_address_t *address2) -{ - struct sockaddr_in *addrIn1, *addrIn2; -#ifdef HAVE_IPV6 - struct sockaddr_in6 *addrIn6_1, *addrIn6_2; -#endif - - if (address1->address.ss_family != address2->address.ss_family) - return false; - - switch (address1->address.ss_family) { - case AF_INET: -#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) - if (address1->length < (socklen_t)sizeof(struct sockaddr_in) || - address2->length < (socklen_t)sizeof(struct sockaddr_in)) - @throw [OFInvalidArgumentException exception]; -#else - if (address1->length < 8 || address2->length < 8) - @throw [OFInvalidArgumentException exception]; -#endif - - addrIn1 = (struct sockaddr_in *)&address1->address; - addrIn2 = (struct sockaddr_in *)&address2->address; - - if (addrIn1->sin_port != addrIn2->sin_port) - return false; - if (addrIn1->sin_addr.s_addr != addrIn2->sin_addr.s_addr) - return false; - - break; -#ifdef HAVE_IPV6 - case AF_INET6: - if (address1->length < sizeof(struct sockaddr_in6) || - address2->length < sizeof(struct sockaddr_in6)) - @throw [OFInvalidArgumentException exception]; - - addrIn6_1 = (struct sockaddr_in6 *)&address1->address; - addrIn6_2 = (struct sockaddr_in6 *)&address2->address; - - if (addrIn6_1->sin6_port != addrIn6_2->sin6_port) - return false; - if (memcmp(addrIn6_1->sin6_addr.s6_addr, - addrIn6_2->sin6_addr.s6_addr, - sizeof(addrIn6_1->sin6_addr.s6_addr)) != 0) - return false; - - break; -#endif - default: - @throw [OFInvalidArgumentException exception]; - } - - return true; -} - -uint32_t -of_udp_socket_address_hash(of_udp_socket_address_t *address) -{ - uint32_t hash = of_hash_seed; - struct sockaddr_in *addrIn; -#ifdef HAVE_IPV6 - struct sockaddr_in6 *addrIn6; - uint32_t subhash; -#endif - - hash += address->address.ss_family; - - switch (address->address.ss_family) { - case AF_INET: -#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) - if (address->length < (socklen_t)sizeof(struct sockaddr_in)) - @throw [OFInvalidArgumentException exception]; -#else - if (address->length < 8) - @throw [OFInvalidArgumentException exception]; -#endif - - addrIn = (struct sockaddr_in *)&address->address; - - hash += (addrIn->sin_port << 1); - hash ^= addrIn->sin_addr.s_addr; - - break; -#ifdef HAVE_IPV6 - case AF_INET6: - if (address->length < sizeof(struct sockaddr_in6)) - @throw [OFInvalidArgumentException exception]; - - addrIn6 = (struct sockaddr_in6 *)&address->address; - - hash += (addrIn6->sin6_port << 1); - - OF_HASH_INIT(subhash); - - for (size_t i = 0; i < sizeof(addrIn6->sin6_addr.s6_addr); i++) - OF_HASH_ADD(subhash, adrIn6->sin6_addr.s6_addr[i]); - - OF_HASH_FINALIZE(subhash); - - hash ^= subhash; - - break; -#endif - default: - @throw [OFInvalidArgumentException exception]; - } - - return hash; -} - @implementation OFUDPSocket + (void)initialize { if (self != [OFUDPSocket class]) return; @@ -309,11 +197,11 @@ return [[[self alloc] init] autorelease]; } + (void)resolveAddressForHost: (OFString *)host port: (uint16_t)port - address: (of_udp_socket_address_t *)address + address: (of_socket_address_t *)address { of_resolver_result_t **results = of_resolve_host(host, port, SOCK_DGRAM); assert(results[0]->addressLength <= @@ -364,11 +252,11 @@ # endif #endif + (void)getHost: (OFString *__autoreleasing *)host andPort: (uint16_t *)port - forAddress: (of_udp_socket_address_t *)address + forAddress: (of_socket_address_t *)address { of_address_to_string_and_port( (struct sockaddr *)&address->address, address->length, host, port); } @@ -533,11 +421,11 @@ errNo: EAFNOSUPPORT]; } - (size_t)receiveIntoBuffer: (void *)buffer length: (size_t)length - sender: (of_udp_socket_address_t *)sender + sender: (of_socket_address_t *)sender { ssize_t ret; if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; @@ -592,11 +480,11 @@ } #endif - (void)sendBuffer: (const void *)buffer length: (size_t)length - receiver: (const of_udp_socket_address_t *)receiver + receiver: (const of_socket_address_t *)receiver { if (_socket == INVALID_SOCKET) @throw [OFNotOpenException exceptionWithObject: self]; #ifndef OF_WINDOWS @@ -635,11 +523,11 @@ errNo: 0]; } - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver target: (id)target selector: (SEL)selector context: (id)context { [OFRunLoop of_addAsyncSendForUDPSocket: self @@ -652,11 +540,11 @@ } #ifdef OF_HAVE_BLOCKS - (void)asyncSendBuffer: (const void *)buffer length: (size_t)length - receiver: (of_udp_socket_address_t)receiver + receiver: (of_socket_address_t)receiver block: (of_udp_socket_async_send_block_t)block { [OFRunLoop of_addAsyncSendForUDPSocket: self buffer: buffer length: length Index: src/socket.h ================================================================== --- src/socket.h +++ src/socket.h @@ -45,10 +45,12 @@ # endif # endif # include # include #endif + +/*! @file */ #ifdef OF_AMIGAOS struct sockaddr_storage { uint8_t ss_len; uint8_t ss_family; @@ -100,19 +102,47 @@ typedef int of_socket_t; #else typedef SOCKET of_socket_t; #endif +/*! + * @struct of_socket_address_t socket.h ObjFW/socket.h + * + * @brief A struct which represents a host / port pair for a socket. + */ +typedef struct OF_BOXABLE { + struct sockaddr_storage address; + socklen_t length; +} of_socket_address_t; + #ifdef __cplusplus extern "C" { #endif extern bool of_socket_init(void); extern int of_socket_errno(void); # ifndef OF_WII extern int of_getsockname(of_socket_t sock, struct sockaddr *restrict addr, socklen_t *restrict addrLen); # endif + +/*! + * @brief Compares two of_socket_address_t for equality. + * + * @param address1 The address to compare with the second address + * @param address2 The second address + * @return Whether the two addresses are equal + */ +extern bool of_socket_address_equal(of_socket_address_t *address1, + of_socket_address_t *address2); + +/*! + * @brief Returns the hash for the specified of_socket_address_t. + * + * @param address The address to hash + * @return The hash for the specified of_socket_address_t + */ +extern uint32_t of_socket_address_hash(of_socket_address_t *address); #ifdef __cplusplus } #endif OF_ASSUME_NONNULL_END Index: src/socket.m ================================================================== --- src/socket.m +++ src/socket.m @@ -216,5 +216,117 @@ # endif return ret; } #endif + +bool +of_socket_address_equal(of_socket_address_t *address1, + of_socket_address_t *address2) +{ + struct sockaddr_in *addrIn1, *addrIn2; +#ifdef HAVE_IPV6 + struct sockaddr_in6 *addrIn6_1, *addrIn6_2; +#endif + + if (address1->address.ss_family != address2->address.ss_family) + return false; + + switch (address1->address.ss_family) { + case AF_INET: +#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) + if (address1->length < (socklen_t)sizeof(struct sockaddr_in) || + address2->length < (socklen_t)sizeof(struct sockaddr_in)) + @throw [OFInvalidArgumentException exception]; +#else + if (address1->length < 8 || address2->length < 8) + @throw [OFInvalidArgumentException exception]; +#endif + + addrIn1 = (struct sockaddr_in *)&address1->address; + addrIn2 = (struct sockaddr_in *)&address2->address; + + if (addrIn1->sin_port != addrIn2->sin_port) + return false; + if (addrIn1->sin_addr.s_addr != addrIn2->sin_addr.s_addr) + return false; + + break; +#ifdef HAVE_IPV6 + case AF_INET6: + if (address1->length < sizeof(struct sockaddr_in6) || + address2->length < sizeof(struct sockaddr_in6)) + @throw [OFInvalidArgumentException exception]; + + addrIn6_1 = (struct sockaddr_in6 *)&address1->address; + addrIn6_2 = (struct sockaddr_in6 *)&address2->address; + + if (addrIn6_1->sin6_port != addrIn6_2->sin6_port) + return false; + if (memcmp(addrIn6_1->sin6_addr.s6_addr, + addrIn6_2->sin6_addr.s6_addr, + sizeof(addrIn6_1->sin6_addr.s6_addr)) != 0) + return false; + + break; +#endif + default: + @throw [OFInvalidArgumentException exception]; + } + + return true; +} + +uint32_t +of_socket_address_hash(of_socket_address_t *address) +{ + uint32_t hash = of_hash_seed; + struct sockaddr_in *addrIn; +#ifdef HAVE_IPV6 + struct sockaddr_in6 *addrIn6; + uint32_t subhash; +#endif + + hash += address->address.ss_family; + + switch (address->address.ss_family) { + case AF_INET: +#if !defined(OF_WII) && !defined(OF_NINTENDO_3DS) + if (address->length < (socklen_t)sizeof(struct sockaddr_in)) + @throw [OFInvalidArgumentException exception]; +#else + if (address->length < 8) + @throw [OFInvalidArgumentException exception]; +#endif + + addrIn = (struct sockaddr_in *)&address->address; + + hash += (addrIn->sin_port << 1); + hash ^= addrIn->sin_addr.s_addr; + + break; +#ifdef HAVE_IPV6 + case AF_INET6: + if (address->length < sizeof(struct sockaddr_in6)) + @throw [OFInvalidArgumentException exception]; + + addrIn6 = (struct sockaddr_in6 *)&address->address; + + hash += (addrIn6->sin6_port << 1); + + OF_HASH_INIT(subhash); + + for (size_t i = 0; i < sizeof(addrIn6->sin6_addr.s6_addr); i++) + OF_HASH_ADD(subhash, adrIn6->sin6_addr.s6_addr[i]); + + OF_HASH_FINALIZE(subhash); + + hash ^= subhash; + + break; +#endif + default: + @throw [OFInvalidArgumentException exception]; + } + + return hash; +} Index: tests/OFUDPSocketTests.m ================================================================== --- tests/OFUDPSocketTests.m +++ tests/OFUDPSocketTests.m @@ -31,11 +31,11 @@ - (void)UDPSocketTests { OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init]; OFUDPSocket *sock; uint16_t port1, port2; - of_udp_socket_address_t addr1, addr2, addr3; + of_socket_address_t addr1, addr2, addr3; char buf[6]; OFString *host; TEST(@"+[socket]", (sock = [OFUDPSocket socket])) @@ -67,18 +67,20 @@ [OFUDPSocket resolveAddressForHost: @"127.0.0.1" port: port1 + 1 address: &addr3]; - TEST(@"of_udp_socket_address_equal()", - of_udp_socket_address_equal(&addr1, &addr2) && - !of_udp_socket_address_equal(&addr1, &addr3)) - - TEST(@"of_udp_socket_address_hash()", - of_udp_socket_address_hash(&addr1) == - of_udp_socket_address_hash(&addr2) && - of_udp_socket_address_hash(&addr1) != - of_udp_socket_address_hash(&addr3)) + /* + * TODO: Move those tests elsewhere as soon as the DNS resolving part + * is no longer in OFUDPSocket. + */ + TEST(@"of_socket_address_equal()", + of_socket_address_equal(&addr1, &addr2) && + !of_socket_address_equal(&addr1, &addr3)) + + TEST(@"of_socket_address_hash()", + of_socket_address_hash(&addr1) == of_socket_address_hash(&addr2) && + of_socket_address_hash(&addr1) != of_socket_address_hash(&addr3)) [pool drain]; } @end