src/server/config/acl.h

changeset 415
d938228c382e
parent 394
4d2a1df73e18
--- a/src/server/config/acl.h	Wed Nov 02 19:19:01 2022 +0100
+++ b/src/server/config/acl.h	Sun Nov 06 15:53:32 2022 +0100
@@ -36,30 +36,38 @@
 extern "C" {
 #endif
 
+#define CFG_ACE_ADD(list_begin, elm) \
+    cx_linked_list_add((void**)list_begin, NULL, -1, offsetof(ACEConfig, next), elm)
+    
+#define CFG_ACE_LIST_SIZE(list) \
+    cx_linked_list_size(list, offsetof(ACEConfig, next))
+    
 typedef struct _acl_conf ACLConfig;
+typedef struct _ace_conf ACEConfig;
     
 typedef struct _acl_file {
     ConfigParser parser;
-    UcxList      *namedACLs; // ACLConfig list
-    UcxList      *uriACLs;   // ACLConfig list
-    UcxList      *pathACLs;  // ACLConfig list 
+    CxList      *namedACLs; // ACLConfig list
+    CxList      *uriACLs;   // ACLConfig list
+    CxList      *pathACLs;  // ACLConfig list 
     // temp data
     ACLConfig    *cur;
 } ACLFile;
 
 struct _acl_conf {
-    sstr_t   id; // name, uri or path
-    sstr_t   type; // webserver ACL or file system ACL
-    UcxList  *authparam; // authentication parameters
-    UcxList  *entries; // ACEConfig list
+    cxmutstr    id; // name, uri or path
+    cxmutstr    type; // webserver ACL or file system ACL
+    ConfigParam *authparam; // authentication parameters
+    ACEConfig   *entries; // ACEConfig list
 };
 
-typedef struct _ace_conf {
-    sstr_t   who;
-    uint32_t access_mask;
-    uint16_t flags;
-    uint16_t type;
-} ACEConfig;
+struct _ace_conf {
+    cxmutstr  who;
+    uint32_t  access_mask;
+    uint16_t  flags;
+    uint16_t  type;
+    ACEConfig *next;
+};
 
 
 /*
@@ -115,18 +123,18 @@
 #define ACLCFG_TYPE_ALARM   0x04
 
 
-ACLFile* load_acl_file(char *file);
+ACLFile* load_acl_file(const char *file);
 
 void free_acl_file(ACLFile *aclfile);
 
 
-int acl_parse(void *p, ConfigLine *begin, ConfigLine *end, sstr_t line);
-int parse_ace(ACLFile *f, sstr_t line);
+int acl_parse(void *p, ConfigLine *begin, ConfigLine *end, cxmutstr line);
+int parse_ace(ACLFile *f, cxmutstr line);
 
 /*
  * converts a access right string to an integer value
  */
-uint32_t accstr2int(sstr_t access);
+uint32_t accstr2int(cxstring access);
 
 #ifdef	__cplusplus
 }

mercurial