blob: 8a097bfa3859107dfe0fe30b4838ed4367dbb455 [file] [log] [blame]
wdenkea287de2005-04-01 00:25:43 +00001/*
2 * (C) Masami Komiya <mkomiya@sonare.it> 2005
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2, or (at
7 * your option) any later version.
8 */
9
10#ifndef __SNTP_H__
11#define __SNTP_H__
12
13#define NTP_SERVICE_PORT 123
14#define SNTP_PACKET_LEN 48
15
16
17/* Leap Indicator */
18#define NTP_LI_NOLEAP 0x0
19#define NTP_LI_61SECS 0x1
20#define NTP_LI_59SECS 0x2
21#define NTP_LI_ALARM 0x3
22
23/* Version */
24
25#define NTP_VERSION 4
26
27/* Mode */
28#define NTP_MODE_RESERVED 0
29#define NTP_MODE_SYMACTIVE 1 /* Symmetric Active */
30#define NTP_MODE_SYMPASSIVE 2 /* Symmetric Passive */
31#define NTP_MODE_CLIENT 3
32#define NTP_MODE_SERVER 4
33#define NTP_MODE_BROADCAST 5
34#define NTP_MODE_NTPCTRL 6 /* Reserved for NTP control message */
35#define NTP_MODE_PRIVATE 7 /* Reserved for private use */
36
37struct sntp_pkt_t {
38#if __LITTLE_ENDIAN
39 uchar mode:3;
40 uchar vn:3;
41 uchar li:2;
42#else
43 uchar li:2;
44 uchar vn:3;
45 uchar mode:3;
46#endif
47 uchar stratum;
48 uchar poll;
49 uchar precision;
50 uint root_delay;
51 uint root_dispersion;
52 uint reference_id;
53 unsigned long long reference_timestamp;
54 unsigned long long originate_timestamp;
55 unsigned long long receive_timestamp;
56 unsigned long long transmit_timestamp;
57};
58
59extern void SntpStart (void); /* Begin SNTP */
60
61#endif /* __SNTP_H__ */