xref: /illumos-gate/usr/src/head/protocols/timed.h (revision 5f82aa32fbc5dc2c59bca6ff315f44a4c4c9ea86)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1998 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 /*	Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T	*/
28 /*	  All Rights Reserved	*/
29 
30 /*
31  * Portions of this source code were derived from Berkeley 4.3 BSD
32  * under license from the Regents of the University of California.
33  */
34 
35 /*
36  * Time Synchronization Protocol
37  */
38 
39 #ifndef _PROTOCOLS_TIMED_H
40 #define	_PROTOCOLS_TIMED_H
41 
42 #ifdef	__cplusplus
43 extern "C" {
44 #endif
45 
46 #define	TSPVERSION	1
47 #define	ANYADDR		NULL
48 
49 struct tsp {
50 	uchar_t	tsp_type;
51 	uchar_t	tsp_vers;
52 	short	tsp_seq;
53 	struct timeval tsp_time;
54 	char tsp_name[MAXHOSTNAMELEN];
55 };
56 
57 /*
58  * Command types.
59  */
60 #define	TSP_ANY			0	/* match any types */
61 #define	TSP_ADJTIME		1	/* send adjtime */
62 #define	TSP_ACK			2	/* generic acknowledgement */
63 #define	TSP_MASTERREQ		3	/* ask for master's name */
64 #define	TSP_MASTERACK		4	/* acknowledge master request */
65 #define	TSP_SETTIME		5	/* send network time */
66 #define	TSP_MASTERUP		6	/* inform slaves that master is up */
67 #define	TSP_SLAVEUP		7	/* slave is up but not polled */
68 #define	TSP_ELECTION		8	/* advance candidature for master */
69 #define	TSP_ACCEPT		9	/* support candidature of master */
70 #define	TSP_REFUSE		10	/* reject candidature of master */
71 #define	TSP_CONFLICT		11	/* two or more masters present */
72 #define	TSP_RESOLVE		12	/* masters' conflict resolution */
73 #define	TSP_QUIT		13	/* reject candidature if master is up */
74 #define	TSP_DATE		14	/* reset the time (date command) */
75 #define	TSP_DATEREQ		15	/* remote request to reset the time */
76 #define	TSP_DATEACK		16	/* acknowledge time setting  */
77 #define	TSP_TRACEON		17	/* turn tracing on */
78 #define	TSP_TRACEOFF		18	/* turn tracing off */
79 #define	TSP_MSITE		19	/* find out master's site */
80 #define	TSP_MSITEREQ		20	/* remote master's site request */
81 #define	TSP_TEST		21	/* for testing election algo */
82 
83 #define	TSPTYPENUMBER		22
84 
85 #ifdef TSPTYPES
86 char *tsptype[TSPTYPENUMBER] =
87 	{"ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME",
88 	"MASTERUP", "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT",
89 	"RESOLVE", "QUIT", "DATE", "DATEREQ", "DATEACK", "TRACEON",
90 	"TRACEOFF", "MSITE", "MSITEREQ", "TEST"};
91 #endif
92 
93 #ifdef	__cplusplus
94 }
95 #endif
96 
97 #endif /* _PROTOCOLS_TIMED_H */
98