1999-12-09 13:01:21 +00:00
|
|
|
/*
|
|
|
|
* ntpdc.h - definitions of interest to ntpdc
|
|
|
|
*/
|
|
|
|
#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
|
2008-08-18 14:26:05 +00:00
|
|
|
#define MOREARGS 10
|
1999-12-09 13:01:21 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Flags for forming descriptors.
|
|
|
|
*/
|
2008-08-18 14:26:05 +00:00
|
|
|
#define OPT 0x80 /* this argument is optional, or'd with type */
|
1999-12-09 13:01:21 +00:00
|
|
|
|
2008-08-18 14:26:05 +00:00
|
|
|
#define NO 0x0
|
|
|
|
#define NTP_STR 0x1 /* string argument */
|
|
|
|
#define NTP_UINT 0x2 /* unsigned integer */
|
|
|
|
#define NTP_INT 0x3 /* signed integer */
|
|
|
|
#define NTP_ADD 0x4 /* IP network address */
|
|
|
|
#define IP_VERSION 0x5 /* IP version */
|
1999-12-09 13:01:21 +00:00
|
|
|
|
|
|
|
/*
|
2008-08-18 14:26:05 +00:00
|
|
|
* Arguments are returned in a struct - no
|
|
|
|
* union space saving is attempted.
|
1999-12-09 13:01:21 +00:00
|
|
|
*/
|
2008-08-18 14:26:05 +00:00
|
|
|
typedef struct {
|
|
|
|
u_char type;
|
1999-12-09 13:01:21 +00:00
|
|
|
char *string;
|
|
|
|
long ival;
|
|
|
|
u_long uval;
|
2004-07-20 15:01:56 +00:00
|
|
|
struct sockaddr_storage netnum;
|
1999-12-09 13:01:21 +00:00
|
|
|
} arg_v;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Structure for passing parsed command line
|
|
|
|
*/
|
|
|
|
struct parse {
|
|
|
|
char *keyword;
|
2008-08-18 14:26:05 +00:00
|
|
|
arg_v argval[MAXARGS + MOREARGS];
|
1999-12-09 13:01:21 +00:00
|
|
|
int nargs;
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* ntpdc includes a command parser which could charitably be called
|
|
|
|
* crude. The following structure is used to define the command
|
|
|
|
* syntax.
|
|
|
|
*/
|
|
|
|
struct xcmd {
|
|
|
|
const char *keyword; /* command key word */
|
|
|
|
void (*handler) P((struct parse *, FILE *)); /* command handler */
|
|
|
|
u_char arg[MAXARGS]; /* descriptors for arguments */
|
|
|
|
const char *desc[MAXARGS]; /* descriptions for arguments */
|
|
|
|
const char *comment;
|
|
|
|
};
|
|
|
|
|
2004-07-20 15:01:56 +00:00
|
|
|
extern int impl_ver;
|
|
|
|
extern int showhostnames;
|
|
|
|
extern int s_port;
|
|
|
|
|
|
|
|
extern int doquery P((int, int, int, int, int, char *, int *, int *, char **, int, int));
|
|
|
|
extern char * nntohost P((struct sockaddr_storage *));
|