/contrib/ntp/ntpdc/ntpdc.h

https://bitbucket.org/freebsd/freebsd-head/ · C++ Header · 67 lines · 38 code · 8 blank · 21 comment · 0 complexity · 8f74fa0c3d1f5deb61f9bde919a5cf67 MD5 · raw file

  1. /*
  2. * ntpdc.h - definitions of interest to ntpdc
  3. */
  4. #include "ntp_fp.h"
  5. #include "ntp.h"
  6. #include "ntp_request.h"
  7. #include "ntp_string.h"
  8. #include "ntp_malloc.h"
  9. /*
  10. * Maximum number of arguments
  11. */
  12. #define MAXARGS 4
  13. #define MOREARGS 10
  14. /*
  15. * Flags for forming descriptors.
  16. */
  17. #define OPT 0x80 /* this argument is optional, or'd with type */
  18. #define NO 0x0
  19. #define NTP_STR 0x1 /* string argument */
  20. #define NTP_UINT 0x2 /* unsigned integer */
  21. #define NTP_INT 0x3 /* signed integer */
  22. #define NTP_ADD 0x4 /* IP network address */
  23. #define IP_VERSION 0x5 /* IP version */
  24. /*
  25. * Arguments are returned in a struct - no
  26. * union space saving is attempted.
  27. */
  28. typedef struct {
  29. u_char type;
  30. char *string;
  31. long ival;
  32. u_long uval;
  33. struct sockaddr_storage netnum;
  34. } arg_v;
  35. /*
  36. * Structure for passing parsed command line
  37. */
  38. struct parse {
  39. char *keyword;
  40. arg_v argval[MAXARGS + MOREARGS];
  41. int nargs;
  42. };
  43. /*
  44. * ntpdc includes a command parser which could charitably be called
  45. * crude. The following structure is used to define the command
  46. * syntax.
  47. */
  48. struct xcmd {
  49. const char *keyword; /* command key word */
  50. void (*handler) P((struct parse *, FILE *)); /* command handler */
  51. u_char arg[MAXARGS]; /* descriptors for arguments */
  52. const char *desc[MAXARGS]; /* descriptions for arguments */
  53. const char *comment;
  54. };
  55. extern int impl_ver;
  56. extern int showhostnames;
  57. extern int s_port;
  58. extern int doquery P((int, int, int, int, int, char *, int *, int *, char **, int, int));
  59. extern char * nntohost P((struct sockaddr_storage *));