"Fossies" - the Fresh Open Source Software Archive

Member "lynx2.9.0dev.1/WWW/Library/Implementation/HTGroup.h" (2 Jan 2005, 4440 Bytes) of package /linux/www/lynx2.9.0dev.1.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "HTGroup.h" see the Fossies "Dox" file reference documentation.

    1 /*                                    GROUP FILE ROUTINES
    2 
    3  */
    4 
    5 #ifndef HTGROUP_H
    6 #define HTGROUP_H
    7 
    8 #include <HTList.h>
    9 
   10 #ifdef __cplusplus
   11 extern "C" {
   12 #endif
   13     typedef HTList GroupDefList;
   14     typedef HTList ItemList;
   15 
   16     typedef struct {
   17     char *group_name;
   18     ItemList *item_list;
   19     } GroupDef;
   20 
   21 /*
   22  * Access Authorization failure reasons
   23  */
   24     typedef enum {
   25     HTAA_OK,        /* 200 OK                               */
   26     HTAA_OK_GATEWAY,    /* 200 OK, acting as a gateway          */
   27     HTAA_NO_AUTH,       /* 401 Unauthorized, not authenticated  */
   28     HTAA_NOT_MEMBER,    /* 401 Unauthorized, not authorized     */
   29     HTAA_IP_MASK,       /* 403 Forbidden by IP mask             */
   30     HTAA_BY_RULE,       /* 403 Forbidden by rule                */
   31     HTAA_NO_ACL,        /* 403 Forbidden, ACL non-existent      */
   32     HTAA_NO_ENTRY,      /* 403 Forbidden, no ACL entry          */
   33     HTAA_SETUP_ERROR,   /* 403 Forbidden, server setup error    */
   34     HTAA_DOTDOT,        /* 403 Forbidden, URL with /../ illegal */
   35     HTAA_HTBIN,     /* 403 Forbidden, /htbin not enabled    */
   36     HTAA_NOT_FOUND      /* 404 Not found, or read protected     */
   37     } HTAAFailReasonType;
   38 
   39 /*
   40 
   41 Group definition grammar
   42 
   43   string
   44                          "sequence of alphanumeric characters"
   45 
   46   user_name
   47                          string
   48 
   49   group_name
   50                          string
   51 
   52   group_ref
   53                          group_name
   54 
   55   user_def
   56                          user_name | group_ref
   57 
   58   user_def_list
   59                            user_def { ',' user_def }
   60 
   61   user_part
   62                          user_def | '(' user_def_list ')'
   63 
   64   templ
   65 
   66                          "sequence of alphanumeric characters and '*'s"
   67 
   68   ip_number_mask
   69                          templ '.' templ '.' templ '.' templ
   70 
   71   domain_name_mask
   72                          templ { '.' templ }
   73 
   74   address
   75 
   76                          ip_number_mask | domain_name_mask
   77 
   78   address_def
   79 
   80                          address
   81 
   82   address_def_list
   83                          address_def { ',' address_def }
   84 
   85   address_part
   86                          address_def | '(' address_def_list ')'
   87 
   88   item
   89                          [user_part] ['@' address_part]
   90 
   91   item_list
   92                          item { ',' item }
   93 
   94   group_def
   95                          item_list
   96 
   97   group_decl
   98                          group_name ':' group_def
   99 
  100   PARSE GROUP DEFINITION
  101 
  102  */
  103 
  104     extern GroupDef *HTAA_parseGroupDef(FILE *fp);
  105 
  106 /*
  107 
  108 Fill in Pointers to referenced Group Definitions in a Group Definition
  109 
  110    References to groups (by their name) are resolved from group_def_list and pointers to
  111    those structures are added to group_def.
  112 
  113  */
  114 
  115     extern void HTAA_resolveGroupReferences(GroupDef *group_def,
  116                         GroupDefList *group_def_list);
  117 
  118 /*
  119 
  120 Read Group File (and do caching)
  121 
  122    If group file is already in cache returns a pointer to previously read group definition
  123    list.
  124 
  125  */
  126 
  127     extern GroupDefList *HTAA_readGroupFile(const char *filename);
  128 
  129 /*
  130 
  131 Delete Group Definition
  132 
  133    Groups in cache should never be freed by this function.  This should only be used to
  134    free group definitions read by HTAA_parseGroupDef.
  135 
  136  */
  137 
  138     extern void GroupDef_delete(GroupDef *group_def);
  139 
  140 /*
  141 
  142 Print Out Group Definition (for trace purposes)
  143 
  144  */
  145 
  146     extern void HTAA_printGroupDef(GroupDef *group_def);
  147 
  148 /*
  149 
  150 Does a User Belong to a Given Set of Groups
  151 
  152    This function checks both the username and the internet address.
  153 
  154  */
  155 
  156 /* PUBLIC                                       HTAA_userAndInetInGroup()
  157  *              CHECK IF USER BELONGS TO TO A GIVEN GROUP
  158  *              AND THAT THE CONNECTION COMES FROM AN
  159  *              ADDRESS THAT IS ALLOWED BY THAT GROUP
  160  * ON ENTRY:
  161  *      group           the group definition structure.
  162  *      username        connecting user.
  163  *      ip_number       browser host IP number, optional.
  164  *      ip_name         browser host IP name, optional.
  165  *                      However, one of ip_number or ip_name
  166  *                      must be given.
  167  * ON EXIT:
  168  *      returns         HTAA_IP_MASK, if IP address mask was
  169  *                      reason for failing.
  170  *                      HTAA_NOT_MEMBER, if user does not belong
  171  *                      to the group.
  172  *                      HTAA_OK if both IP address and user are ok.
  173  */
  174     extern HTAAFailReasonType HTAA_userAndInetInGroup(GroupDef *group,
  175                               char *username,
  176                               char *ip_number,
  177                               char *ip_name);
  178 
  179 #ifdef __cplusplus
  180 }
  181 #endif
  182 #endif              /* not HTGROUP_H */