@@ -12,12 +12,11 @@ * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "OFStream.h" - -#import "socket.h" +#import "OFSocket.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @@ -31,12 +30,12 @@ * @param exception An exception which occurred while accepting the socket or * `nil` on success * @return A bool whether the same block should be used for the next incoming * connection */ -typedef bool (^of_stream_socket_async_accept_block_t)( - OFStreamSocket *acceptedSocket, id _Nullable exception); +typedef bool (^OFStreamSocketAsyncAcceptBlock)(OFStreamSocket *acceptedSocket, + id _Nullable exception); #endif /** * @protocol OFStreamSocketDelegate OFStreamSocket.h ObjFW/OFStreamSocket.h * @@ -64,13 +63,13 @@ * @brief A class which provides methods to create and use stream sockets. */ @interface OFStreamSocket: OFStream { - of_socket_t _socket; + OFSocketHandle _socket; bool _atEndOfStream, _listening; - of_socket_address_t _remoteAddress; + OFSocketAddress _remoteAddress; OF_RESERVE_IVARS(OFStreamSocket, 4) } /** * @brief Whether the socket is a listening socket. @@ -80,11 +79,11 @@ /** * @brief The remote address. * * @note This only works for accepted sockets! */ -@property (readonly, nonatomic) const of_socket_address_t *remoteAddress; +@property (readonly, nonatomic) const OFSocketAddress *remoteAddress; /** * @brief The delegate for asynchronous operations on the socket. * * @note The delegate is retained for as long as asynchronous operations are @@ -127,32 +126,31 @@ /** * @brief Asynchronously accept an incoming connection. * * @param runLoopMode The run loop mode in which to perform the async accept */ -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode; +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode; #ifdef OF_HAVE_BLOCKS /** * @brief Asynchronously accept an incoming connection. * * @param block The block to execute when a new connection has been accepted. * Returns whether the next incoming connection should be accepted * by the specified block as well. */ -- (void)asyncAcceptWithBlock: (of_stream_socket_async_accept_block_t)block; +- (void)asyncAcceptWithBlock: (OFStreamSocketAsyncAcceptBlock)block; /** * @brief Asynchronously accept an incoming connection. * * @param runLoopMode The run loop mode in which to perform the async accept * @param block The block to execute when a new connection has been accepted. * Returns whether the next incoming connection should be accepted * by the specified block as well. */ -- (void)asyncAcceptWithRunLoopMode: (of_run_loop_mode_t)runLoopMode - block: (of_stream_socket_async_accept_block_t) - block; +- (void)asyncAcceptWithRunLoopMode: (OFRunLoopMode)runLoopMode + block: (OFStreamSocketAsyncAcceptBlock)block; #endif @end OF_ASSUME_NONNULL_END