xref: /original-bsd/include/protocols/timed.h (revision 4ec22e22)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  *
7  *	@(#)timed.h	1.9 (Berkeley) 06/01/90
8  */
9 
10 /*
11  * Time Synchronization Protocol
12  */
13 
14 #define	TSPVERSION	1
15 #define ANYADDR 	NULL
16 
17 struct tsp {
18 	u_char	tsp_type;
19 	u_char	tsp_vers;
20 	u_short	tsp_seq;
21 	union {
22 		struct timeval tspu_time;
23 		char tspu_hopcnt;
24 	} tsp_u;
25 	char tsp_name[MAXHOSTNAMELEN];
26 };
27 
28 #define	tsp_time	tsp_u.tspu_time
29 #define	tsp_hopcnt	tsp_u.tspu_hopcnt
30 
31 /*
32  * Command types.
33  */
34 #define	TSP_ANY			0	/* match any types */
35 #define	TSP_ADJTIME		1	/* send adjtime */
36 #define	TSP_ACK			2	/* generic acknowledgement */
37 #define	TSP_MASTERREQ		3	/* ask for master's name */
38 #define	TSP_MASTERACK		4	/* acknowledge master request */
39 #define	TSP_SETTIME		5	/* send network time */
40 #define	TSP_MASTERUP		6	/* inform slaves that master is up */
41 #define	TSP_SLAVEUP		7	/* slave is up but not polled */
42 #define	TSP_ELECTION		8	/* advance candidature for master */
43 #define	TSP_ACCEPT		9	/* support candidature of master */
44 #define	TSP_REFUSE		10	/* reject candidature of master */
45 #define	TSP_CONFLICT		11	/* two or more masters present */
46 #define	TSP_RESOLVE		12	/* masters' conflict resolution */
47 #define	TSP_QUIT		13	/* reject candidature if master is up */
48 #define	TSP_DATE		14	/* reset the time (date command) */
49 #define	TSP_DATEREQ		15	/* remote request to reset the time */
50 #define	TSP_DATEACK		16	/* acknowledge time setting  */
51 #define	TSP_TRACEON		17	/* turn tracing on */
52 #define	TSP_TRACEOFF		18	/* turn tracing off */
53 #define	TSP_MSITE		19	/* find out master's site */
54 #define	TSP_MSITEREQ		20	/* remote master's site request */
55 #define	TSP_TEST		21	/* for testing election algo */
56 #define	TSP_SETDATE		22	/* New from date command */
57 #define	TSP_SETDATEREQ		23	/* New remote for above */
58 #define	TSP_LOOP		24	/* loop detection packet */
59 
60 #define	TSPTYPENUMBER		25
61 
62 #ifdef TSPTYPES
63 char *tsptype[TSPTYPENUMBER] =
64   { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
65   "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
66   "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
67   "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
68 #endif
69