]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slap.h
first step towards removing back-*/external.h
[openldap] / servers / slapd / slap.h
index 7234f15db7a6df98cb37edf08cc37ef9866e06b9..bb41efc677427e85eaa3e763dc0e1084c30afa32 100644 (file)
 #include <ac/time.h>
 #include <ac/param.h>
 
-#ifdef HAVE_GMP
-#include <gmp.h>
-#endif /* HAVE_GMP */
-
 #include "avl.h"
 
 #ifndef ldap_debug
@@ -56,6 +52,7 @@
 #include <ldap_schema.h>
 
 #include "lber_pvt.h"
+#include "ldap_pvt.h"
 #include "ldap_pvt_thread.h"
 #include "ldap_queue.h"
 
@@ -233,21 +230,13 @@ typedef struct slap_ssf_set {
        | SLAP_INDEX_SUBSTR_ANY \
        | SLAP_INDEX_SUBSTR_FINAL )
 
-/* constants for initial/final substrings indices */
-#ifndef SLAP_INDEX_SUBSTR_IF_MINLEN
-# define SLAP_INDEX_SUBSTR_IF_MINLEN   2
-#endif
-#ifndef SLAP_INDEX_SUBSTR_IF_MAXLEN
-# define SLAP_INDEX_SUBSTR_IF_MAXLEN   4
-#endif
+/* defaults for initial/final substring indices */
+#define SLAP_INDEX_SUBSTR_IF_MINLEN_DEFAULT    2
+#define SLAP_INDEX_SUBSTR_IF_MAXLEN_DEFAULT    4
 
-/* constants for any substrings indices */
-#ifndef SLAP_INDEX_SUBSTR_ANY_LEN
-# define SLAP_INDEX_SUBSTR_ANY_LEN     4
-#endif
-#ifndef SLAP_INDEX_SUBSTR_ANY_STEP
-# define SLAP_INDEX_SUBSTR_ANY_STEP    2
-#endif
+/* defaults for any substring indices */
+#define SLAP_INDEX_SUBSTR_ANY_LEN_DEFAULT              4
+#define SLAP_INDEX_SUBSTR_ANY_STEP_DEFAULT             2
 
 #define SLAP_INDEX_FLAGS         0xF000UL
 #define SLAP_INDEX_NOSUBTYPES    0x1000UL /* don't use index w/ subtypes */
