|
| | NeighborManager (Reactor *reactor=nullptr) |
| | create instance.
|
| |
| | NeighborManager (const NeighborManager &other)=delete |
| | create instance by copy.
|
| |
| | NeighborManager (NeighborManager &&other)=delete |
| | create instance by move.
|
| |
| NeighborManager & | operator= (const NeighborManager &other)=delete |
| | assign instance by copy.
|
| |
| NeighborManager & | operator= (NeighborManager &&other)=delete |
| | assign instance by move.
|
| |
| | ~NeighborManager () |
| | destroy instance.
|
| |
| Neighbor::Ptr | findByIndex (uint32_t index, const IpAddress &ipAddress) |
| | find a neighbor entry by interface index and IP address.
|
| |
| Neighbor::Ptr | findByName (const std::string &interfaceName, const IpAddress &ipAddress) |
| | find a neighbor entry by interface name and IP address.
|
| |
| NeighborList | enumerate () |
| | enumerate all cached neighbor entries.
|
| |
| NeighborList | enumerate (uint32_t index) |
| | enumerate all cached neighbor entries for a given interface.
|
| |
| NeighborList | enumerate (const std::string &interfaceName) |
| | enumerate all cached neighbor entries for a given interface.
|
| |
| int | refresh () |
| | refresh all data.
|
| |
| uint64_t | addNeighborListener (const NeighborNotify &cb) |
| | register a callback invoked on any neighbor table change.
|
| |
| void | removeNeighborListener (uint64_t id) |
| | unregister a previously registered callback.
|
| |
| int | addNeighbor (uint32_t index, const IpAddress &ipAddress, const MacAddress &macAddress, uint16_t state=NUD_PERMANENT, bool sync=false) |
| | add or replace a neighbor entry in the kernel table.
|
| |
| int | addNeighbor (const std::string &interfaceName, const IpAddress &ipAddress, const MacAddress &macAddress, uint16_t state=NUD_PERMANENT, bool sync=false) |
| | add or replace a neighbor entry in the kernel table.
|
| |
| int | removeNeighbor (uint32_t index, const IpAddress &ipAddress, bool sync=false) |
| | remove a neighbor entry from the kernel table.
|
| |
| int | removeNeighbor (const std::string &interfaceName, const IpAddress &ipAddress, bool sync=false) |
| | remove a neighbor entry from the kernel table.
|
| |
| int | flushNeighbors (uint32_t index, bool sync=false) |
| | flush all neighbor entries for a given interface.
|
| |
| int | flushNeighbors (const std::string &interfaceName, bool sync=false) |
| | flush all neighbor entries for a given interface.
|
| |
| | NetlinkManager (uint32_t groups, Reactor *reactor=nullptr) |
| | create instance.
|
| |
| | NetlinkManager (const NetlinkManager &)=delete |
| | create instance by copy.
|
| |
| | NetlinkManager (NetlinkManager &&)=delete |
| | create instance by move.
|
| |
| NetlinkManager & | operator= (const NetlinkManager &)=delete |
| | assign instance by copy.
|
| |
| NetlinkManager & | operator= (NetlinkManager &&)=delete |
| | assign instance by move.
|
| |
| virtual | ~NetlinkManager () |
| | destroy instance.
|
| |
| Reactor * | reactor () const noexcept |
| | get the event loop reactor.
|
| |
|
| void | start () |
| | start listening for netlink events.
|
| |
| void | stop () |
| | stop listening for netlink events.
|
| |
| int | sendRequest (struct nlmsghdr *nlh, bool sync, std::chrono::milliseconds timeout=std::chrono::seconds(5)) |
| | send a netlink request, optionally waiting for the ack.
|
| |
| template<class Rep , class Period > |
| int | waitResponse (ScopedLock< Mutex > &lock, uint32_t seq, std::chrono::duration< Rep, Period > timeout) |
| | wait for specific netlink response.
|
| |
| template<typename Func , typename... Args> |
| void | pushJob (Func &&func, Args &&... args) noexcept |
| | push a job to be executed on the reactor thread.
|
| |
| virtual void | onReceive (int fd) override final |
| | method called when data are ready to be read on handle.
|
| |
| void | notifyRequest (uint32_t seq, int error=0) |
| | notify a pending synchronous request.
|
| |
| static void | addAttributes (struct nlmsghdr *nlh, int type, const void *data, int alen) |
| | add an attribute to a netlink message.
|
| |
| static struct rtattr * | startNestedAttributes (struct nlmsghdr *nlh, int type) |
| | open a nested attribute block.
|
| |
| static int | stopNestedAttributes (struct nlmsghdr *nlh, struct rtattr *nested) |
| | close a nested attribute block.
|
| |
| template<typename T , typename Flag > |
| static Flag | updateValue (T &oldVal, const T &newVal, Flag changed) |
| | update a value in place and report whether it changed.
|
| |
| std::unique_ptr< char[]> | _buffer |
| | internal read buffer.
|
| |
| std::atomic< uint32_t > | _seq |
| | sequence number.
|
| |
| std::unordered_map< uint32_t, std::unique_ptr< PendingRequest > > | _pending |
| | synchronous requests indexed by sequence number.
|
| |
| Mutex | _syncMutex |
| | protection mutex.
|
| |
| LocalMem::Mpsc::Queue< Job * > | _jobs |
| | job queue.
|
| |
| int | _wakeup = -1 |
| | eventfd used to wake the reactor thread for pending jobs.
|
| |
| Reactor * | _reactor |
| | event loop reactor.
|
| |
| static constexpr size_t | _bufferSize = 16384 |
| | internal buffer size.
|
| |
| static constexpr size_t | _jobQueueSize = 256 |
| | job queue size.
|
| |
ARP / NDP neighbor manager class.