-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ntp.h
37 lines (27 loc) · 974 Bytes
/
ntp.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
// (C) 2020-2022 by folkert van heusden <[email protected]>, released under Apache License v2.0
#pragma once
#include <atomic>
#include <stdint.h>
#include <thread>
#include "any_addr.h"
#include "application.h"
#include "stats.h"
class packet;
class udp;
class ntp : public application
{
private:
udp *const u;
const any_addr my_ip, upstream_ntp_server;
const bool broadcast;
std::thread *th { nullptr };
uint64_t *ntp_requests { nullptr }, *ntp_invalid { nullptr }, *ntp_time_req { nullptr };
uint64_t *ntp_t_req_v[8] { nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr };
uint64_t *ntp_broadcast { nullptr };
public:
ntp(stats *const s, udp *const u, const any_addr & my_ip, const any_addr & upstream_ntp_server, const bool broadcast);
ntp(const ntp &) = delete;
virtual ~ntp();
void input(const any_addr & src_ip, int src_port, const any_addr & dst_ip, int dst_port, packet *p, session_data *const pd);
void operator()();
};