PageRenderTime 34ms CodeModel.GetById 26ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/contrib/ntp/ntpq/ntpq.h

https://bitbucket.org/freebsd/freebsd-head/
C++ Header | 93 lines | 53 code | 10 blank | 30 comment | 0 complexity | 3a6a316dbc0c7d5fa29651c8626acf35 MD5 | raw file
 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
10/*
11 * Maximum number of arguments
12 */
13#define	MAXARGS	4
14
15/*
16 * Flags for forming descriptors.
17 */
18/*
19 * Flags for forming descriptors.
20 */
21#define	OPT		0x80	/* this argument is optional, or'd with type */
22
23#define	NO		0x0
24#define	NTP_STR		0x1	/* string argument */
25#define	NTP_UINT	0x2	/* unsigned integer */
26#define	NTP_INT		0x3	/* signed integer */
27#define	NTP_ADD		0x4	/* IP network address */
28#define IP_VERSION	0x5	/* IP version */
29
30/*
31 * Arguments are returned in a union
32 */
33typedef union {
34	char *string;
35	long ival;
36	u_long uval;
37	struct sockaddr_storage netnum;
38} arg_v;
39
40/*
41 * Structure for passing parsed command line
42 */
43struct parse {
44	const char *keyword;
45	arg_v argval[MAXARGS];
46	int nargs;
47};
48
49/*
50 * ntpdc includes a command parser which could charitably be called
51 * crude.  The following structure is used to define the command
52 * syntax.
53 */
54struct xcmd {
55  const char *keyword;		/* command key word */
56	void (*handler)	P((struct parse *, FILE *));	/* command handler */
57	u_char arg[MAXARGS];	/* descriptors for arguments */
58  const char *desc[MAXARGS];	/* descriptions for arguments */
59  const char *comment;
60};
61
62/*
63 * Structure to hold association data
64 */
65struct association {
66	u_short assid;
67	u_short status;
68};
69
70#define	MAXASSOC	1024
71
72/*
73 * Structure for translation tables between text format
74 * variable indices and text format.
75 */
76struct ctl_var {
77	u_short code;
78	u_short fmt;
79	const char *text;
80};
81
82extern	void	asciize		P((int, char *, FILE *));
83extern	int	getnetnum	P((const char *, struct sockaddr_storage *, char *, int));
84extern	void	sortassoc	P((void));
85extern	int	doquery		P((int, int, int, int, char *, u_short *, int *, char **));
86extern	char *	nntohost	P((struct sockaddr_storage *));
87extern	int	decodets	P((char *, l_fp *));
88extern	int	decodeuint	P((char *, u_long *));
89extern	int	nextvar		P((int *, char **, char **, char **));
90extern	int	decodetime	P((char *, l_fp *));
91extern	void	printvars	P((int, char *, int, int, FILE *));
92extern	int	decodeint	P((char *, long *));
93extern	int	findvar		P((char *, struct ctl_var *, int code));