]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/rewrite-int.h
ITS#4707 added new ldap_init_fd() API
[openldap] / libraries / librewrite / rewrite-int.h
index c08b5f047a6cdf18c31b4e089e3d495c20ad6b84..ca8873b06af622c219e893e0d8774ea8fc74773f 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2000-2003 The OpenLDAP Foundation.
+ * Copyright 2000-2007 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -34,7 +34,7 @@
 #include <lber.h>
 #include <ldap.h>
 #include "../libldap/ldap-int.h"
-
+#include <lutil.h>
 #include <avl.h>
 
 #include <rewrite.h>
  */
 /* the '\' conflicts with slapd.conf parsing */
 /* #define REWRITE_SUBMATCH_ESCAPE                     '\\' */
-#define REWRITE_SUBMATCH_ESCAPE                 '%'
+#define REWRITE_SUBMATCH_ESCAPE_ORIG           '%'
+#define REWRITE_SUBMATCH_ESCAPE                        '$'
+#define IS_REWRITE_SUBMATCH_ESCAPE(c) \
+       ((c) == REWRITE_SUBMATCH_ESCAPE || (c) == REWRITE_SUBMATCH_ESCAPE_ORIG)
 
 /*
  * REGEX flags
@@ -71,6 +74,8 @@
 #define REWRITE_FLAG_STOP                      '@'
 #define REWRITE_FLAG_UNWILLING                 '#'
 #define REWRITE_FLAG_GOTO                      'G'     /* requires an arg */
+#define REWRITE_FLAG_USER                      'U'     /* requires an arg */
+#define REWRITE_FLAG_MAX_PASSES                        'M'     /* requires an arg */
 #define REWRITE_FLAG_IGNORE_ERR                        'I'
 
 /*
@@ -97,6 +102,7 @@ struct rewrite_action {
 #define REWRITE_ACTION_UNWILLING       0x0002
 #define REWRITE_ACTION_GOTO            0x0003
 #define REWRITE_ACTION_IGNORE_ERR      0x0004
+#define REWRITE_ACTION_USER            0x0005
        int                             la_type;
        void                           *la_args;
 };
@@ -151,10 +157,11 @@ struct rewrite_map {
  * Builtin maps
  */
 struct rewrite_builtin_map {
-#define REWRITE_BUILTIN_MAP_LDAP       0x0201
+#define REWRITE_BUILTIN_MAP    0x0200
        int                             lb_type;
        char                           *lb_name;
        void                           *lb_private;
+       const rewrite_mapper               *lb_mapper;
 
 #ifdef USE_REWRITE_LDAP_PVT_THREADS
        ldap_pvt_thread_mutex_t         lb_mutex;
@@ -200,7 +207,7 @@ struct rewrite_rule {
        char                           *lr_pattern;
        char                           *lr_subststring;
        char                           *lr_flagstring;
-       regex_t                         lr_regex;
+       regex_t                         lr_regex;
 
        /*
         * I was thinking about some kind of per-rule mutex, but there's
@@ -217,6 +224,7 @@ struct rewrite_rule {
 #define REWRITE_RECURSE                        0x0001
 #define REWRITE_EXEC_ONCE              0x0002
        int                             lr_mode;
+       int                             lr_max_passes;
 
        struct rewrite_action          *lr_action;
 };
@@ -302,6 +310,7 @@ struct rewrite_info {
         */
 #define REWRITE_MAXPASSES              100
        int                             li_max_passes;
+       int                             li_max_passes_per_rule;
 
        /*
         * Behavior in case a NULL or non-existent context is required