xref: /titanic_41/usr/src/head/protocols/timed.h (revision ba2e4443695ee6a6f420a35cd4fc3d3346d22932)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 #define	TSPVERSION	1
49 #define	ANYADDR 	NULL
50 
51 struct tsp {
52 	uchar_t	tsp_type;
53 	uchar_t	tsp_vers;
54 	short	tsp_seq;
55 	struct timeval tsp_time;
56 	char tsp_name[MAXHOSTNAMELEN];
57 };
58 
59 /*
60  * Command types.
61  */
62 #define	TSP_ANY			0	/* match any types */
63 #define	TSP_ADJTIME		1	/* send adjtime */
64 #define	TSP_ACK			2	/* generic acknowledgement */
65 #define	TSP_MASTERREQ		3	/* ask for master's name */
66 #define	TSP_MASTERACK		4	/* acknowledge master request */
67 #define	TSP_SETTIME		5	/* send network time */
68 #define	TSP_MASTERUP		6	/* inform slaves that master is up */
69 #define	TSP_SLAVEUP		7	/* slave is up but not polled */
70 #define	TSP_ELECTION		8	/* advance candidature for master */
71 #define	TSP_ACCEPT		9	/* support candidature of master */
72 #define	TSP_REFUSE		10	/* reject candidature of master */
73 #define	TSP_CONFLICT		11	/* two or more masters present */
74 #define	TSP_RESOLVE		12	/* masters' conflict resolution */
75 #define	TSP_QUIT		13	/* reject candidature if master is up */
76 #define	TSP_DATE		14	/* reset the time (date command) */
77 #define	TSP_DATEREQ		15	/* remote request to reset the time */
78 #define	TSP_DATEACK		16	/* acknowledge time setting  */
79 #define	TSP_TRACEON		17	/* turn tracing on */
80 #define	TSP_TRACEOFF		18	/* turn tracing off */
81 #define	TSP_MSITE		19	/* find out master's site */
82 #define	TSP_MSITEREQ		20	/* remote master's site request */
83 #define	TSP_TEST		21	/* for testing election algo */
84 
85 #define	TSPTYPENUMBER		22
86 
87 #ifdef TSPTYPES
88 char *tsptype[TSPTYPENUMBER] =
89 	{"ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME",
90 	"MASTERUP", "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT",
91 	"RESOLVE", "QUIT", "DATE", "DATEREQ", "DATEACK", "TRACEON",
92 	"TRACEOFF", "MSITE", "MSITEREQ", "TEST"};
93 #endif
94 
95 #ifdef	__cplusplus
96 }
97 #endif
98 
99 #endif /* _PROTOCOLS_TIMED_H */
100