@@ -487,8 +476,9 @@ typedef struct slap_matching_rule {
 #define SLAP_MR_ORDERING               0x0200U
 #define SLAP_MR_SUBSTR                 0x0400U
 #define SLAP_MR_EXT                            0x0800U /* implicitly extensible */
+#define        SLAP_MR_ORDERED_INDEX           0x1000U
 #ifdef LDAP_COMP_MATCH
-#define SLAP_MR_COMPONENT              0x1000U
+#define SLAP_MR_COMPONENT              0x2000U
 #endif
 
 #define SLAP_MR_EQUALITY_APPROX        ( SLAP_MR_EQUALITY | 0x0010U )
@@ -1459,6 +1449,8 @@ typedef struct syncinfo_s {
         int                                    si_slimit;
                int                                     si_tlimit;
                struct berval           si_syncUUID_ndn;
+               int                                     si_refreshDelete;
+               int                                     si_refreshPresent;
         Avlnode                                *si_presentlist;
                LDAP                            *si_ld;
                LDAP_LIST_HEAD(np, nonpresent_entry) si_nonpresentlist;
@@ -1672,6 +1664,7 @@ typedef struct req_search_s {
        AttributeName *rs_attrs;
        Filter *rs_filter;
        struct berval rs_filterstr;
+       int rs_post_search_id;
 } req_search_s;
 
 typedef struct req_compare_s {
@@ -2008,6 +2001,7 @@ typedef struct slap_paged_state {
 #define LDAP_PSEARCH_BY_PREMODIFY      0x03
 #define LDAP_PSEARCH_BY_MODIFY         0x04
 #define LDAP_PSEARCH_BY_SCOPEOUT       0x05
+#define LDAP_PSEARCH_BY_PREDELETE      0x06
 
 struct psid_entry {
        struct slap_op *ps_op;
@@ -2039,6 +2033,16 @@ struct slap_csn_entry {
        LDAP_TAILQ_ENTRY (slap_csn_entry) ce_csn_link;
 };
 
+struct pc_entry {
+       ID pc_id;
+       int pc_sent;
+       struct berval pc_csn;
+       struct berval pc_entryUUID;
+       struct berval pc_ename;
+       struct berval pc_enname;
+       LDAP_TAILQ_ENTRY( pc_entry ) pc_link;
+};
+
 /*
  * Caches the result of a backend_group check for ACL evaluation
  */
@@ -2058,6 +2062,7 @@ typedef struct slap_gacl {
 typedef struct slap_op {
        unsigned long o_opid;   /* id of this operation */
        unsigned long o_connid; /* id of conn initiating this op */
+       char            o_log_prefix[sizeof("conn=18446744073709551615 op=18446744073709551615")];
        struct slap_conn *o_conn;       /* connection spawning this op */
        BackendDB       *o_bd;  /* backend DB processing this op */
 
@@ -2110,6 +2115,7 @@ typedef struct slap_op {
 #define ors_attrs oq_search.rs_attrs
 #define ors_filter oq_search.rs_filter
 #define ors_filterstr oq_search.rs_filterstr
+#define ors_post_search_id oq_search.rs_post_search_id
 
 #define orr_newrdn oq_modrdn.rs_newrdn
 #define orr_nnewrdn oq_modrdn.rs_nnewrdn
@@ -2211,6 +2217,13 @@ typedef struct slap_op {
        LDAP_LIST_ENTRY(slap_op) o_ps_link;
        LDAP_LIST_HEAD(pe, psid_entry) o_pm_list;
 
+       int o_refresh_in_progress;
+       LDAP_TAILQ_HEAD(pc_pre, pc_entry) o_ps_pre_candidates;
+       LDAP_TAILQ_HEAD(pc_post, pc_entry) o_ps_post_candidates;
+       Avlnode *o_psearch_finished;
+       struct pc_entry *o_ps_send_wait;
+       ldap_pvt_thread_mutex_t o_pcmutex;
+
        AuthorizationInformation o_authz;
 
        BerElement      *o_ber;         /* ber of the request */
@@ -2434,47 +2447,20 @@ enum {
 
 typedef struct slap_counters_t {
        ldap_pvt_thread_mutex_t sc_sent_mutex;
-#ifdef HAVE_GMP
-       mpz_t                   sc_bytes;
-       mpz_t                   sc_pdu;
-       mpz_t                   sc_entries;
-       mpz_t                   sc_refs;
-#else /* ! HAVE_GMP */
-       unsigned long           sc_bytes;
-       unsigned long           sc_pdu;
-       unsigned long           sc_entries;
-       unsigned long           sc_refs;
-#endif /* ! HAVE_GMP */
+       ldap_pvt_mp_t           sc_bytes;
+       ldap_pvt_mp_t           sc_pdu;
+       ldap_pvt_mp_t           sc_entries;
+       ldap_pvt_mp_t           sc_refs;
 
        ldap_pvt_thread_mutex_t sc_ops_mutex;
-#ifdef HAVE_GMP
-       mpz_t                   sc_ops_completed;
-       mpz_t                   sc_ops_initiated;
+       ldap_pvt_mp_t           sc_ops_completed;
+       ldap_pvt_mp_t           sc_ops_initiated;
 #ifdef SLAPD_MONITOR
-       mpz_t                   sc_ops_completed_[SLAP_OP_LAST];
-       mpz_t                   sc_ops_initiated_[SLAP_OP_LAST];
+       ldap_pvt_mp_t           sc_ops_completed_[SLAP_OP_LAST];
+       ldap_pvt_mp_t           sc_ops_initiated_[SLAP_OP_LAST];
 #endif /* SLAPD_MONITOR */
-#else /* ! HAVE_GMP */
-       unsigned long           sc_ops_completed;
-       unsigned long           sc_ops_initiated;
-#ifdef SLAPD_MONITOR
-       unsigned long           sc_ops_completed_[SLAP_OP_LAST];
-       unsigned long           sc_ops_initiated_[SLAP_OP_LAST];
-#endif /* SLAPD_MONITOR */
-#endif /* ! HAVE_GMP */
 } slap_counters_t;
 
-#define        num_sent_mutex          slap_counters.sc_sent_mutex
-#define        num_bytes_sent          slap_counters.sc_bytes
-#define        num_pdu_sent            slap_counters.sc_pdu
-#define        num_entries_sent        slap_counters.sc_entries
-#define        num_refs_sent           slap_counters.sc_refs
-#define        num_ops_mutex           slap_counters.sc_ops_mutex
-#define num_ops_completed      slap_counters.sc_ops_completed
-#define num_ops_initiated      slap_counters.sc_ops_initiated
-#define num_ops_completed_     slap_counters.sc_ops_completed_
-#define num_ops_initiated_     slap_counters.sc_ops_initiated_
-
 /*
  * Better know these all around slapd
  */
@@ -2588,6 +2574,7 @@ typedef struct slap_component_assertion {
        ber_int_t               ca_use_def;
        MatchingRule            *ca_ma_rule;
        struct berval           ca_ma_value;
+       void*                   ca_component_values;
        struct slap_component_filter    *ca_cf;
        MatchingRuleAssertion   *ca_mra;
 } ComponentAssertion;
@@ -2605,6 +2592,7 @@ typedef struct slap_component_filter {
 #define cf_and         cf_un.cf_un_complex
 #define cf_or          cf_un.cf_un_complex
 #define cf_not         cf_un.cf_un_complex
+#define cf_any         cf_un.cf_un_complex
        
        struct slap_component_filter *cf_next;
 } ComponentFilter;
@@ -2614,43 +2602,76 @@ typedef struct slap_component_assertion_value {
        char* cav_ptr;
        char* cav_end;
 } ComponentAssertionValue;
-
-#include "asn.h"
-
+/*
 typedef int encoder_func LDAP_P((
        void* b,
-       void* comp));
+       void* comp));*/
 
 struct slap_component_syntax_info;
 
-typedef int decoder_func LDAP_P((
+typedef int gser_decoder_func LDAP_P((
        void* b,
-       struct slap_component_syntax_info** comp_syn_info,
-       unsigned int* len,
+       struct slap_component_syntax_info* comp_syn_info,
+       int* len,
        int mode));
 
-typedef void* extract_component_from_tag_func LDAP_P((
-       int *tag));
+typedef int comp_free_func LDAP_P((
+       void* b));
+
+typedef int ber_decoder_func LDAP_P((
+       void* b,
+       int tag,
+       int elmtLen,
+       struct slap_component_syntax_info* comp_syn_info,
+       int* len,
+       int mode));
+
+typedef int ber_tag_decoder_func LDAP_P((
+       void* b,
+       struct slap_component_syntax_info* comp_syn_info,
+       int* len,
+       int mode));
 
 typedef void* extract_component_from_id_func LDAP_P((
        ComponentReference* cr,
        void* comp ));
 
+typedef void* convert_attr_to_comp_func LDAP_P ((
+        Attribute* a,
+       Syntax* syn,
+        struct berval* bv ));
+
+struct slap_component_syntax_info;                                                                          
+typedef int convert_assert_to_comp_func LDAP_P ((
+        struct slap_component_syntax_info* csi_attr,
+        struct berval* bv,
+        struct slap_component_syntax_info** csi,
+        int* len,
+        int mode ));
+                                                                          
+typedef int convert_asn_to_ldap_func LDAP_P ((
+        struct slap_component_syntax_info* csi,
+        struct berval *bv ));
+
+typedef void free_component_func LDAP_P ((
+        struct slap_component_syntax_info* csi ));
+
 typedef int allcomponent_matching_func LDAP_P((
        char* oid,
-       void* component1,
-       void* component2 ));
+       struct slap_component_syntax_info* comp1,
+       struct slap_component_syntax_info* comp));
 
 typedef struct slap_component_desc{
        int             cd_tag;
-       ComponentId*    cd_identifier;
-       encoder_func    *cd_encoder;
-       decoder_func    *cd_decoder;
-       extract_component_from_tag_func* cd_extract_t;
+       int             cd_type;
+       int             cd_type_id;
+       gser_decoder_func       *cd_gser_decoder;
+       ber_decoder_func        *cd_ber_decoder;
+       comp_free_func          *cd_free;
        extract_component_from_id_func*  cd_extract_i;
-       AsnType         cd_type;
-       AsnTypeId       cd_type_id;
-       allcomponent_matching_func*     cd_all_match;
+       slap_syntax_validate_func       *cd_validate;
+       slap_syntax_transform_func      *cd_pretty;
+       allcomponent_matching_func      *cd_all_match;
 } ComponentDesc;
 
 typedef struct slap_component_syntax_info {
@@ -2658,18 +2679,6 @@ typedef struct slap_component_syntax_info {
        ComponentDesc* csi_comp_desc;
 } ComponentSyntaxInfo;
 
-typedef struct asntype_to_matchingrule {
-       AsnTypeId       atmr_typeId;
-       char*           atmr_mr_name;
-       MatchingRule    *atmr_mr;
-} AsnTypetoMatchingRule;
-
-typedef struct asntype_to_matchingrule_table {
-       char* atmr_oid;
-       struct asntype_to_matchingrule atmr_table[ASNTYPE_END];
-       struct asntype_to_matchingrule_table* atmr_table_next;
-} AsnTypetoMatchingRuleTable;
-
 #endif
 LDAP_END_DECL