1 /* $NetBSD: ntpdc.h,v 1.8 2020/05/25 20:47:26 christos Exp $ */ 2 3 /* 4 * ntpdc.h - definitions of interest to ntpdc 5 */ 6 #include "ntp_fp.h" 7 #include "ntp.h" 8 #include "ntp_request.h" 9 #include "ntp_string.h" 10 #include "ntp_malloc.h" 11 12 /* 13 * Maximum number of arguments 14 */ 15 #define MAXARGS 4 16 #define MOREARGS 10 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 struct - no 32 * union space saving is attempted. 33 */ 34 typedef struct { 35 u_char type; 36 char *string; 37 long ival; 38 u_long uval; 39 sockaddr_u netnum; 40 } arg_v; 41 42 /* 43 * Structure for passing parsed command line 44 */ 45 struct parse { 46 char *keyword; 47 arg_v argval[MAXARGS + MOREARGS]; 48 size_t nargs; 49 }; 50 51 /* 52 * ntpdc includes a command parser which could charitably be called 53 * crude. The following structure is used to define the command 54 * syntax. 55 */ 56 struct xcmd { 57 const char *keyword; /* command key word */ 58 void (*handler) (struct parse *, FILE *); /* command handler */ 59 u_char arg[MAXARGS]; /* descriptors for arguments */ 60 const char *desc[MAXARGS]; /* descriptions for arguments */ 61 const char *comment; 62 }; 63 64 extern int impl_ver; 65 extern int showhostnames; 66 extern int s_port; 67 68 extern int doquery (int, int, int, size_t, size_t, const char *, size_t *, size_t *, const char **, int, int); 69 extern const char * nntohost (sockaddr_u *); 70