// NetAddress.h #ifndef NET_FS_NET_ADDRESS_H #define NET_FS_NET_ADDRESS_H #ifdef HAIKU_TARGET_PLATFORM_BEOS # include #else # include # include #endif namespace BPrivate { class HashString; }; using BPrivate::HashString; // NetAddress class NetAddress { public: NetAddress(); NetAddress(const sockaddr_in& address); NetAddress(const NetAddress& address); void SetIP(int32 address); int32 GetIP() const; void SetPort(uint16 port); uint16 GetPort() const; void SetAddress(const sockaddr_in& address); const sockaddr_in& GetAddress() const; bool IsLocal() const; status_t GetString(HashString* string, bool includePort = true) const; uint32 GetHashCode() const; NetAddress& operator=(const NetAddress& address); bool operator==(const NetAddress& address) const; bool operator!=(const NetAddress& address) const; private: sockaddr_in fAddress; }; // NetAddressResolver class NetAddressResolver { public: NetAddressResolver(); ~NetAddressResolver(); status_t InitCheck() const; status_t GetHostAddress(const char* hostName, NetAddress* address); private: class Resolver; static void _Lock(); static void _Unlock(); Resolver* fResolver; static Resolver* volatile sResolver; static int32 sLockCounter; }; #endif // NET_FS_NET_ADDRESS_H