master
h 30 lines 931 Bytes
Raw
1 // Copyright (C) Microsoft Corporation. All rights reserved.
2 #pragma once
3
4 #include <functional>
5 #include "NetlinkChannel.h"
6 #include "Neighbor.h"
7 #include "Operation.h"
8
9 class IpNeighborManager
10 {
11 public:
12 /*
13 Implement netlink equivalent of "ip neigh <operation> <IP> lladdr <MAC> dev <interface> nud permanent".
14 */
15 void ModifyNeighborEntry(const Neighbor& Neighbor, Operation operation);
16
17 static bool PerformNeighborDiscovery(Neighbor& Local, Neighbor& Neighbor);
18
19 private:
20 template <typename TAddr>
21 void ModifyNeighborEntryImpl(const Neighbor& Neighbor, int operation, int flags);
22
23 /*
24 Creates the message using the routine, then sends the message via netlink.
25 */
26 template <typename T>
27 void SendMessage(const Neighbor& Neighbor, int operation, int flags, const std::function<void(T&)>& routine = [](auto&) {});
28
29 NetlinkChannel m_channel;
30 };