@@ -18,10 +18,12 @@ #import "OFException.h" #ifndef OF_HAVE_SOCKETS # error No sockets available! #endif + +#import "socket.h" OF_ASSUME_NONNULL_BEGIN /*! * @class OFBindFailedException \ @@ -30,12 +32,15 @@ * @brief An exception indicating that binding a socket failed. */ @interface OFBindFailedException: OFException { id _socket; + /* IP */ OFString *_host; uint16_t _port; + /* IPX */ + uint8_t _packetType; int _errNo; } /*! * @brief The host on which binding failed. @@ -45,10 +50,15 @@ /*! * @brief The port on which binding failed. */ @property (readonly, nonatomic) uint16_t port; +/*! + * @brief The IPX packet type for which binding failed. + */ +@property (readonly, nonatomic) uint8_t packetType; + /*! * @brief The socket which could not be bound. */ @property (readonly, nonatomic) id socket; @@ -71,10 +81,24 @@ + (instancetype)exceptionWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket errNo: (int)errNo; +/*! + * @brief Creates a new, autoreleased bind failed exception. + * + * @param port The IPX port to which binding failed + * @param packetType The IPX packet type for which binding failed + * @param socket The socket which could not be bound + * @param errNo The errno of the error that occurred + * @return A new, autoreleased bind failed exception + */ ++ (instancetype)exceptionWithPort: (uint16_t)port + packetType: (uint8_t)packetType + socket: (id)socket + errNo: (int)errNo; + - (instancetype)init OF_UNAVAILABLE; /*! * @brief Initializes an already allocated bind failed exception. * @@ -85,9 +109,23 @@ * @return An initialized bind failed exception */ - (instancetype)initWithHost: (OFString *)host port: (uint16_t)port socket: (id)socket - errNo: (int)errNo OF_DESIGNATED_INITIALIZER; + errNo: (int)errNo; + +/*! + * @brief Initializes an already allocated bind failed exception. + * + * @param port The IPX port to which binding failed + * @param packetType The IPX packet type for which binding failed + * @param socket The socket which could not be bound + * @param errNo The errno of the error that occurred + * @return An initialized bind failed exception + */ +- (instancetype)initWithPort: (uint16_t)port + packetType: (uint8_t)packetType + socket: (id)socket + errNo: (int)errNo; @end OF_ASSUME_NONNULL_END