1: /*
2: * Copyright (c) 1983 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: */
6:
7: /* @(#)globals.h 2.4 (Berkeley) 5/27/86 */
8:
9: #include <sys/param.h>
10: #include <stdio.h>
11: #include <sys/time.h>
12: #include <errno.h>
13: #include <syslog.h>
14: #include <sys/socket.h>
15: #include <netinet/in.h>
16: #include <netdb.h>
17: #include <arpa/inet.h>
18:
19: extern int errno;
20: extern int sock;
21:
22: #define SAMPLEINTVL 240 /* synch() freq for master, sec */
23: #define MAXADJ 20 /* max correction (sec) for adjtime */
24: /*
25: * Parameters for network time measurement
26: * of each host using ICMP timestamp requests.
27: */
28: #define RANGE 20 /* best expected round-trip time, ms */
29: #define MSGS 5 /* # of timestamp replies to average */
30: #define TRIALS 10 /* max # of timestamp echos sent */
31:
32: #define MINTOUT 360
33: #define MAXTOUT 900
34:
35: #define GOOD 1
36: #define UNREACHABLE 2
37: #define NONSTDTIME 3
38: #define HOSTDOWN 0x7fffffff
39:
40: #define OFF 0
41: #define ON 1
42:
43: /*
44: * Global and per-network states.
45: */
46: #define NOMASTER 0 /* no master on any network */
47: #define SLAVE 1
48: #define MASTER 2
49: #define IGNORE 4
50: #define ALL (SLAVE|MASTER|IGNORE)
51: #define SUBMASTER (SLAVE|MASTER)
52:
53: #define NHOSTS 100 /* max number of hosts controlled by timed */
54:
55: struct host {
56: char *name;
57: struct sockaddr_in addr;
58: long delta;
59: u_short seq;
60: };
61:
62: struct netinfo {
63: struct netinfo *next;
64: u_long net;
65: u_long mask;
66: struct in_addr my_addr;
67: struct sockaddr_in dest_addr; /* broadcast addr or point-point */
68: long status;
69: };
70:
71: extern struct netinfo *nettab;
72: extern int status;
73: extern int trace;
74: extern int sock;
75: extern struct sockaddr_in from;
76: extern struct netinfo *fromnet, *slavenet;
77: extern FILE *fd;
78: extern char hostname[];
79: extern char tracefile[];
80: extern struct host hp[];
81: extern int backoff;
82: extern long delay1, delay2;
83: extern int slvcount;
84: extern int nslavenets; /* Number of nets were I could be a slave */
85: extern int nmasternets; /* Number of nets were I could be a master */
86: extern int nignorednets; /* Number of ignored nets */
87: extern int nnets; /* Number of nets I am connected to */
88:
89: char *strcpy(), *malloc();
Defined struct's
host
defined in line
55; used 4 times
netinfo
defined in line
62; used 86 times
- in line 63(2),
71-76(4)
- in /usr/src/etc/timed/acksend.c line
35(2)
- in /usr/src/etc/timed/candidate.c line
24(2),
92(2)
- in /usr/src/etc/timed/correct.c line
56(2)
- in /usr/src/etc/timed/master.c line
54(2),
95(2),
187(2),
215(2),
253(2),
375(2),
440(2),
476(2),
524(2)
- in /usr/src/etc/timed/readmsg.c line
42(2),
58(2),
65(2)
- in /usr/src/etc/timed/slave.c line
37(2),
148(2),
359(2),
368(2),
398(2),
476(2),
516(2)
- in /usr/src/etc/timed/timed.c line
41-47(6),
88-90(6),
250(4),
415(2),
422(2),
490(2),
504(2),
550-552(4),
560-568(6)
Defined macros
ALL
defined in line
50;
never used
GOOD
defined in line
35; used 3 times
MASTER
defined in line
48; used 21 times
- in line 50-51(2)
- in /usr/src/etc/timed/candidate.c line
38,
118
- in /usr/src/etc/timed/master.c line
68
- in /usr/src/etc/timed/readmsg.c line
229
- in /usr/src/etc/timed/slave.c line
57,
69,
109,
129,
286,
338(2),
378,
450,
460,
489
- in /usr/src/etc/timed/timed.c line
363,
390,
403,
467
MSGS
defined in line
29; used 1 times
OFF
defined in line
40; used 8 times
ON
defined in line
41; used 11 times
RANGE
defined in line
28; used 4 times
SLAVE
defined in line
47; used 22 times
- in line 50-51(2)
- in /usr/src/etc/timed/candidate.c line
68,
83
- in /usr/src/etc/timed/master.c line
318,
353
- in /usr/src/etc/timed/readmsg.c line
231
- in /usr/src/etc/timed/slave.c line
182,
197,
253,
264,
289,
344,
462
- in /usr/src/etc/timed/timed.c line
371,
396,
429,
448,
456,
464,
555,
566
Usage of this include