ntp_request.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright (c) 1996 by Sun Microsystems, Inc.
* All Rights Reserved.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* ntp_request.h - definitions for the xntpd remote query facility
*/
#include "ntp_types.h"
/*
* A mode 7 packet is used exchanging data between an NTP server
* and a client for purposes other than time synchronization, e.g.
* monitoring, statistics gathering and configuration. A mode 7
* packet has the following format:
*
* 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
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* |R|M| VN | Mode|A| Sequence | Implementation| Req Code |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Err | Number of data items | MBZ | Size of data item |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* | Data (Minimum 0 octets, maximum 500 octets) |
* | |
* [...]
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | Encryption Keyid (when A bit set) |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
* | |
* | Message Authentication Code (when A bit set) |
* | |
* +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
*
* where the fields are (note that the client sends requests, the server
* responses):
*
* Response Bit: This packet is a response (if clear, packet is a request).
*
* More Bit: Set for all packets but the last in a response which
* requires more than one packet.
*
* Version Number: 2 for current version
*
* Mode: Always 7
*
* Authenticated bit: If set, this packet is authenticated.
*
* Sequence number: For a multipacket response, contains the sequence
* number of this packet. 0 is the first in the sequence,
* 127 (or less) is the last. The More Bit must be set in
* all packets but the last.
*
* Implementation number: The number of the implementation this request code
* is defined by. An implementation number of zero is used
* agree on. Implementation number 255 is reserved (for
* extensions, in case we run out).
*
* Request code: An implementation-specific code which specifies the
* format and semantics of the data included in the packet.
*
* Err: Must be 0 for a request. For a response, holds an error
* code relating to the request. If nonzero, the operation
* requested wasn't performed.
*
* 0 - no error
* 1 - incompatable implementation number
* 2 - unimplemented request code
* 3 - format error (wrong data items, data size, packet size etc.)
* 4 - no data available (e.g. request for details on unknown peer)
* 5-6 I don't know
* 7 - authentication failure (i.e. permission denied)
*
* Number of data items: number of data items in packet. 0 to 500
*
* MBZ: A reserved data field, must be zero in requests and responses.
*
* Size of data item: size of each data item in packet. 0 to 500
*
* requests and responses the size in octets must be greater
* than or equal to the product of the number of data items
* and the size of a data item. For requests the data area
* must be exactly 40 octets in length. For responses the
* data area may be any length between 0 and 500 octets
* inclusive.
*
* Message Authentication Code: Same as NTP spec, in definition and function.
* May optionally be included in requests which require
* authentication, is never included in responses.
*
* The version number, mode and keyid have the same function and are
* in the same location as a standard NTP packet. The request packet
* is the same size as a standard NTP packet to ease receive buffer
* management, and to allow the same encryption procedure to be used
* both on mode 7 and standard NTP packets. The mac is included when
* it is required that a request be authenticated, the keyid should be
* zero in requests in which the mac is not included.
*
* and whether the packet is a request or a response. The only requirement
* is that data items start in the octet immediately following the size
* word and that data items be concatenated without padding between (i.e.
* if the data area is larger than data_items*size, all padding is at
* the end). Padding is ignored, other than for encryption purposes.
* Implementations using encryption might want to include a time stamp
* or other data in the request packet padding. The key used for requests
* is implementation defined, but key 15 is suggested as a default.
*/
/*
* A request packet. These are almost a fixed length.
*/
struct req_pkt {
};
/*
* Input packet lengths. One with the mac, one without.
*/
#define REQ_LEN_MAC (sizeof(struct req_pkt))
/*
* A response packet. The length here is variable, this is a
* maximally sized one. Note that this implementation doesn't
* authenticate responses.
*/
#define RESP_HEADER_SIZE (8)
#define RESP_DATA_SIZE (500)
struct resp_pkt {
};
/*
* Information error codes
*/
#define INFO_OKAY 0
/*
* Maximum sequence number.
*/
#define MAXSEQ 127
/*
* Bit setting macros for multifield items.
*/
#define RESP_BIT 0x80
#define MORE_BIT 0x40
|((NTP_VERSION)<<3)\
|(MODE_PRIVATE)))
/*
* Implementation numbers. One for universal use and one for xntpd.
*/
#define IMPL_UNIV 0
#define IMPL_XNTPD 2
/*
* Some limits related to authentication. Frames which are
* authenticated must include a time stamp which differs from
* the receive time stamp by no more than 10 seconds.
*/
#define INFO_TS_MAXSKEW_UI 10
/*
* Universal request codes go here. There aren't any.
*/
/*
* XNTPD request codes go here.
*/
#define REQ_PEER_LIST 0 /* return list of peers */
/*
* Flags in the peer information returns
*/
#define INFO_FLAG_CONFIG 0x1
#define INFO_FLAG_SYSPEER 0x2
#define INFO_FLAG_UNUSED 0x4
#define INFO_FLAG_REFCLOCK 0x8
#define INFO_FLAG_PREFER 0x10
#define INFO_FLAG_AUTHENABLE 0x20
#define INFO_FLAG_SEL_CANDIDATE 0x40
#define INFO_FLAG_SHORTLIST 0x80
/*
* Flags in the system information returns
*/
#define INFO_FLAG_BCLIENT 0x1
#define INFO_FLAG_AUTHENTICATE 0x2
#define INFO_FLAG_PLL 0x4
#define INFO_FLAG_PPS 0x8
#define INFO_FLAG_PLL_SYNC 0x10
#define INFO_FLAG_PPS_SYNC 0x20
#define INFO_FLAG_MONITOR 0x40
#define INFO_FLAG_FILEGEN 0x80
/*
* Peer list structure. Used to return raw lists of peers. It goes
* without saying that everything returned is in network byte order.
*/
struct info_peer_list {
};
/*
* Peer summary structure. Sort of the info that ntpdc returns by default.
*/
struct info_peer_summary {
};
/*
* Peer information structure.
*/
struct info_peer {
};
/*
* Peer statistics structure
*/
struct info_peer_stats {
};
/*
* Loop filter variables
*/
struct info_loop {
};
/*
* System info. Mostly the sys.* variables, plus a few unique to
* the implementation.
*/
struct info_sys {
};
/*
* System stats. These are collected in the protocol module
*/
struct info_sys_stats {
};
/*
* System stats - old version
*/
struct old_info_sys_stats {
};
/*
* Peer memory statistics. Collected in the peer module.
*/
struct info_mem_stats {
};
/*
* I/O statistics. Collected in the I/O module
*/
struct info_io_stats {
};
/*
* Timer stats. Guess where from.
*/
struct info_timer_stats {
};
/*
* Structure for passing peer configuration information
*/
struct conf_peer {
};
#define CONF_FLAG_AUTHENABLE 0x1
#define CONF_FLAG_PREFER 0x2
/*
* Structure for passing peer deletion information. Currently
* we only pass the address and delete all configured peers with
* this addess.
*/
struct conf_unpeer {
};
/*
* Structure for carrying system flags.
*/
struct conf_sys_flags {
};
/*
*/
#define SYS_FLAG_BCLIENT 0x1
#define SYS_FLAG_AUTHENTICATE 0x2
#define SYS_FLAG_PLL 0x4
#define SYS_FLAG_PPS 0x8
#define SYS_FLAG_MONITOR 0x10
#define SYS_FLAG_FILEGEN 0x20
/*
* Structure used for returning restrict entries
*/
struct info_restrict {
};
/*
* Structure used for specifying restrict entries
*/
struct conf_restrict {
};
/*
* Structure used for returning monitor data
*/
struct info_monitor_1 {
};
/*
* Structure used for returning monitor data
*/
struct info_monitor {
};
/*
* Structure used for returning monitor data (old format
*/
struct old_info_monitor {
};
/*
* Structure used for passing indication of flags to clear
*/
struct reset_flags {
};
#define RESET_FLAG_ALLPEERS 0x01
#define RESET_FLAG_IO 0x02
#define RESET_FLAG_SYS 0x04
#define RESET_FLAG_MEM 0x08
#define RESET_FLAG_TIMER 0x10
#define RESET_FLAG_AUTH 0x20
#define RESET_FLAG_CTL 0x40
#define RESET_ALLFLAGS \
/*
* Structure used to return information concerning the authentication
* module.
*/
struct info_auth {
};
/*
* Structure used to pass trap information to the client
*/
struct info_trap {
};
/*
*/
struct conf_trap {
};
/*
* Structure used to return statistics from the control module
*/
struct info_control {
};
/*
* Structure used to return leap information.
*/
struct info_leap {
};
/*
* Structure used to return clock information
*/
struct info_clock {
};
/*
* Structure used for setting clock fudge factors
*/
struct conf_fudge {
};
#define FUDGE_TIME1 1
#define FUDGE_TIME2 2
#define FUDGE_VAL1 3
#define FUDGE_VAL2 4
#define FUDGE_FLAGS 5
/*
* Structure used for returning clock debugging info
*/
#define NUMCBUGVALUES 16
#define NUMCBUGTIMES 32
struct info_clkbug {
};
/*
*/
struct info_kernel {
/*
* Variables used only if PPS signal discipline is implemented
*/
};