BSD 4_3_Tahoe release
[unix-history] / usr / include / protocols / timed.h
CommitLineData
e6b048e2
RG
1/*
2 * Copyright (c) 1983 Regents of the University of California.
97cd0d25
KB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
f4f66d2c
KB
6 * provided that the above copyright notice and this paragraph are
7 * duplicated in all such forms and that any documentation,
8 * advertising materials, and other materials related to such
9 * distribution and use acknowledge that the software was developed
10 * by the University of California, Berkeley. The name of the
11 * University may not be used to endorse or promote products derived
12 * from this software without specific prior written permission.
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
14 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
15 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
97cd0d25 16 *
ca67e7b4 17 * @(#)timed.h 1.8 (Berkeley) 6/27/88
e6b048e2
RG
18 */
19
e6b048e2
RG
20/*
21 * Time Synchronization Protocol
22 */
23
24#define TSPVERSION 1
25#define ANYADDR NULL
26
27struct tsp {
28 u_char tsp_type;
29 u_char tsp_vers;
119828c0 30 u_short tsp_seq;
68a5b96a
JB
31 union {
32 struct timeval tspu_time;
33 char tspu_hopcnt;
34 } tsp_u;
b05ff25b 35 char tsp_name[MAXHOSTNAMELEN];
e6b048e2 36};
68a5b96a
JB
37
38#define tsp_time tsp_u.tspu_time
39#define tsp_hopcnt tsp_u.tspu_hopcnt
e6b048e2
RG
40
41/*
42 * Command types.
43 */
44#define TSP_ANY 0 /* match any types */
45#define TSP_ADJTIME 1 /* send adjtime */
46#define TSP_ACK 2 /* generic acknowledgement */
47#define TSP_MASTERREQ 3 /* ask for master's name */
a84fe7c2 48#define TSP_MASTERACK 4 /* acknowledge master request */
e6b048e2 49#define TSP_SETTIME 5 /* send network time */
a84fe7c2 50#define TSP_MASTERUP 6 /* inform slaves that master is up */
e6b048e2
RG
51#define TSP_SLAVEUP 7 /* slave is up but not polled */
52#define TSP_ELECTION 8 /* advance candidature for master */
53#define TSP_ACCEPT 9 /* support candidature of master */
54#define TSP_REFUSE 10 /* reject candidature of master */
a84fe7c2 55#define TSP_CONFLICT 11 /* two or more masters present */
e6b048e2
RG
56#define TSP_RESOLVE 12 /* masters' conflict resolution */
57#define TSP_QUIT 13 /* reject candidature if master is up */
58#define TSP_DATE 14 /* reset the time (date command) */
a84fe7c2
JB
59#define TSP_DATEREQ 15 /* remote request to reset the time */
60#define TSP_DATEACK 16 /* acknowledge time setting */
e6b048e2
RG
61#define TSP_TRACEON 17 /* turn tracing on */
62#define TSP_TRACEOFF 18 /* turn tracing off */
a84fe7c2
JB
63#define TSP_MSITE 19 /* find out master's site */
64#define TSP_MSITEREQ 20 /* remote master's site request */
e6b048e2 65#define TSP_TEST 21 /* for testing election algo */
68a5b96a
JB
66#define TSP_SETDATE 22 /* New from date command */
67#define TSP_SETDATEREQ 23 /* New remote for above */
68#define TSP_LOOP 24 /* loop detection packet */
e6b048e2 69
68a5b96a 70#define TSPTYPENUMBER 25
e6b048e2
RG
71
72#ifdef TSPTYPES
73char *tsptype[TSPTYPENUMBER] =
b05ff25b 74 { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
e6b048e2 75 "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
2054a5c9 76 "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
68a5b96a 77 "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
e6b048e2 78#endif