home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / security / xinetd / xinetd.2.0.6 / sconf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-22  |  3.8 KB  |  129 lines

  1. /*
  2.  * (c) Copyright 1992 by Panagiotis Tsirigotis
  3.  * All rights reserved.  The file named COPYRIGHT specifies the terms 
  4.  * and conditions for redistribution.
  5.  */
  6.  
  7. #ifndef SCONF_H
  8. #define SCONF_H
  9.  
  10. /*
  11.  * $Id: sconf.h,v 5.1 1992/10/31 23:59:07 panos Exp $
  12.  */
  13.  
  14. #include "pset.h"
  15.  
  16. #include "defs.h"
  17. #include "log.h"
  18. #include "mask.h"
  19. #include "env.h"
  20.  
  21. struct rpc_data
  22. {
  23.    unsigned long min_version ;
  24.    unsigned long max_version ;
  25.    unsigned long program_number ;
  26. } ;
  27.  
  28.  
  29. typedef enum { NO_ENV = 0, STD_ENV, DEF_ENV, CUSTOM_ENV } environ_e ;
  30.  
  31. struct environment
  32. {
  33.    environ_e env_type ;
  34.     env_h env ;
  35. } ;
  36.  
  37.  
  38. /*
  39.  * NOTE: Clearing the structure will give all its fields their default values
  40.  */
  41. struct service_config
  42. {
  43.    mask_t specified_attributes ;       /* specified attributes             */
  44.    mask_t attributes_present ;         /* includes those from defaults     */
  45.    mask_t type ;                       /* RPC, UNLISTED etc.               */
  46.     mask_t flags ;                                /* REUSE, INTERCEPT etc.                */
  47.    char *name ;                        /* e.g. "echo"                      */
  48.    char *id ;                          /* e.g. "echo-stream"               */
  49.    unsigned port ;                     /* in host byte order               */
  50.    int socket_type ;                   /* e.g. SOCK_DGRAM                  */
  51.    struct name_value protocol ;        /* e.g. "TCP", IPPROTO_TCP          */
  52.    boolean_e wait ;
  53.    int uid ;
  54.    int user_gid ;                      /* gid corresponding to uid         */
  55.    int gid ;                           /* gid corresponding to group       */
  56.    char *server ;
  57.    char **server_argv ;
  58.    int instances ;
  59.    pset_h env ;                        /* list of env strings              */
  60.    pset_h passenv ;                    /* env vars to pass to server       */
  61.    pset_h access_times ;
  62.    pset_h only_from ;
  63.    pset_h no_access ;
  64.    mask_t log_on_success ;
  65.    mask_t log_on_failure ;
  66.    struct log log ;
  67.    struct rpc_data rd ;
  68.    pset_h disabled ;                   /* used only for the default entry */
  69.    struct environment environment ;
  70. } ;
  71.  
  72. void sconf_dump() ;
  73. void sconf_free() ;
  74.  
  75. #define LOG( scp )                  (&(scp)->log)
  76. #define RPCDATA( scp )              (&(scp)->rd)
  77. #define ENV( scp )                  (&(scp)->environment)
  78.  
  79. /*
  80.  * Service types
  81.  */
  82. #define ST_RPC          1
  83. #define ST_INTERNAL     2
  84. #define ST_UNLISTED     3
  85. #define ST_SPECIAL        4
  86.  
  87. #define IS_RPC( scp )               ( M_IS_SET( (scp)->type, ST_RPC ) )
  88. #define IS_INTERNAL( scp )          ( M_IS_SET( (scp)->type, ST_INTERNAL ) )
  89. #define IS_UNLISTED( scp )          ( M_IS_SET( (scp)->type, ST_UNLISTED ) )
  90.  
  91.  
  92. /*
  93.  * Service flags
  94.  */
  95. #define SF_INTERCEPT        1
  96. #define SF_REUSE            2
  97. #define SF_NORETRY        3
  98.  
  99. #define IS_INTERCEPTED( scp )            ( M_IS_SET( (scp)->flags, SF_INTERCEPT ) )
  100.  
  101.  
  102. #define MUST_LISTEN( scp )       ( (scp)->socket_type == SOCK_STREAM )
  103.  
  104. #define ACCEPTS_CONNECTIONS( scp )           \
  105.       ( (scp)->wait == NO && (scp)->socket_type == SOCK_STREAM )
  106.  
  107. #define SPECIFIED( scp, attr )   \
  108.                M_IS_SET( (scp)->specified_attributes, (attr) )
  109. #define SPECIFY( scp, attr )     \
  110.                {                                                  \
  111.                   M_SET( (scp)->specified_attributes, (attr) ) ;  \
  112.                   PRESENT( (scp), (attr) ) ;                      \
  113.                }
  114. #define UNSPECIFY( scp, attr )   \
  115.                M_CLEAR( (scp)->specified_attributes, (attr) )
  116.  
  117. #define IS_PRESENT( scp, attr )  \
  118.                M_IS_SET( (scp)->attributes_present, (attr) )
  119. #define PRESENT( scp, attr )     \
  120.                M_SET( (scp)->attributes_present, (attr) )
  121. #define ABSENT( scp, attr )      \
  122.                {                                                  \
  123.                   M_CLEAR( (scp)->attributes_present, (attr) ) ;  \
  124.                   UNSPECIFY( (scp), (attr) ) ;                    \
  125.                }
  126.  
  127. #endif    /* SCONF_H */
  128.  
  129.