xref: /utopia/UTPA2-700.0.x/projects/tools/lint/mips-linux-gnu_include/protocols/timed.h (revision 53ee8cc121a030b8d368113ac3e966b4705770ef)
1*53ee8cc1Swenshuai.xi /*
2*53ee8cc1Swenshuai.xi  * Copyright (c) 1983, 1993
3*53ee8cc1Swenshuai.xi  *	The Regents of the University of California.  All rights reserved.
4*53ee8cc1Swenshuai.xi  *
5*53ee8cc1Swenshuai.xi  * Redistribution and use in source and binary forms, with or without
6*53ee8cc1Swenshuai.xi  * modification, are permitted provided that the following conditions
7*53ee8cc1Swenshuai.xi  * are met:
8*53ee8cc1Swenshuai.xi  * 1. Redistributions of source code must retain the above copyright
9*53ee8cc1Swenshuai.xi  *    notice, this list of conditions and the following disclaimer.
10*53ee8cc1Swenshuai.xi  * 2. Redistributions in binary form must reproduce the above copyright
11*53ee8cc1Swenshuai.xi  *    notice, this list of conditions and the following disclaimer in the
12*53ee8cc1Swenshuai.xi  *    documentation and/or other materials provided with the distribution.
13*53ee8cc1Swenshuai.xi  * 4. Neither the name of the University nor the names of its contributors
14*53ee8cc1Swenshuai.xi  *    may be used to endorse or promote products derived from this software
15*53ee8cc1Swenshuai.xi  *    without specific prior written permission.
16*53ee8cc1Swenshuai.xi  *
17*53ee8cc1Swenshuai.xi  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18*53ee8cc1Swenshuai.xi  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19*53ee8cc1Swenshuai.xi  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20*53ee8cc1Swenshuai.xi  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21*53ee8cc1Swenshuai.xi  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22*53ee8cc1Swenshuai.xi  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23*53ee8cc1Swenshuai.xi  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24*53ee8cc1Swenshuai.xi  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25*53ee8cc1Swenshuai.xi  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26*53ee8cc1Swenshuai.xi  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27*53ee8cc1Swenshuai.xi  * SUCH DAMAGE.
28*53ee8cc1Swenshuai.xi  *
29*53ee8cc1Swenshuai.xi  *	@(#)timed.h	8.1 (Berkeley) 6/2/93
30*53ee8cc1Swenshuai.xi  */
31*53ee8cc1Swenshuai.xi 
32*53ee8cc1Swenshuai.xi #ifndef	_PROTOCOLS_TIMED_H
33*53ee8cc1Swenshuai.xi #define	_PROTOCOLS_TIMED_H 1
34*53ee8cc1Swenshuai.xi 
35*53ee8cc1Swenshuai.xi #include <rpc/types.h>
36*53ee8cc1Swenshuai.xi 
37*53ee8cc1Swenshuai.xi /*
38*53ee8cc1Swenshuai.xi  * Time Synchronization Protocol
39*53ee8cc1Swenshuai.xi  */
40*53ee8cc1Swenshuai.xi 
41*53ee8cc1Swenshuai.xi #define	TSPVERSION	1
42*53ee8cc1Swenshuai.xi #define ANYADDR 	NULL
43*53ee8cc1Swenshuai.xi 
44*53ee8cc1Swenshuai.xi struct tsp {
45*53ee8cc1Swenshuai.xi 	u_char	tsp_type;
46*53ee8cc1Swenshuai.xi 	u_char	tsp_vers;
47*53ee8cc1Swenshuai.xi 	u_short	tsp_seq;
48*53ee8cc1Swenshuai.xi 	union {
49*53ee8cc1Swenshuai.xi 		struct timeval tspu_time;
50*53ee8cc1Swenshuai.xi 		char tspu_hopcnt;
51*53ee8cc1Swenshuai.xi 	} tsp_u;
52*53ee8cc1Swenshuai.xi 	char tsp_name[MAXHOSTNAMELEN];
53*53ee8cc1Swenshuai.xi };
54*53ee8cc1Swenshuai.xi 
55*53ee8cc1Swenshuai.xi #define	tsp_time	tsp_u.tspu_time
56*53ee8cc1Swenshuai.xi #define	tsp_hopcnt	tsp_u.tspu_hopcnt
57*53ee8cc1Swenshuai.xi 
58*53ee8cc1Swenshuai.xi /*
59*53ee8cc1Swenshuai.xi  * Command types.
60*53ee8cc1Swenshuai.xi  */
61*53ee8cc1Swenshuai.xi #define	TSP_ANY			0	/* match any types */
62*53ee8cc1Swenshuai.xi #define	TSP_ADJTIME		1	/* send adjtime */
63*53ee8cc1Swenshuai.xi #define	TSP_ACK			2	/* generic acknowledgement */
64*53ee8cc1Swenshuai.xi #define	TSP_MASTERREQ		3	/* ask for master's name */
65*53ee8cc1Swenshuai.xi #define	TSP_MASTERACK		4	/* acknowledge master request */
66*53ee8cc1Swenshuai.xi #define	TSP_SETTIME		5	/* send network time */
67*53ee8cc1Swenshuai.xi #define	TSP_MASTERUP		6	/* inform slaves that master is up */
68*53ee8cc1Swenshuai.xi #define	TSP_SLAVEUP		7	/* slave is up but not polled */
69*53ee8cc1Swenshuai.xi #define	TSP_ELECTION		8	/* advance candidature for master */
70*53ee8cc1Swenshuai.xi #define	TSP_ACCEPT		9	/* support candidature of master */
71*53ee8cc1Swenshuai.xi #define	TSP_REFUSE		10	/* reject candidature of master */
72*53ee8cc1Swenshuai.xi #define	TSP_CONFLICT		11	/* two or more masters present */
73*53ee8cc1Swenshuai.xi #define	TSP_RESOLVE		12	/* masters' conflict resolution */
74*53ee8cc1Swenshuai.xi #define	TSP_QUIT		13	/* reject candidature if master is up */
75*53ee8cc1Swenshuai.xi #define	TSP_DATE		14	/* reset the time (date command) */
76*53ee8cc1Swenshuai.xi #define	TSP_DATEREQ		15	/* remote request to reset the time */
77*53ee8cc1Swenshuai.xi #define	TSP_DATEACK		16	/* acknowledge time setting  */
78*53ee8cc1Swenshuai.xi #define	TSP_TRACEON		17	/* turn tracing on */
79*53ee8cc1Swenshuai.xi #define	TSP_TRACEOFF		18	/* turn tracing off */
80*53ee8cc1Swenshuai.xi #define	TSP_MSITE		19	/* find out master's site */
81*53ee8cc1Swenshuai.xi #define	TSP_MSITEREQ		20	/* remote master's site request */
82*53ee8cc1Swenshuai.xi #define	TSP_TEST		21	/* for testing election algo */
83*53ee8cc1Swenshuai.xi #define	TSP_SETDATE		22	/* New from date command */
84*53ee8cc1Swenshuai.xi #define	TSP_SETDATEREQ		23	/* New remote for above */
85*53ee8cc1Swenshuai.xi #define	TSP_LOOP		24	/* loop detection packet */
86*53ee8cc1Swenshuai.xi 
87*53ee8cc1Swenshuai.xi #define	TSPTYPENUMBER		25
88*53ee8cc1Swenshuai.xi 
89*53ee8cc1Swenshuai.xi #ifdef TSPTYPES
90*53ee8cc1Swenshuai.xi char *tsptype[TSPTYPENUMBER] =
91*53ee8cc1Swenshuai.xi   { "ANY", "ADJTIME", "ACK", "MASTERREQ", "MASTERACK", "SETTIME", "MASTERUP",
92*53ee8cc1Swenshuai.xi   "SLAVEUP", "ELECTION", "ACCEPT", "REFUSE", "CONFLICT", "RESOLVE", "QUIT",
93*53ee8cc1Swenshuai.xi   "DATE", "DATEREQ", "DATEACK", "TRACEON", "TRACEOFF", "MSITE", "MSITEREQ",
94*53ee8cc1Swenshuai.xi   "TEST", "SETDATE", "SETDATEREQ", "LOOP" };
95*53ee8cc1Swenshuai.xi #endif
96*53ee8cc1Swenshuai.xi 
97*53ee8cc1Swenshuai.xi #endif /* protocols/timed.h */
98