X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/10afb02ac804db7fa41a776fd61eff922c09c4df..f662dad02b51b595592df9fa6b0884e438cef9a3:/ntp.h diff --git a/ntp.h b/ntp.h index afdc0a8c..0614f73b 100644 --- a/ntp.h +++ b/ntp.h @@ -1,4 +1,4 @@ -/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.5 2002-11-09 17:19:22 itojun Exp $ */ +/* $Header: /tcpdump/master/tcpdump/ntp.h,v 1.8 2004-01-28 14:34:50 hannes Exp $ */ /* * Based on ntp.h from the U of MD implementation @@ -8,7 +8,7 @@ /* * Definitions for the masses */ -#define JAN_1970 2208988800 /* 1970 - 1900 in seconds */ +#define JAN_1970 2208988800U /* 1970 - 1900 in seconds */ /* * Structure definitions for NTP fixed point values @@ -30,56 +30,66 @@ struct l_fixedpt { u_int32_t int_part; u_int32_t fraction; -} __attribute__((packed)); +}; struct s_fixedpt { u_int16_t int_part; u_int16_t fraction; -} __attribute__((packed)); +}; + +/* rfc2030 + * 1 2 3 + * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * |LI | VN |Mode | Stratum | Poll | Precision | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Root Delay | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Root Dispersion | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Reference Identifier | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * | Reference Timestamp (64) | + * | | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * | Originate Timestamp (64) | + * | | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * | Receive Timestamp (64) | + * | | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * | Transmit Timestamp (64) | + * | | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | Key Identifier (optional) (32) | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + * | | + * | | + * | Message Digest (optional) (128) | + * | | + * | | + * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + */ -/* ================= Table 3.3. Packet Variables ================= */ -/* - * 0 1 2 3 - * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * |LI | VN | Mode| Stratum | Poll | Precision | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Synchronizing Distance | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Synchronizing Dispersion | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | Reference Clock Identifier | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * | Reference Timestamp (64 bits) | - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * | Originate Timestamp (64 bits) | - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * | Receive Timestamp (64 bits) | - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ - * | | - * | Transmit Timestamp (64 bits) | - * | | - * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -*/ struct ntpdata { u_char status; /* status of local clock and leap info */ u_char stratum; /* Stratum level */ u_char ppoll; /* poll value */ int precision:8; - struct s_fixedpt distance; - struct s_fixedpt dispersion; + struct s_fixedpt root_delay; + struct s_fixedpt root_dispersion; u_int32_t refid; - struct l_fixedpt reftime; - struct l_fixedpt org; - struct l_fixedpt rec; - struct l_fixedpt xmt; -} __attribute__((packed)); + struct l_fixedpt ref_timestamp; + struct l_fixedpt org_timestamp; + struct l_fixedpt rec_timestamp; + struct l_fixedpt xmt_timestamp; + u_int32_t key_id; + u_int8_t message_digest[16]; +}; /* * Leap Second Codes (high order two bits) */