Annotation of embedaddon/ntp/ntpq/ntpq.h, revision 1.1.1.1
1.1 misho 1: /*
2: * ntpq.h - definitions of interest to ntpq
3: */
4: #include "ntp_fp.h"
5: #include "ntp.h"
6: #include "ntp_control.h"
7: #include "ntp_string.h"
8: #include "ntp_malloc.h"
9: #include "lib_strbuf.h"
10:
11: /*
12: * Maximum number of arguments
13: */
14: #define MAXARGS 4
15:
16: /*
17: * Flags for forming descriptors.
18: */
19: /*
20: * Flags for forming descriptors.
21: */
22: #define OPT 0x80 /* this argument is optional, or'd with type */
23:
24: #define NO 0x0
25: #define NTP_STR 0x1 /* string argument */
26: #define NTP_UINT 0x2 /* unsigned integer */
27: #define NTP_INT 0x3 /* signed integer */
28: #define NTP_ADD 0x4 /* IP network address */
29: #define IP_VERSION 0x5 /* IP version */
30:
31: /*
32: * Arguments are returned in a union
33: */
34: typedef union {
35: char *string;
36: long ival;
37: u_long uval;
38: sockaddr_u netnum;
39: } arg_v;
40:
41: /*
42: * Structure for passing parsed command line
43: */
44: struct parse {
45: const char *keyword;
46: arg_v argval[MAXARGS];
47: int nargs;
48: };
49:
50: /*
51: * ntpdc includes a command parser which could charitably be called
52: * crude. The following structure is used to define the command
53: * syntax.
54: */
55: struct xcmd {
56: const char *keyword; /* command key word */
57: void (*handler) (struct parse *, FILE *); /* command handler */
58: u_char arg[MAXARGS]; /* descriptors for arguments */
59: const char *desc[MAXARGS]; /* descriptions for arguments */
60: const char *comment;
61: };
62:
63: /*
64: * Structure to hold association data
65: */
66: struct association {
67: associd_t assid;
68: u_short status;
69: };
70:
71: #define MAXASSOC 1024
72:
73: /*
74: * Structure for translation tables between text format
75: * variable indices and text format.
76: */
77: struct ctl_var {
78: u_short code;
79: u_short fmt;
80: const char *text;
81: };
82:
83: extern int interactive; /* are we prompting? */
84: extern int old_rv; /* use old rv behavior? --old-rv */
85:
86: extern void asciize (int, char *, FILE *);
87: extern int getnetnum (const char *, sockaddr_u *, char *, int);
88: extern void sortassoc (void);
89: extern void show_error_msg (int, associd_t);
90: extern int doquery (int, associd_t, int, int, char *,
91: u_short *, int *, const char **);
92: extern int doqueryex (int, associd_t, int, int, char *,
93: u_short *, int *, const char **, int);
94: extern char * nntohost (sockaddr_u *);
95: extern char * nntohost_col (sockaddr_u *, size_t, int);
96: extern int decodets (char *, l_fp *);
97: extern int decodeuint (char *, u_long *);
98: extern int nextvar (int *, const char **, char **, char **);
99: extern int decodetime (char *, l_fp *);
100: extern void printvars (int, const char *, int, int, int, FILE *);
101: extern int decodeint (char *, long *);
102: extern int findvar (char *, struct ctl_var *, int code);
103: extern void makeascii (int, const char *, FILE *);
104: extern char * trunc_left (const char *, size_t);
105: extern char * trunc_right (const char *, size_t);
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>