* Adapted API as needed, and implemented most of the C++ API - it's completely
untested at this point, though. * Will port ifconfig, NetworkStatus, and the Network preferences application later in order to test the API. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37988 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include <Archivable.h>
|
||||
#include <String.h>
|
||||
|
||||
|
||||
class BNetworkAddress : public BArchivable {
|
||||
@@ -21,10 +22,12 @@ public:
|
||||
const char* address, uint16 port = 0);
|
||||
BNetworkAddress(const char* address,
|
||||
uint16 port = 0);
|
||||
BNetworkAddress(const sockaddr* address);
|
||||
BNetworkAddress(const sockaddr_in* address);
|
||||
BNetworkAddress(const sockaddr_in6* address);
|
||||
BNetworkAddress(const sockaddr_dl* address);
|
||||
BNetworkAddress(const sockaddr& address);
|
||||
BNetworkAddress(
|
||||
const sockaddr_storage& address);
|
||||
BNetworkAddress(const sockaddr_in& address);
|
||||
BNetworkAddress(const sockaddr_in6& address);
|
||||
BNetworkAddress(const sockaddr_dl& address);
|
||||
BNetworkAddress(const in_addr_t address);
|
||||
BNetworkAddress(const in6_addr* address);
|
||||
BNetworkAddress(const BNetworkAddress& other);
|
||||
@@ -38,10 +41,11 @@ public:
|
||||
status_t SetTo(int family, const char* address,
|
||||
uint16 port = 0);
|
||||
status_t SetTo(const char* address, uint16 port = 0);
|
||||
void SetTo(const sockaddr* address);
|
||||
void SetTo(const sockaddr_in* address);
|
||||
void SetTo(const sockaddr_in6* address);
|
||||
void SetTo(const sockaddr_dl* address);
|
||||
void SetTo(const sockaddr& address);
|
||||
void SetTo(const sockaddr_storage& address);
|
||||
void SetTo(const sockaddr_in& address);
|
||||
void SetTo(const sockaddr_in6& address);
|
||||
void SetTo(const sockaddr_dl& address);
|
||||
void SetTo(const in_addr_t address);
|
||||
void SetTo(const in6_addr* address);
|
||||
void SetTo(const BNetworkAddress& other);
|
||||
@@ -63,6 +67,7 @@ public:
|
||||
int Family() const;
|
||||
uint16 Port() const;
|
||||
size_t Length() const;
|
||||
const sockaddr& SockAddr() const;
|
||||
|
||||
bool IsEmpty() const;
|
||||
bool IsWildcard() const;
|
||||
@@ -84,17 +89,20 @@ public:
|
||||
uint8* LinkLevelAddress() const;
|
||||
size_t LinkLevelAddressLength() const;
|
||||
|
||||
BNetworkAddress ResolvedForDestination(
|
||||
const BNetworkAddress& destination) const;
|
||||
void ResolveTo(const BNetworkAddress& address);
|
||||
status_t ResolveForDestination(
|
||||
const BNetworkAddress& destination);
|
||||
status_t ResolveTo(const BNetworkAddress& address);
|
||||
|
||||
BString ToString() const;
|
||||
BString ToString(bool includePort = true) const;
|
||||
BString HostName() const;
|
||||
BString PortName() const;
|
||||
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* archive);
|
||||
|
||||
bool Equals(const BNetworkAddress& other,
|
||||
bool includePort = true) const;
|
||||
|
||||
BNetworkAddress& operator=(const BNetworkAddress& other);
|
||||
|
||||
bool operator==(const BNetworkAddress& other) const;
|
||||
|
||||
Reference in New Issue
Block a user