* 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:
Axel Dörfler
2010-08-09 16:31:40 +00:00
parent 7e31a05ca5
commit c2808ea7b2
7 changed files with 1477 additions and 22 deletions
+16 -5
View File
@@ -21,9 +21,12 @@ public:
BNetworkInterfaceAddress();
~BNetworkInterfaceAddress();
status_t SetTo(BNetworkInterface& interface,
int32 index);
void SetAddress(BNetworkAddress& address);
void SetMask(BNetworkAddress& mask);
void SetBroadcast(BNetworkAddress& mask);
void SetBroadcast(BNetworkAddress& broadcast);
BNetworkAddress& Address() { return fAddress; }
BNetworkAddress& Mask() { return fMask; }
@@ -36,9 +39,10 @@ public:
void SetFlags(uint32 flags);
uint32 Flags() const { return fFlags; }
int32 Index() const { return fIndex; }
private:
BNetworkInterface* fInterface;
uint32 fIndex;
int32 fIndex;
BNetworkAddress fAddress;
BNetworkAddress fMask;
BNetworkAddress fBroadcast;
@@ -53,9 +57,14 @@ public:
BNetworkInterface(uint32 index);
~BNetworkInterface();
void Unset();
void SetTo(const char* name);
status_t SetTo(uint32 index);
bool Exists() const;
const char* Name() const;
uint32 Index() const;
uint32 Flags() const;
uint32 MTU() const;
uint32 Type() const;
@@ -66,10 +75,13 @@ public:
status_t SetMTU(uint32 mtu);
int32 CountAddresses() const;
BNetworkInterfaceAddress* AddressAt(int32 index);
status_t GetAddressAt(int32 index,
BNetworkInterfaceAddress& address);
status_t AddAddress(
const BNetworkInterfaceAddress& address);
status_t SetAddress(
const BNetworkInterfaceAddress& address);
status_t RemoveAddress(
const BNetworkInterfaceAddress& address);
status_t RemoveAddressAt(int32 index);
@@ -78,7 +90,6 @@ public:
private:
char fName[IF_NAMESIZE];
uint32 fIndex;
BList fAddresses;
};