-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
arp.h
41 lines (29 loc) · 955 Bytes
/
arp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// (C) 2020-2022 by folkert van heusden <[email protected]>, released under Apache License v2.0
#pragma once
#include <map>
#include <shared_mutex>
#include "mac_resolver.h"
#include "network_layer.h"
#include "phys.h"
#include "stats.h"
typedef struct {
uint64_t ts;
any_addr addr;
} arp_entry_t;
class arp : public mac_resolver
{
private:
const any_addr my_mac;
const any_addr my_ip;
uint64_t *arp_requests { nullptr };
uint64_t *arp_for_me { nullptr };
std::thread *arp_th { nullptr };
std::atomic_bool arp_stop_flag { false };
phys *const interface { nullptr };
bool send_request(const any_addr & ip, const any_addr::addr_family af) override;
std::optional<any_addr> check_special_ip_addresses(const any_addr & ip, const any_addr::addr_family family) override;
public:
arp(stats *const s, phys *const interface, const any_addr & mymac, const any_addr & myip);
virtual ~arp();
void operator()() override;
};