Add a network-associated user ptr in API.

This commit is contained in:
Adam Ierymenko 2016-01-12 11:04:35 -08:00
parent 3edfbfec93
commit 83ef98a9dc
9 changed files with 68 additions and 46 deletions

View file

@ -80,8 +80,9 @@ public:
*
* @param renv Runtime environment
* @param nwid Network ID
* @param uptr Arbitrary pointer used by externally-facing API (for user use)
*/
Network(const RuntimeEnvironment *renv,uint64_t nwid);
Network(const RuntimeEnvironment *renv,uint64_t nwid,void *uptr);
~Network();
@ -331,6 +332,11 @@ public:
*/
void destroy();
/**
* @return User ptr
*/
inline void *userPtr() const throw() { return _uptr; }
inline bool operator==(const Network &n) const throw() { return (_id == n._id); }
inline bool operator!=(const Network &n) const throw() { return (_id != n._id); }
inline bool operator<(const Network &n) const throw() { return (_id < n._id); }
@ -348,6 +354,7 @@ private:
std::vector<MulticastGroup> _allMulticastGroups() const;
const RuntimeEnvironment *RR;
void *_uptr;
uint64_t _id;
MAC _mac; // local MAC address
volatile bool _enabled;