]> git.sur5r.net Git - openldap/blobdiff - libraries/librewrite/rewrite-int.h
Fix up abandon merge. Hallvard will holler if I get this wrong. :-)
[openldap] / libraries / librewrite / rewrite-int.h
index 375e6d5baa79f5122b700003d17b1b37839db9ab..28e47e46c64832fbcc44273f87235df6071c2112 100644 (file)
@@ -29,6 +29,7 @@
  * These are required by every file of the library, so they're included here
  */
 #include <ac/stdlib.h>
+#include <ac/string.h>
 #include <ac/syslog.h>
 #include <ac/regex.h>
 #include <ac/socket.h>
@@ -57,7 +58,8 @@
 /*
  * Submatch escape char
  */
-//#define REWRITE_SUBMATCH_ESCAPE                      '\\'
+/* the '\' conflicts with slapd.conf parsing */
+/* #define REWRITE_SUBMATCH_ESCAPE                     '\\' */
 #define REWRITE_SUBMATCH_ESCAPE                 '%'
 
 /*
@@ -311,6 +313,7 @@ struct rewrite_info {
  * PRIVATE *
  ***********/
 
+LDAP_REWRITE_V (struct rewrite_context*) __curr_context;
 
 /*
  * Maps
@@ -319,14 +322,14 @@ struct rewrite_info {
 /*
  * Parses a map (also in legacy 'x' version)
  */
-extern struct rewrite_map *
+LDAP_REWRITE_F (struct rewrite_map *)
 rewrite_map_parse(
                struct rewrite_info *info,
                const char *s,
                const char **end
 );
 
-extern struct rewrite_map *
+LDAP_REWRITE_F (struct rewrite_map *)
 rewrite_xmap_parse(
                struct rewrite_info *info,
                const char *s,
@@ -336,7 +339,7 @@ rewrite_xmap_parse(
 /*
  * Resolves key in val by means of map (also in legacy 'x' version)
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_map_apply(
                struct rewrite_info *info,
                struct rewrite_op *op,
@@ -345,7 +348,7 @@ rewrite_map_apply(
                struct berval *val
 );
 
-extern int
+LDAP_REWRITE_F (int)
 rewrite_xmap_apply(
                struct rewrite_info *info,
                struct rewrite_op *op,
@@ -362,7 +365,7 @@ rewrite_xmap_apply(
 /*
  * Compiles a substitution pattern
  */
-extern struct rewrite_subst *
+LDAP_REWRITE_F (struct rewrite_subst *)
 rewrite_subst_compile(
                struct rewrite_info *info,
                const char *result
@@ -372,7 +375,7 @@ rewrite_subst_compile(
  * Substitutes a portion of rewritten string according to substitution
  * pattern using submatches
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_subst_apply(
                struct rewrite_info *info,
                struct rewrite_op *op,
@@ -390,7 +393,7 @@ rewrite_subst_apply(
 /*
  * Compiles the rule and appends it at the running context
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_rule_compile(
                struct rewrite_info *info,
                struct rewrite_context *context,
@@ -408,7 +411,7 @@ rewrite_rule_compile(
  *      REWRITE_REGEXEC_UNWILL: rule matched; force 'unwilling to perform'
  *      REWRITE_REGEXEC_ERR:   an error occurred
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_rule_apply(
                struct rewrite_info *info,
                struct rewrite_op *op,
@@ -424,7 +427,7 @@ rewrite_rule_apply(
 /*
  * Fetches a struct rewrite_session
  */
-extern struct rewrite_session *
+LDAP_REWRITE_F (struct rewrite_session *)
 rewrite_session_find(
                 struct rewrite_info *info,
                 const void *cookie
@@ -433,7 +436,7 @@ rewrite_session_find(
 /*
  * Defines and inits a variable with session scope
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_session_var_set(
                 struct rewrite_info *info,
                 const void *cookie,
@@ -444,7 +447,7 @@ rewrite_session_var_set(
 /*
  * Gets a var with session scope
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_session_var_get(
                 struct rewrite_info *info,
                 const void *cookie,
@@ -455,7 +458,7 @@ rewrite_session_var_get(
 /*
  * Deletes a session
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_session_delete(
                 struct rewrite_info *info,
                 const void *cookie
@@ -464,7 +467,7 @@ rewrite_session_delete(
 /*
  * Destroys the cookie tree
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_session_destroy(
                 struct rewrite_info *info
 );
@@ -477,7 +480,7 @@ rewrite_session_destroy(
 /*
  * Finds a var
  */
-extern struct rewrite_var *
+LDAP_REWRITE_F (struct rewrite_var *)
 rewrite_var_find(
                 Avlnode *tree,
                 const char *name
@@ -486,7 +489,7 @@ rewrite_var_find(
 /*
  * Inserts a newly created var
  */
-extern struct rewrite_var *
+LDAP_REWRITE_F (struct rewrite_var *)
 rewrite_var_insert(
                 Avlnode **tree,
                 const char *name,
@@ -496,7 +499,7 @@ rewrite_var_insert(
 /*
  * Sets/inserts a var
  */
-extern struct rewrite_var *
+LDAP_REWRITE_F (struct rewrite_var *)
 rewrite_var_set(
                 Avlnode **tree,
                 const char *name,
@@ -507,7 +510,7 @@ rewrite_var_set(
 /*
  * Deletes a var tree
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_var_delete(
                 Avlnode *tree
 );
@@ -520,7 +523,7 @@ rewrite_var_delete(
 /*
  * Finds the context named rewriteContext in the context tree
  */
-extern struct rewrite_context *
+LDAP_REWRITE_F (struct rewrite_context *)
 rewrite_context_find(
                struct rewrite_info *info,
                const char *rewriteContext
@@ -529,7 +532,7 @@ rewrite_context_find(
 /*
  * Creates a new context called rewriteContext and stores in into the tree
  */
-extern struct rewrite_context *
+LDAP_REWRITE_F (struct rewrite_context *)
 rewrite_context_create(
                struct rewrite_info *info,
                const char *rewriteContext
@@ -541,7 +544,7 @@ rewrite_context_create(
  *      STOP:   fine, rule matched; stop processing following rules
  *      UNWILL: rule matched; force 'unwilling to perform'
  */
-extern int
+LDAP_REWRITE_F (int)
 rewrite_context_apply(
                struct rewrite_info *info,
                struct rewrite_op *op,