ntp.h revision 410:51e39f6c6311
1283625Sdim/* 2283625Sdim * CDDL HEADER START 3353358Sdim * 4353358Sdim * The contents of this file are subject to the terms of the 5353358Sdim * Common Development and Distribution License, Version 1.0 only 6283625Sdim * (the "License"). You may not use this file except in compliance 7283625Sdim * with the License. 8283625Sdim * 9283625Sdim * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10283625Sdim * or http://www.opensolaris.org/os/licensing. 11283625Sdim * See the License for the specific language governing permissions 12321369Sdim * and limitations under the License. 13283625Sdim * 14283625Sdim * When distributing Covered Code, include this CDDL HEADER in each 15283625Sdim * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16283625Sdim * If applicable, add the following below this CDDL HEADER, with the 17285181Sdim * fields enclosed by brackets "[]" replaced with your own identifying 18285181Sdim * information: Portions Copyright [yyyy] [name of copyright owner] 19285181Sdim * 20283625Sdim * CDDL HEADER END 21285181Sdim */ 22283625Sdim/* 23283625Sdim * Copyright 2005 Sun Microsystems, Inc. All rights reserved. 24341825Sdim * Use is subject to license terms. 25283625Sdim */ 26283625Sdim 27283625Sdim/* 28283625Sdim * University Copyright- Copyright (c) 1982, 1986, 1988 29283625Sdim * The Regents of the University of California 30283625Sdim * All Rights Reserved 31283625Sdim * 32283625Sdim * University Acknowledgment- Portions of this document are derived from 33283625Sdim * software developed by the University of California, Berkeley, and its 34283625Sdim * contributors. 35285181Sdim */ 36283625Sdim 37285181Sdim#ifndef _NTP_H 38285181Sdim#define _NTP_H 39283625Sdim 40283625Sdim#pragma ident "%Z%%M% %I% %E% SMI" 41360784Sdim 42360784Sdim#ifdef __cplusplus 43283625Sdimextern "C" { 44283625Sdim#endif 45283625Sdim 46283625Sdim/* $Source: /usr/users/louie/ntp/RCS/ntp.h,v $ */ 47283625Sdim/* $Revision: 3.4.1.5 $ $Date: 89/04/10 15:55:42 $ */ 48283625Sdim 49283625Sdim/* 50283625Sdim * $Log: ntp.h,v $ 51360784Sdim * Revision 3.4.1.5 89/04/10 15:55:42 louie 52360784Sdim * Provide default value for number of bits/byte if not defined. Compute the 53283625Sdim * Window shift mask inside of conditional code on XTAL so we get the correct 54341825Sdim * value if configured without a crystal controled clock (!!) 55283625Sdim * 56283625Sdim * Revision 3.4.1.4 89/03/31 16:34:50 louie 57283625Sdim * Add bit in flags which allow a peer to be synced to. Changed a char to a bit 58283625Sdim * field so that it is always signed. 59283625Sdim * 60283625Sdim * Revision 3.4.1.3 89/03/29 12:26:18 louie 61283625Sdim * Removed some unused #defines. Replaced MAXSTRATUM with NTP_INFIN per new 62283625Sdim * spec. The variable 'mode' in the peer structure has been renamed 'hmode' 63360784Sdim * per the new spec. 64360784Sdim * 65360784Sdim * Revision 3.4.1.2 89/03/22 18:28:18 louie 66360784Sdim * patch3: Use new RCS headers. 67360784Sdim * 68360784Sdim * Revision 3.4.1.1 89/03/20 00:02:53 louie 69283625Sdim * 1 70285181Sdim * 71285181Sdim * Revision 3.4 89/03/17 18:37:00 louie 72285181Sdim * Latest test release. 73285181Sdim * 74341825Sdim * Revision 3.3.1.1 89/03/17 18:23:49 louie 75283625Sdim * Change CLOCK_FACTOR to be a power of 2. 76283625Sdim * 77283625Sdim * Revision 3.3 89/03/15 14:19:36 louie 78283625Sdim * New baseline for next release. 79283625Sdim * 80285181Sdim * Revision 3.2.1.2 89/03/15 13:46:52 louie 81283625Sdim * The version number for that particular flavor of ntpd <--> ntpdc interaction 82285181Sdim * is now defined by NTPDC_VERSION. The packet format for the ntpdc program 83283625Sdim * has changed slightly to improve robustness when dealing with multiple packets 84283625Sdim * of status data. 85283625Sdim * 86285181Sdim * Revision 3.2.1.1 89/03/09 17:11:24 louie 87285181Sdim * patch1: Updated constants, which were previously in incorrect units. 88285181Sdim * 89285181Sdim * Revision 3.2 89/03/07 18:21:45 louie 90285181Sdim * New version of UNIX NTP daemon and software based on the 6 March 1989 91285181Sdim * draft of the new NTP protocol specification. This version doesn't 92285181Sdim * implement authentication, and accepts and send only NTP Version 1 93285181Sdim * packets. 94341825Sdim * 95283625Sdim * Revision 3.1.1.1 89/02/15 08:54:42 louie 96283625Sdim * *** empty log message *** 97283625Sdim * 98283625Sdim * 99360784Sdim * Revision 3.1 89/01/30 14:43:07 louie 100283625Sdim * Second UNIX NTP test release. 101283625Sdim * 102285181Sdim * Revision 3.0 88/12/12 16:01:07 louie 103285181Sdim * Test release of new UNIX NTP software. This version should conform to the 104285181Sdim * revised NTP protocol specification. 105285181Sdim * 106283625Sdim */ 107283625Sdim 108283625Sdim#ifndef FD_SET 109283625Sdim#define NFDBITS 32 110283625Sdim#define FD_SETSIZE 32 111283625Sdim#define FD_SET(n, p) ((p)->fds_bits[(n)/NFDBITS] |= (1 << ((n) % NFDBITS))) 112283625Sdim#define FD_CLR(n, p) ((p)->fds_bits[(n)/NFDBITS] &= ~(1 << ((n) % NFDBITS))) 113283625Sdim#define FD_ISSET(n, p) ((p)->fds_bits[(n)/NFDBITS] & (1 << ((n) % NFDBITS))) 114283625Sdim#define FD_ZERO(p) bzero((char *)(p), sizeof (*(p))) 115283625Sdim#endif 116283625Sdim 117283625Sdim#ifndef NBBY 118283625Sdim#define NBBY 8 /* number of bits per byte */ 119283625Sdim#endif 120283625Sdim 121283625Sdim#define MAXNETIF 10 122283625Sdim 123283625Sdimstruct intf { 124283625Sdim int fd; 125283625Sdim char *name; 126283625Sdim struct sockaddr_in sin; 127283625Sdim struct sockaddr_in bcast; 128283625Sdim struct sockaddr_in mask; 129283625Sdim int uses; 130283625Sdim int if_flags; 131283625Sdim}; 132283625Sdimextern struct intf addrs[]; 133283625Sdimextern int nintf; 134283625Sdim 135283625Sdim/* 136283625Sdim * Definitions for the masses 137283625Sdim */ 138283625Sdim#define JAN_1970 2208988800U /* 1970 - 1900 in seconds */ 139283625Sdim 140283625Sdim/* 141283625Sdim * Daemon specific (ntpd.c) 142283625Sdim */ 143283625Sdim#define SHIFT_MASK 0xff /* number of intervals to wait */ 144283625Sdim 145283625Sdim#ifndef WAYTOOBIG 146283625Sdim#define WAYTOOBIG 1000.0 /* Too many seconds to correct, something is */ 147283625Sdim /* really wrong */ 148283625Sdim#endif 149283625Sdim 150283625Sdim#ifndef XTAL 151283625Sdim#define XTAL 1 /* crystal controlled clock by default */ 152283625Sdim#endif 153283625Sdim 154285181Sdim#ifndef NTPINITFILE 155285181Sdim#define NTPINITFILE "/etc/ntp.conf" 156285181Sdim#endif 157285181Sdim 158285181Sdimstruct list { 159285181Sdim struct ntp_peer *head; 160285181Sdim struct ntp_peer *tail; 161285181Sdim int members; 162360784Sdim}; 163285181Sdim 164285181Sdim#define STRMCMP(a, cond, b) \ 165285181Sdim (((a) == UNSPECIFIED ? NTP_INFIN+1 : a) cond \ 166285181Sdim ((b) == UNSPECIFIED ? NTP_INFIN+1 : (b))) 167360784Sdim 168360784Sdim 169285181Sdim/* 170360784Sdim * Definitions outlined in the NTP spec 171360784Sdim */ 172360784Sdim#define NTP_VERSION 1 173360784Sdim#define NTP_PORT 123 /* for ref only (see /etc/services) */ 174285181Sdim#define NTP_INFIN 15 175285181Sdim#define NTP_MAXAGE 86400 176285181Sdim#define NTP_MAXSKW 0.01 /* seconds */ 177285181Sdim#define NTP_MINDIST 0.02 /* seconds */ 178285181Sdim#define NTP_MINPOLL 6 /* (64) seconds between messages */ 179285181Sdim#define NTP_MAXPOLL 10 /* (1024) secs to poll */ 180285181Sdim#define NTP_WINDOW 8 /* size of shift register */ 181285181Sdim#define NTP_MAXWGT 8 /* maximum allowable dispersion */ 182285181Sdim#define NTP_MAXLIST 5 /* max size of selection list */ 183285181Sdim#define NTP_MAXSTRA 2 /* max number of strata in selection list */ 184285181Sdim#define X_NTP_CANDIDATES 64 /* number of peers to consider when doing */ 185285181Sdim /* clock selection */ 186285181Sdim#define NTP_SELECT 0.75 /* weight used to compute dispersion */ 187285181Sdim 188285181Sdim#define PEER_MAXDISP 64.0 /* Maximum dispersion */ 189285181Sdim#define PEER_THRESHOLD 0.5 /* dispersion threshold */ 190285181Sdim#define PEER_FILTER 0.5 /* filter weight */ 191285181Sdim 192285181Sdim#if XTAL == 0 193285181Sdim#define PEER_SHIFT 4 194285181Sdim#define NTP_WINDOW_SHIFT_MASK 0x0f 195285181Sdim#else 196285181Sdim#define PEER_SHIFT 8 197285181Sdim#define NTP_WINDOW_SHIFT_MASK 0xff 198285181Sdim#endif 199284734Sdim 200285181Sdim 201283625Sdim/* 202 * 5.1 Uniform Phase Adjustments 203 * Clock parameters 204 */ 205#define CLOCK_UPDATE 8 /* update interval (1<<CLOCK_UPDATE secs) */ 206#if XTAL 207#define CLOCK_ADJ 2 /* adjustment interval (1<<CLOCK_ADJ secs) */ 208#define CLOCK_PHASE 8 /* phase shift */ 209#define CLOCK_MAX 0.128 /* maximum aperture (milliseconds) */ 210#else 211#define CLOCK_ADJ 0 212#define CLOCK_PHASE 6 /* phase shift */ 213#define CLOCK_MAX 0.512 /* maximum aperture (milliseconds) */ 214#endif 215#define CLOCK_FREQ 10 /* frequency shift */ 216#define CLOCK_TRACK 8 217#define CLOCK_COMP 4 218#define CLOCK_FACTOR 18 219 220/* 221 * Structure definitions for NTP fixed point values 222 * 223 * 0 1 2 3 224 * 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 225 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 226 * | Integer Part | 227 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 228 * | Fraction Part | 229 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 230 * 231 * 232 * 0 1 2 3 233 * 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 234 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 235 * | Integer Part | Fraction Part | 236 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 237 */ 238struct l_fixedpt { 239 ulong_t int_part; 240 ulong_t fraction; 241}; 242 243struct s_fixedpt { 244 ushort_t int_part; 245 ushort_t fraction; 246}; 247 248/* 249 * ================= Table 3.3. Packet Variables ================= 250 * 0 1 2 3 251 * 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 252 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 253 * |LI | VN | Mode| Stratum | Poll | Precision | 254 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 255 * | Synchronizing Distance | 256 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 257 * | Synchronizing Dispersion | 258 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 259 * | Reference Clock Identifier | 260 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 261 * | | 262 * | Reference Timestamp (64 bits) | 263 * | | 264 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 265 * | | 266 * | Originate Timestamp (64 bits) | 267 * | | 268 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 269 * | | 270 * | Receive Timestamp (64 bits) | 271 * | | 272 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 273 * | | 274 * | Transmit Timestamp (64 bits) | 275 * | | 276 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 277 * | Encryption Keyid (32 bits, when A bit set) | 278 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 279 * | | 280 * | Message Authentication Code/MAC (when A bit set) | 281 * | | 282 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ 283 */ 284 285#define MAC_OCTETS_DES 8 286#define MAC_OCTETS_MD5 16 287#define MAC_OCTETS_MIN MAC_OCTETS_DES 288#define MAC_OCTETS_MAX MAC_OCTETS_MD5 289#define AUTH_OCTETS_V3 (MAC_OCTETS_MAX + sizeof (uint32_t)) 290 291struct ntpdata { 292 uchar_t li_vn_mode; /* contains leap indicator, version and mode */ 293 uchar_t stratum; /* Stratum level */ 294 uchar_t ppoll; /* poll value */ 295 int precision:8; 296 struct s_fixedpt distance; 297 struct s_fixedpt dispersion; 298 ulong_t refid; 299 struct l_fixedpt reftime; 300 struct l_fixedpt org; 301 struct l_fixedpt rec; 302 struct l_fixedpt xmt; 303 uint32_t keyid; 304 uchar_t mac[MAC_OCTETS_MAX]; 305}; 306 307#define LEN_PKT_NOMAC (sizeof (struct ntpdata) - AUTH_OCTETS_V3) 308 309/* 310 * Leap Second Codes (high order two bits) 311 */ 312#define NO_WARNING 0x00 /* no warning */ 313#define PLUS_SEC 0x40 /* add a second (61 seconds) */ 314#define MINUS_SEC 0x80 /* minus a second (59 seconds) */ 315#define ALARM 0xc0 /* alarm condition (clock unsynchronized) */ 316 317/* 318 * Clock Status Bits that Encode Version 319 */ 320#define NTPVERSION_1 0x08 321#define VERSIONMASK 0x38 322#define LEAPMASK 0xc0 323#define NTPMODEMASK 0x07 324 325/* 326 * Code values 327 */ 328#define MODE_UNSPEC 0 /* unspecified */ 329#define MODE_SYM_ACT 1 /* symmetric active */ 330#define MODE_SYM_PAS 2 /* symmetric passive */ 331#define MODE_CLIENT 3 /* client */ 332#define MODE_SERVER 4 /* server */ 333#define MODE_BROADCAST 5 /* broadcast */ 334#define MODE_CONTROL 6 /* control */ 335#define MODE_PRIVATE 7 /* private */ 336 337/* 338 * Stratum Definitions 339 */ 340#define UNSPECIFIED 0 341#define PRIM_REF 1 /* radio clock */ 342#define INFO_QUERY 62 /* **** THIS implementation dependent **** */ 343#define INFO_REPLY 63 /* **** THIS implementation dependent **** */ 344 345 346/* ================= table 3.2 Peer Variables ================= */ 347struct ntp_peer { 348 struct ntp_peer *next, *prev; 349 struct sockaddr_in src; /* both peer.srcadr and peer.srcport */ 350 int flags; /* local flags */ 351#define PEER_FL_CONFIG 1 352#define PEER_FL_AUTHENABLE 2 353#define PEER_FL_SYNC 0x1000 /* peer can bet sync'd to */ 354#define PEER_FL_BCAST 0x2000 /* broadcast peer */ 355#define PEER_FL_SELECTED 0x8000 /* actually used by query routine */ 356 357 int sock; /* index into sockets to derive */ 358 /* peer.dstadr and peer.dstport */ 359 uchar_t leap; /* receive */ 360 uchar_t hmode; /* receive */ 361 uchar_t stratum; /* receive */ 362 uchar_t ppoll; /* receive */ 363 uchar_t hpoll; /* poll update */ 364 short precision; /* receive */ 365 struct s_fixedpt distance; /* receive */ 366 struct s_fixedpt dispersion; /* receive */ 367 ulong_t refid; /* receive */ 368 struct l_fixedpt reftime; /* receive */ 369 struct l_fixedpt org; /* receive, clear */ 370 struct l_fixedpt rec; /* receive, clear */ 371 struct l_fixedpt xmt; /* transmit, clear */ 372 ulong_t reach; /* receive, transmit, clear */ 373 ulong_t valid; /* packet, transmit, clear */ 374 ulong_t timer; /* receive, transmit, poll update */ 375 long stopwatch; /* <<local>> for timing */ 376 /* 377 * first order offsets 378 */ 379 struct filter { 380 short samples; /* <<local>> */ 381 double offset[PEER_SHIFT]; 382 double delay[PEER_SHIFT]; 383 } filter; /* filter, clear */ 384 385 double estdelay; /* filter */ 386 double estoffset; /* filter */ 387 double estdisp; /* filter */ 388 389 ulong_t pkt_sent; /* <<local>> */ 390 ulong_t pkt_rcvd; /* <<local>> */ 391 ulong_t pkt_dropped; /* <<local>> */ 392}; 393 394/* ================= table 3.1: System Variables ================= */ 395 396struct sysdata { /* procedure */ 397 uchar_t leap; /* clock update */ 398 uchar_t stratum; /* clock update */ 399 short precision; /* system */ 400 struct s_fixedpt distance; /* clock update */ 401 struct s_fixedpt dispersion; /* clock update */ 402 ulong_t refid; /* clock update */ 403 struct l_fixedpt reftime; /* clock update */ 404 int hold; /* clock update */ 405 struct ntp_peer *peer; /* selection */ 406 int maxpeers; /* <<local>> */ 407 uchar_t filler; /* put here for %&*%$$ SUNs */ 408}; 409 410#define NTPDC_VERSION 2 411 412/* 413 * These structures are used to pass information to the ntpdc (control) 414 * program. They are unique to this implementation and not part of the 415 * NTP specification. 416 */ 417struct clockinfo { 418 ulong_t net_address; 419 ulong_t my_address; 420 ushort_t port; 421 ushort_t flags; 422 ulong_t pkt_sent; 423 ulong_t pkt_rcvd; 424 ulong_t pkt_dropped; 425 ulong_t timer; 426 uchar_t leap; 427 uchar_t stratum; 428 uchar_t ppoll; 429 int precision:8; 430 431 uchar_t hpoll; 432 uchar_t filler1; 433 ushort_t reach; 434 435 long estdisp; /* scaled by 1000 */ 436 long estdelay; /* in milliseconds */ 437 long estoffset; /* in milliseconds */ 438 ulong_t refid; 439 struct l_fixedpt reftime; 440 struct info_filter { 441 short index; 442 short filler; 443 long offset[PEER_SHIFT]; /* in milliseconds */ 444 long delay[PEER_SHIFT]; /* in milliseconds */ 445 } info_filter; 446}; 447 448struct ntpinfo { 449 uchar_t version; 450 uchar_t type; /* request type (stratum in ntp packets) */ 451 uchar_t count; /* number of entries in this packet */ 452 uchar_t seq; /* sequence number of this packet */ 453 454 uchar_t npkts; /* total number of packets */ 455 uchar_t peers; 456 uchar_t fill3; 457 uchar_t fill4; 458}; 459 460/* 461 * From usr/src/cmd/xntpd/include/ntp_control.h: 462 * Definition of a mode 6 packet. 463 */ 464struct ntp_control { 465 uchar_t li_vn_mode; /* leap, version, mode */ 466 uchar_t r_m_e_op; /* response, more, error, opcode */ 467 ushort_t sequence; /* sequence number of request */ 468 ushort_t status; /* status word for association */ 469 ushort_t associd; /* association ID */ 470 ushort_t offset; /* offset of this batch of data */ 471 ushort_t count; /* count of data in this packet */ 472 uchar_t data[1]; /* data + auth */ 473}; 474 475#define NTPC_DATA_MAXLEN (480 + AUTH_OCTETS_V3) 476 477/* 478 * Decoding for the r_m_e_op field 479 */ 480#define CTL_RESPONSE 0x80 481#define CTL_ERROR 0x40 482#define CTL_MORE 0x20 483#define CTL_OP_MASK 0x1f 484 485/* 486 * Opcodes 487 */ 488#define CTL_OP_UNSPEC 0 489#define CTL_OP_READSTAT 1 490#define CTL_OP_READVAR 2 491#define CTL_OP_WRITEVAR 3 492#define CTL_OP_READCLOCK 4 493#define CTL_OP_WRITECLOCK 5 494#define CTL_OP_SETTRAP 6 495#define CTL_OP_ASYNCMSG 7 496#define CTL_OP_UNSETTRAP 31 497 498/* 499 * From usr/src/cmd/xntpd/include/ntp_request.h: 500 * A mode 7 packet is used exchanging data between an NTP server 501 * and a client for purposes other than time synchronization, e.g. 502 * monitoring, statistics gathering and configuration. A mode 7 503 * packet has the following format: 504 */ 505 506struct ntp_private { 507 uchar_t rm_vn_mode; /* response, more, version, mode */ 508 uchar_t auth_seq; /* key, sequence number */ 509 uchar_t implementation; /* implementation number */ 510 uchar_t request; /* request number */ 511 ushort_t err_nitems; /* error code/number of data items */ 512 ushort_t mbz_itemsize; /* item size */ 513 char data[1]; /* data area */ 514}; 515 516#define RESP_BIT 0x80 517#define MORE_BIT 0x40 518#define INFO_VERSION(rm_vn_mode) ((uchar_t)(((rm_vn_mode)>>3) & 0x7)) 519#define INFO_MODE(rm_vn_mode) ((rm_vn_mode) & 0x7) 520 521#define AUTH_BIT 0x80 522#define INFO_SEQ(auth_seq) ((auth_seq) & 0x7f) 523 524#define INFO_ERR(err_nitems) ((ushort_t)((ntohs(err_nitems) >> 12) & 0xf)) 525#define INFO_NITEMS(err_nitems) ((ushort_t)(ntohs(err_nitems) & 0xfff)) 526 527#define INFO_ITEMSIZE(mbz_itemsize) (ntohs(mbz_itemsize) & 0xfff) 528 529#ifdef __cplusplus 530} 531#endif 532 533#endif /* _NTP_H */ 534