File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / ntp / sntp / sntp-opts.h
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:08:38 2012 UTC (12 years, 2 months ago) by misho
Branches: ntp, MAIN
CVS tags: v4_2_6p5p0, v4_2_6p5, HEAD
ntp 4.2.6p5

    1: /*  
    2:  *  EDIT THIS FILE WITH CAUTION  (sntp-opts.h)
    3:  *  
    4:  *  It has been AutoGen-ed  December 24, 2011 at 06:33:53 PM by AutoGen 5.12
    5:  *  From the definitions    sntp-opts.def
    6:  *  and the template file   options
    7:  *
    8:  * Generated from AutoOpts 35:0:10 templates.
    9:  *
   10:  *  AutoOpts is a copyrighted work.  This header file is not encumbered
   11:  *  by AutoOpts licensing, but is provided under the licensing terms chosen
   12:  *  by the sntp author or copyright holder.  AutoOpts is
   13:  *  licensed under the terms of the LGPL.  The redistributable library
   14:  *  (``libopts'') is licensed under the terms of either the LGPL or, at the
   15:  *  users discretion, the BSD license.  See the AutoOpts and/or libopts sources
   16:  *  for details.
   17:  *
   18:  * This source file is copyrighted and licensed under the following terms:
   19:  *
   20:  *  see html/copyright.html
   21:  *  
   22:  */
   23: /*
   24:  *  This file contains the programmatic interface to the Automated
   25:  *  Options generated for the sntp program.
   26:  *  These macros are documented in the AutoGen info file in the
   27:  *  "AutoOpts" chapter.  Please refer to that doc for usage help.
   28:  */
   29: #ifndef AUTOOPTS_SNTP_OPTS_H_GUARD
   30: #define AUTOOPTS_SNTP_OPTS_H_GUARD 1
   31: #include "config.h"
   32: #include <autoopts/options.h>
   33: 
   34: /*
   35:  *  Ensure that the library used for compiling this generated header is at
   36:  *  least as new as the version current when the header template was released
   37:  *  (not counting patch version increments).  Also ensure that the oldest
   38:  *  tolerable version is at least as old as what was current when the header
   39:  *  template was released.
   40:  */
   41: #define AO_TEMPLATE_VERSION 143360
   42: #if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \
   43:  || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION)
   44: # error option template version mismatches autoopts/options.h header
   45:   Choke Me.
   46: #endif
   47: 
   48: /*
   49:  *  Enumeration of each option:
   50:  */
   51: typedef enum {
   52:     INDEX_OPT_IPV4            =  0,
   53:     INDEX_OPT_IPV6            =  1,
   54:     INDEX_OPT_NORMALVERBOSE   =  2,
   55:     INDEX_OPT_KOD             =  3,
   56:     INDEX_OPT_SYSLOG          =  4,
   57:     INDEX_OPT_LOGFILE         =  5,
   58:     INDEX_OPT_SETTOD          =  6,
   59:     INDEX_OPT_ADJTIME         =  7,
   60:     INDEX_OPT_BROADCAST       =  8,
   61:     INDEX_OPT_TIMEOUT         =  9,
   62:     INDEX_OPT_AUTHENTICATION  = 10,
   63:     INDEX_OPT_KEYFILE         = 11,
   64:     INDEX_OPT_VERSION         = 12,
   65:     INDEX_OPT_HELP            = 13,
   66:     INDEX_OPT_MORE_HELP       = 14,
   67:     INDEX_OPT_SAVE_OPTS       = 15,
   68:     INDEX_OPT_LOAD_OPTS       = 16
   69: } teOptIndex;
   70: 
   71: #define OPTION_CT    17
   72: #define SNTP_VERSION       "4.2.6p5"
   73: #define SNTP_FULL_VERSION  "sntp 4.2.6p5"
   74: 
   75: /*
   76:  *  Interface defines for all options.  Replace "n" with the UPPER_CASED
   77:  *  option name (as in the teOptIndex enumeration above).
   78:  *  e.g. HAVE_OPT(IPV4)
   79:  */
   80: #define         DESC(n) (sntpOptions.pOptDesc[INDEX_OPT_## n])
   81: #define     HAVE_OPT(n) (! UNUSED_OPT(& DESC(n)))
   82: #define      OPT_ARG(n) (DESC(n).optArg.argString)
   83: #define    STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK)
   84: #define    COUNT_OPT(n) (DESC(n).optOccCt)
   85: #define    ISSEL_OPT(n) (SELECTED_OPT(&DESC(n)))
   86: #define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n)))
   87: #define  ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n)))
   88: #define  STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt)
   89: #define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs)
   90: #define    CLEAR_OPT(n) STMTS( \
   91:                 DESC(n).fOptState &= OPTST_PERSISTENT_MASK;   \
   92:                 if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \
   93:                     DESC(n).fOptState |= OPTST_DISABLED; \
   94:                 DESC(n).optCookie = NULL )
   95: 
   96: /* * * * * *
   97:  *
   98:  *  Enumeration of sntp exit codes
   99:  */
  100: typedef enum {
  101:     SNTP_EXIT_SUCCESS = 0,
  102:     SNTP_EXIT_FAILURE = 1
  103: } sntp_exit_code_t;
  104: /*
  105:  *  Make sure there are no #define name conflicts with the option names
  106:  */
  107: #ifndef     NO_OPTION_NAME_WARNINGS
  108: # ifdef    IPV4
  109: #  warning undefining IPV4 due to option name conflict
  110: #  undef   IPV4
  111: # endif
  112: # ifdef    IPV6
  113: #  warning undefining IPV6 due to option name conflict
  114: #  undef   IPV6
  115: # endif
  116: # ifdef    NORMALVERBOSE
  117: #  warning undefining NORMALVERBOSE due to option name conflict
  118: #  undef   NORMALVERBOSE
  119: # endif
  120: # ifdef    KOD
  121: #  warning undefining KOD due to option name conflict
  122: #  undef   KOD
  123: # endif
  124: # ifdef    SYSLOG
  125: #  warning undefining SYSLOG due to option name conflict
  126: #  undef   SYSLOG
  127: # endif
  128: # ifdef    LOGFILE
  129: #  warning undefining LOGFILE due to option name conflict
  130: #  undef   LOGFILE
  131: # endif
  132: # ifdef    SETTOD
  133: #  warning undefining SETTOD due to option name conflict
  134: #  undef   SETTOD
  135: # endif
  136: # ifdef    ADJTIME
  137: #  warning undefining ADJTIME due to option name conflict
  138: #  undef   ADJTIME
  139: # endif
  140: # ifdef    BROADCAST
  141: #  warning undefining BROADCAST due to option name conflict
  142: #  undef   BROADCAST
  143: # endif
  144: # ifdef    TIMEOUT
  145: #  warning undefining TIMEOUT due to option name conflict
  146: #  undef   TIMEOUT
  147: # endif
  148: # ifdef    AUTHENTICATION
  149: #  warning undefining AUTHENTICATION due to option name conflict
  150: #  undef   AUTHENTICATION
  151: # endif
  152: # ifdef    KEYFILE
  153: #  warning undefining KEYFILE due to option name conflict
  154: #  undef   KEYFILE
  155: # endif
  156: #else  /* NO_OPTION_NAME_WARNINGS */
  157: # undef IPV4
  158: # undef IPV6
  159: # undef NORMALVERBOSE
  160: # undef KOD
  161: # undef SYSLOG
  162: # undef LOGFILE
  163: # undef SETTOD
  164: # undef ADJTIME
  165: # undef BROADCAST
  166: # undef TIMEOUT
  167: # undef AUTHENTICATION
  168: # undef KEYFILE
  169: #endif  /*  NO_OPTION_NAME_WARNINGS */
  170: 
  171: /* * * * * *
  172:  *
  173:  *  Interface defines for specific options.
  174:  */
  175: #define VALUE_OPT_IPV4           '4'
  176: #define VALUE_OPT_IPV6           '6'
  177: #define VALUE_OPT_NORMALVERBOSE  'd'
  178: #define VALUE_OPT_KOD            'K'
  179: #define VALUE_OPT_SYSLOG         'p'
  180: #define VALUE_OPT_LOGFILE        'l'
  181: #define VALUE_OPT_SETTOD         's'
  182: #define VALUE_OPT_ADJTIME        'j'
  183: #define VALUE_OPT_BROADCAST      'b'
  184: #define VALUE_OPT_TIMEOUT        't'
  185: 
  186: #define OPT_VALUE_TIMEOUT        (DESC(TIMEOUT).optArg.argInt)
  187: #define VALUE_OPT_AUTHENTICATION 'a'
  188: 
  189: #define OPT_VALUE_AUTHENTICATION (DESC(AUTHENTICATION).optArg.argInt)
  190: #define VALUE_OPT_KEYFILE        'k'
  191: #define VALUE_OPT_HELP          '?'
  192: #define VALUE_OPT_MORE_HELP     '!'
  193: #define VALUE_OPT_VERSION       INDEX_OPT_VERSION
  194: #define VALUE_OPT_SAVE_OPTS     '>'
  195: #define VALUE_OPT_LOAD_OPTS     '<'
  196: #define SET_OPT_SAVE_OPTS(a)   STMTS( \
  197:         DESC(SAVE_OPTS).fOptState &= OPTST_PERSISTENT_MASK; \
  198:         DESC(SAVE_OPTS).fOptState |= OPTST_SET; \
  199:         DESC(SAVE_OPTS).optArg.argString = (char const*)(a) )
  200: /*
  201:  *  Interface defines not associated with particular options
  202:  */
  203: #define ERRSKIP_OPTERR  STMTS(sntpOptions.fOptSet &= ~OPTPROC_ERRSTOP)
  204: #define ERRSTOP_OPTERR  STMTS(sntpOptions.fOptSet |= OPTPROC_ERRSTOP)
  205: #define RESTART_OPT(n)  STMTS( \
  206:                 sntpOptions.curOptIdx = (n); \
  207:                 sntpOptions.pzCurOpt  = NULL)
  208: #define START_OPT       RESTART_OPT(1)
  209: #define USAGE(c)        (*sntpOptions.pUsageProc)(&sntpOptions, c)
  210: /* extracted from opthead.tlib near line 451 */
  211: 
  212: #ifdef  __cplusplus
  213: extern "C" {
  214: #endif
  215: 
  216: /* * * * * *
  217:  *
  218:  *  Declare the sntp option descriptor.
  219:  */
  220: extern tOptions sntpOptions;
  221: 
  222: #if defined(ENABLE_NLS)
  223: # ifndef _
  224: #   include <stdio.h>
  225: static inline char* aoGetsText(char const* pz) {
  226:     if (pz == NULL) return NULL;
  227:     return (char*)gettext(pz);
  228: }
  229: #   define _(s)  aoGetsText(s)
  230: # endif /* _() */
  231: 
  232: # define OPT_NO_XLAT_CFG_NAMES  STMTS(sntpOptions.fOptSet |= \
  233:                                     OPTPROC_NXLAT_OPT_CFG;)
  234: # define OPT_NO_XLAT_OPT_NAMES  STMTS(sntpOptions.fOptSet |= \
  235:                                     OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;)
  236: 
  237: # define OPT_XLAT_CFG_NAMES     STMTS(sntpOptions.fOptSet &= \
  238:                                   ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);)
  239: # define OPT_XLAT_OPT_NAMES     STMTS(sntpOptions.fOptSet &= \
  240:                                   ~OPTPROC_NXLAT_OPT;)
  241: 
  242: #else   /* ENABLE_NLS */
  243: # define OPT_NO_XLAT_CFG_NAMES
  244: # define OPT_NO_XLAT_OPT_NAMES
  245: 
  246: # define OPT_XLAT_CFG_NAMES
  247: # define OPT_XLAT_OPT_NAMES
  248: 
  249: # ifndef _
  250: #   define _(_s)  _s
  251: # endif
  252: #endif  /* ENABLE_NLS */
  253: 
  254: #ifdef  __cplusplus
  255: }
  256: #endif
  257: #endif /* AUTOOPTS_SNTP_OPTS_H_GUARD */
  258: /* sntp-opts.h ends here */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>