1994-09-29 23:04:24 +00:00
|
|
|
/*
|
1993-12-21 18:36:48 +00:00
|
|
|
* ntpdc.h - definitions of interest to xntpdc
|
|
|
|
*/
|
|
|
|
#include "ntp_fp.h"
|
|
|
|
#include "ntp.h"
|
|
|
|
#include "ntp_request.h"
|
|
|
|
#include "ntp_string.h"
|
|
|
|
#include "ntp_malloc.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Maximum number of arguments
|
|
|
|
*/
|
|
|
|
#define MAXARGS 4
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags for forming descriptors.
|
|
|
|
*/
|
|
|
|
#define OPT 0x80 /* this argument is optional, or'd with type */
|
|
|
|
|
|
|
|
#define NO 0x0
|
1994-09-29 23:04:24 +00:00
|
|
|
#define NTP_STR 0x1 /* string argument */
|
1993-12-21 18:36:48 +00:00
|
|
|
#define UINT 0x2 /* unsigned integer */
|
|
|
|
#define INT 0x3 /* signed integer */
|
|
|
|
#define ADD 0x4 /* IP network address */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Arguments are returned in a union
|
|
|
|
*/
|
|
|
|
typedef union {
|
|
|
|
char *string;
|
1994-09-29 23:04:24 +00:00
|
|
|
long ival;
|
|
|
|
u_long uval;
|
|
|
|
u_long netnum;
|
1993-12-21 18:36:48 +00:00
|
|
|
} arg_v;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure for passing parsed command line
|
|
|
|
*/
|
|
|
|
struct parse {
|
|
|
|
char *keyword;
|
|
|
|
arg_v argval[MAXARGS];
|
|
|
|
int nargs;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* xntpdc includes a command parser which could charitably be called
|
|
|
|
* crude. The following structure is used to define the command
|
|
|
|
* syntax.
|
|
|
|
*/
|
|
|
|
struct xcmd {
|
|
|
|
char *keyword; /* command key word */
|
|
|
|
void (*handler) P((struct parse *, FILE *)); /* command handler */
|
|
|
|
u_char arg[MAXARGS]; /* descriptors for arguments */
|
|
|
|
char *desc[MAXARGS]; /* descriptions for arguments */
|
|
|
|
char *comment;
|
|
|
|
};
|
|
|
|
|
1994-09-29 23:04:24 +00:00
|
|
|
extern int doquery P((int, int, int, int, int, char *, int *, int *, char **, int));
|
|
|
|
extern char * nntohost P((u_long));
|