#ifndef __NTP_H__ #define __NTP_H__ #include "timestamp.h" #include #include #include #include #define NTP_LEN 48 /* size of sntp message */ struct ntp_msg { uint8_t leap; uint8_t version; uint8_t mode; uint8_t stratum; uint8_t poll; uint8_t precision; uint32_t delay; uint32_t dispersion; struct in_addr reference; struct timestamp reference_ts; struct timestamp originate_ts; struct timestamp receive_ts; struct timestamp transmit_ts; }; void init_req(struct ntp_msg* msg, struct timestamp *current); void ntp_msg_read(struct ntp_msg *dest, unsigned char* buf, int offset); void ntp_msg_write(struct ntp_msg* src, unsigned char* buf, int offset); void fprint_ntp_msg(FILE* f, struct ntp_msg* msg); #define print_ntp_msg(_msg) fprint_ntp_msg(stdout, _msg) #endif /* __NTP_H__ */