1 /* 2 * Copyright 2010, Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _NETWORK_ROSTER_H 6 #define _NETWORK_ROSTER_H 7 8 9 #include <Locker.h> 10 #include <NetworkNotifications.h> 11 #include <ObjectList.h> 12 13 class BMessenger; 14 class BNetworkInterface; 15 struct route_entry; 16 struct wireless_network; 17 18 19 class BNetworkRoster { 20 public: 21 static BNetworkRoster& Default(); 22 23 size_t CountInterfaces() const; 24 status_t GetNextInterface(uint32* cookie, 25 BNetworkInterface& interface) const; 26 27 status_t AddInterface(const char* name); 28 status_t AddInterface( 29 const BNetworkInterface& interface); 30 status_t RemoveInterface(const char* name); 31 status_t RemoveInterface( 32 const BNetworkInterface& interface); 33 34 status_t GetRoutes(int family, 35 BObjectList<route_entry>& routes) const; 36 37 int32 CountPersistentNetworks() const; 38 status_t GetNextPersistentNetwork(uint32* cookie, 39 wireless_network& network) const; 40 status_t AddPersistentNetwork( 41 const wireless_network& network); 42 status_t RemovePersistentNetwork(const char* name); 43 44 status_t StartWatching(const BMessenger& target, 45 uint32 eventMask); 46 void StopWatching(const BMessenger& target); 47 48 private: 49 BNetworkRoster(); 50 ~BNetworkRoster(); 51 52 private: 53 static BNetworkRoster sDefault; 54 }; 55 56 57 #endif // _NETWORK_ROSTER_H 58