@@ -16,11 +16,31 @@ #import "OFObject.h" #import "OFString.h" OF_ASSUME_NONNULL_BEGIN +@class OFDictionary OF_GENERIC(KeyType, ObjectType); @class OFIRI; + +#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS) +/** + * @brief A key in the per-interface dictionary returned by + * @ref networkInterfaces. + * + * Possible keys are: + * + * * @ref OFNetworkInterfaceAddresses + */ +typedef OFString *OFNetworkInterfaceInfoKey; + +/** + * @brief The addresses of a network interface. + * + * This maps to an @ref OFData of @ref OFSocketAddress. + */ +extern const OFConstantString *OFNetworkInterfaceAddresses; +#endif /** * @class OFSystemInfo OFSystemInfo.h ObjFW/OFSystemInfo.h * * @brief A class for querying information about the system. @@ -59,10 +79,15 @@ # if defined(OF_POWERPC) || defined(OF_POWERPC64) || defined(DOXYGEN) @property (class, readonly, nonatomic) bool supportsAltiVec; # endif # ifdef OF_WINDOWS @property (class, readonly, nonatomic, getter=isWindowsNT) bool windowsNT; +# endif +# if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS) +@property (class, readonly, nonatomic) OFDictionary OF_GENERIC(OFString *, + OFDictionary OF_GENERIC(OFNetworkInterfaceInfoKey, id) *) + *networkInterfaces; # endif #endif /** * @brief Returns the size of a page. @@ -335,11 +360,22 @@ * * @return Whether the application is running on Windows NT */ + (bool)isWindowsNT; #endif + +#if defined(OF_HAVE_SOCKETS) && defined(OF_HAVE_GETIFADDRS) +/** + * @brief Returns the available (though not necessarily configured) network + * interfaces and information about them. + * + * @return The available network interfaces and information about them + */ ++ (OFDictionary OF_GENERIC(OFString *, OFDictionary + OF_GENERIC(OFNetworkInterfaceInfoKey, id) *) *)networkInterfaces; +#endif + (instancetype)alloc OF_UNAVAILABLE; - (instancetype)init OF_UNAVAILABLE; @end OF_ASSUME_NONNULL_END