BSD 4_3_Net_1 release
[unix-history] / timed / globals.h
CommitLineData
897da385
RG
1/*
2 * Copyright (c) 1983 Regents of the University of California.
26b5a830
KB
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms are permitted
b8c620d6
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.
26b5a830 16 *
ca67e7b4 17 * @(#)globals.h 2.6 (Berkeley) 6/18/88
897da385
RG
18 */
19
a4d8461e 20#include <sys/param.h>
897da385
RG
21#include <stdio.h>
22#include <sys/time.h>
23#include <errno.h>
24#include <syslog.h>
25#include <sys/socket.h>
26#include <netinet/in.h>
27#include <netdb.h>
28#include <arpa/inet.h>
29
30extern int errno;
75d5ce8a 31extern int sock;
897da385 32
0c850355
MK
33#define SAMPLEINTVL 240 /* synch() freq for master, sec */
34#define MAXADJ 20 /* max correction (sec) for adjtime */
35/*
36 * Parameters for network time measurement
37 * of each host using ICMP timestamp requests.
38 */
39#define RANGE 20 /* best expected round-trip time, ms */
40#define MSGS 5 /* # of timestamp replies to average */
41#define TRIALS 10 /* max # of timestamp echos sent */
42
897da385
RG
43#define MINTOUT 360
44#define MAXTOUT 900
45
46#define GOOD 1
47#define UNREACHABLE 2
48#define NONSTDTIME 3
49#define HOSTDOWN 0x7fffffff
a4d8461e
JB
50
51#define OFF 0
52#define ON 1
53
0c850355
MK
54/*
55 * Global and per-network states.
56 */
57#define NOMASTER 0 /* no master on any network */
58#define SLAVE 1
59#define MASTER 2
60#define IGNORE 4
61#define ALL (SLAVE|MASTER|IGNORE)
75d5ce8a 62#define SUBMASTER (SLAVE|MASTER)
a4d8461e 63
0c850355 64#define NHOSTS 100 /* max number of hosts controlled by timed */
a4d8461e
JB
65
66struct host {
67 char *name;
75d5ce8a 68 struct sockaddr_in addr;
a4d8461e
JB
69 long delta;
70 u_short seq;
71};
72
75d5ce8a
JB
73struct netinfo {
74 struct netinfo *next;
75 u_long net;
76 u_long mask;
77 struct in_addr my_addr;
78 struct sockaddr_in dest_addr; /* broadcast addr or point-point */
79 long status;
80};
81
82extern struct netinfo *nettab;
83extern int status;
84extern int trace;
85extern int sock;
86extern struct sockaddr_in from;
9a957f87 87extern struct netinfo *fromnet, *slavenet;
75d5ce8a
JB
88extern FILE *fd;
89extern char hostname[];
90extern char tracefile[];
91extern struct host hp[];
92extern int backoff;
93extern long delay1, delay2;
94extern int slvcount;
9a957f87
JB
95extern int nslavenets; /* Number of nets were I could be a slave */
96extern int nmasternets; /* Number of nets were I could be a master */
97extern int nignorednets; /* Number of ignored nets */
98extern int nnets; /* Number of nets I am connected to */
75d5ce8a
JB
99
100char *strcpy(), *malloc();