home *** CD-ROM | disk | FTP | other *** search
/ nisttime.carsoncity.k12.mi.us / nisttime.carsoncity.k12.mi.us.tar / nisttime.carsoncity.k12.mi.us / pub / autolock / ntp-packet.h < prev    next >
C/C++ Source or Header  |  2003-12-09  |  2KB  |  66 lines

  1. /*
  2.     file ntp-packet.h defines the structure of an NTP
  3.     network packet.
  4.     this description follows appendix A, RFC 1305, page 50.
  5.  
  6.     the parameter NTPJL is used to prevent this structure
  7.     from being multiply defined in several modules.
  8.  
  9.     note that root delay and root dispersion are treated as
  10.     simple 32-bit integers here, although they are actually 
  11.     two 16 bit integer quantities, representing the integer
  12.     seconds and the seconds fraction.  We are just going
  13.     to set this stuff to 0 anyway.
  14. */
  15. #ifndef NTPJL
  16. #define NTPJL 1
  17. #define u_char unsigned char
  18. #define s_char signed char
  19. #define s_fp   signed int
  20. #define u_fp   unsigned int
  21. #define u_int32  int
  22. #define l_fp   unsigned long int
  23. /*
  24.     the 64-bit ntp times are each comprised of two 32-bit
  25.     integers: the first is the number of seconds since 1900.0
  26.     and the second is the seconds fraction.
  27.     the union declaration in each case makes it easier to
  28.     refer to the two parts separately.
  29. */
  30. struct ntppkt
  31.     {
  32.         u_char li_vn_mode;      /* contains leap indicator, version and mode */
  33.         u_char stratum;         /* peer's stratum */
  34.         s_char ppoll;           /* the peer polling interval */
  35.         s_char precision;       /* peer clock precision */
  36.         s_fp rootdelay;         /* distance to primary clock */
  37.         u_fp rootdispersion;    /* clock dispersion */
  38.         u_int32 refid;          /* reference clock ID */
  39.     union
  40.        {
  41.            l_fp ntptime;
  42.        u_fp sys[2];
  43.     } reftime;           /*time peer clock was last updated*/
  44.         union
  45.        {
  46.        l_fp ntptime;
  47.        u_fp sys[2];
  48.     } org;                   /* originate time stamp */
  49.     union
  50.        {
  51.        l_fp ntptime;
  52.        u_fp sys[2];
  53.     } rec;               /* receive time stamp */
  54.     union
  55.        {
  56.        l_fp ntptime;
  57.        u_fp sys[2];
  58.     } xmt;               /* transmit time stamp */
  59. /*
  60.  
  61.     char auth[12];         96-bit authenticator -- not used 
  62.  
  63. */
  64. };
  65. #endif
  66.