#include "common.h"
#include "ntp.h"
#include "settings.h"
#include "sockets.h"
#include "if/core/hosts.h"
#include "if/gnet_property.h"
#include "if/gnet_property_priv.h"
#include "lib/cq.h"
#include "lib/endian.h"
#include "lib/misc.h"
#include "lib/tm.h"
#include "lib/override.h"
Data Structures | |
| struct | ntp_msg |
| An NTP message, as described in RFC2030 (trailing auth-data ignored). More... | |
Defines | |
| #define | OFFSET_1900 2208988800U |
| secs between 1900 and the Epoch | |
| #define | NTP_FP_SCALE 4294967296.0 |
| NTP fixed-point scaling base. | |
| #define | NTP_WAIT_MS (5*1000) |
| Wait at most 5 secs for reply. | |
| #define | NTP_VERSION 3 |
| Say we're version 3. | |
| #define | NTP_CLIENT 3 |
| Mode for unicast request. | |
| #define | NTP_SERVER 4 |
| Mode for server reply. | |
| #define | NTP_AUTHSIZE 20 |
| Size of NTP auth, when present. | |
| #define | NTP_MINSIZE sizeof(struct ntp_msg) |
| #define | NTP_MAXSIZE (NTP_MINSIZE + NTP_AUTHSIZE) |
Functions | |
| void | ntp_tm_serialize (guchar dest[8], tm_t *t) |
| Fill 8-byte buffer with NTP's representation of a tm_t time. | |
| void | ntp_tm_deserialize (const guchar src[8], tm_t *dest) |
| Construct a tm_t time from an NTP timestamp. | |
| void | ntp_no_reply (cqueue_t *unused_cq, gpointer unused_udata) |
| Callout queue timeout when no reply is received within a reasonable timeframe. | |
| gboolean | ntp_send_probe (const host_addr_t addr) |
| gboolean | ntp_send_probes (void) |
| void | ntp_probe (void) |
| Send an NTP probe to the local host using the loopback addresses 127.0.0.1 and ::1, waiting for a reply within the next NTP_WAIT_MS ms. | |
| void | ntp_got_reply (struct gnutella_socket *s) |
| Got a reply from an NTP daemon. | |
| void | ntp_init (void) |
| Initialize the NTP monitoring. | |
| void | ntp_close (void) |
| Shutdown the NTP monitoring. | |
Variables | |
| cevent_t * | wait_ev |
| Callout queue waiting event. | |
|
|
Size of NTP auth, when present.
|
|
|
Mode for unicast request.
|
|
|
NTP fixed-point scaling base.
|
|
|
|
|
|
|
|
|
Mode for server reply.
|
|
|
Say we're version 3.
|
|
|
Wait at most 5 secs for reply.
|
|
|
secs between 1900 and the Epoch
|
|
|
Shutdown the NTP monitoring.
|
|
|
Got a reply from an NTP daemon.
|
|
|
Initialize the NTP monitoring.
|
|
||||||||||||
|
Callout queue timeout when no reply is received within a reasonable timeframe.
|
|
|
Send an NTP probe to the local host using the loopback addresses 127.0.0.1 and ::1, waiting for a reply within the next NTP_WAIT_MS ms.
|
|
|
|
|
|
|
|
||||||||||||
|
Construct a tm_t time from an NTP timestamp.
|
|
||||||||||||
|
Fill 8-byte buffer with NTP's representation of a tm_t time.
|
|
|
Callout queue waiting event.
|
1.3.9.1