]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slap.h
declare oc_bvfind_undef()
[openldap] / servers / slapd / slap.h
index c8152611dd52250baf5433a467dcf8b2c02ccc2e..a501942d4e64860c10e50d4431ea57229dcca2ad 100644 (file)
@@ -476,7 +476,7 @@ 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
+#define        SLAP_MR_ORDERED_INDEX   0x1000U
 #ifdef LDAP_COMP_MATCH
 #define SLAP_MR_COMPONENT              0x2000U
 #endif
@@ -848,6 +848,7 @@ struct slap_internal_schema {
        AttributeDescription *si_ad_distinguishedName;
        AttributeDescription *si_ad_name;
        AttributeDescription *si_ad_cn;
+       AttributeDescription *si_ad_uid;
        AttributeDescription *si_ad_userPassword;
        AttributeDescription *si_ad_labeledURI;
 #ifdef SLAPD_AUTHPASSWD
@@ -1028,6 +1029,13 @@ typedef struct slap_valuesreturnfilter {
        struct slap_valuesreturnfilter  *vrf_next;
 } ValuesReturnFilter;
 
+#ifdef LDAP_COMP_MATCH
+typedef struct         slap_component_data {
+       void* cd_mem_op;/* nibble memory handler */
+       void* cd_tree;  /* component tree */
+} ComponentData;
+#endif
+
 /*
  * represents an attribute (description + values)
  */
@@ -1035,13 +1043,13 @@ typedef struct slap_attr {
        AttributeDescription *a_desc;
        BerVarray       a_vals;         /* preserved values */
        BerVarray       a_nvals;        /* normalized values */
+#ifdef LDAP_COMP_MATCH
+       ComponentData   *a_comp_data; /* component values */
+#endif
        struct slap_attr *a_next;
        unsigned a_flags;
 #define SLAP_ATTR_IXADD                0x1U
 #define SLAP_ATTR_IXDEL                0x2U
-#ifdef LDAP_COMP_MATCH
-       void* a_component_values; /* component values */
-#endif
 } Attribute;
 
 
@@ -1157,7 +1165,7 @@ typedef struct slap_authz_info {
 } AuthorizationInformation;
 
 
-#if 0 /* LDAP_DEVEL */
+#ifdef LDAP_DEVEL
 #define SLAP_DYNACL
 #endif /* LDAP_DEVEL */
 
@@ -1492,7 +1500,6 @@ typedef struct syncinfo_s {
         int                                    si_manageDSAit;
         int                                    si_slimit;
                int                                     si_tlimit;
-               struct berval           si_syncUUID_ndn;
                int                                     si_refreshDelete;
                int                                     si_refreshPresent;
         Avlnode                                *si_presentlist;
@@ -1565,6 +1572,7 @@ struct slap_backend_db {
 #define        SLAP_DBFLAG_GLUE_INSTANCE       0x0010U /* a glue backend */
 #define        SLAP_DBFLAG_GLUE_SUBORDINATE    0x0020U /* child of a glue hierarchy */
 #define        SLAP_DBFLAG_GLUE_LINKED         0x0040U /* child is connected to parent */
+#define SLAP_DBFLAG_OVERLAY                    0x0080U /* this db struct is an overlay */
 #define SLAP_DBFLAG_SHADOW             0x8000U /* a shadow */
 #define SLAP_DBFLAG_SYNC_SHADOW                0x1000U /* a sync shadow */
 #define SLAP_DBFLAG_SLURP_SHADOW       0x2000U /* a slurp shadow */
@@ -1572,6 +1580,7 @@ struct slap_backend_db {
 #define SLAP_DBFLAGS(be)                       ((be)->be_flags)
 #define SLAP_NOLASTMOD(be)                     (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NOLASTMOD)
 #define SLAP_LASTMOD(be)                       (!SLAP_NOLASTMOD(be))
+#define SLAP_ISOVERLAY(be)                     (SLAP_DBFLAGS(be) & SLAP_DBFLAG_OVERLAY)
 #define SLAP_NO_SCHEMA_CHECK(be)       \
        (SLAP_DBFLAGS(be) & SLAP_DBFLAG_NO_SCHEMA_CHECK)
 #define        SLAP_GLUE_INSTANCE(be)          \
@@ -1660,7 +1669,6 @@ struct slap_backend_db {
        struct          be_pcl  *be_pending_csn_list;
        ldap_pvt_thread_mutex_t                                 be_pcl_mutex;
        ldap_pvt_thread_mutex_t                                 *be_pcl_mutexp;
-       struct berval                                                   be_context_csn;
        LDAP_STAILQ_HEAD( be_si, syncinfo_s )   be_syncinfo; /* For syncrepl */
 
        char    *be_realm;
@@ -2057,11 +2065,12 @@ typedef struct slap_paged_state {
 #define LDAP_PSEARCH_BY_SCOPEOUT       0x05
 #define LDAP_PSEARCH_BY_PREDELETE      0x06
 
-struct psid_entry {
+struct psid_entry {            /* DELETE ME */
        struct slap_op *ps_op;
        LDAP_LIST_ENTRY(psid_entry) ps_link;
 };
 
+#if 0  /* DELETE ME */
 struct slog_entry {
        struct berval sl_uuid;
        struct berval sl_name;
@@ -2076,9 +2085,10 @@ struct slap_session_entry {
        struct berval se_spec;
        LDAP_LIST_ENTRY( slap_session_entry ) se_link;
 };
+#endif
 
 struct slap_csn_entry {
-       struct berval *ce_csn;
+       struct berval ce_csn;
        unsigned long ce_opid;
        unsigned long ce_connid;
 #define SLAP_CSN_PENDING       1
@@ -2132,25 +2142,60 @@ struct slap_control_ids {
        int sc_LDAPsync;
 };
 
-typedef struct syncrepl_state {
-       struct sync_cookie sr_state;
-       int sr_rhint;
-} syncrepl_state;
 /*
  * represents an operation pending from an ldap client
  */
+typedef struct slap_op_header {
+       unsigned long oh_opid;  /* id of this operation */
+       unsigned long oh_connid; /* id of conn initiating this op */
+       struct slap_conn *oh_conn;      /* connection spawning this op */
+
+       ber_int_t       oh_msgid;       /* msgid of the request */
+       ber_int_t       oh_protocol;    /* version of the LDAP protocol used by client */
+
+       ldap_pvt_thread_t       oh_tid; /* thread handling this op */
+
+       void    *oh_threadctx;          /* thread pool thread context */
+       void    *oh_tmpmemctx;          /* slab malloc context */
+       BerMemoryFunctions *oh_tmpmfuncs;
+
+       char            oh_log_prefix[sizeof("conn=18446744073709551615 op=18446744073709551615")];
+
+#ifdef LDAP_SLAPI
+       void    *oh_pb;                  /* NS-SLAPI plugin */
+       void    *oh_extensions;         /* NS-SLAPI plugin */
+#endif
+} Opheader;
+
 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 */
+       Opheader *o_hdr;
+
+#define o_opid o_hdr->oh_opid
+#define o_connid o_hdr->oh_connid
+#define o_conn o_hdr->oh_conn
+#define o_msgid o_hdr->oh_msgid
+#define o_protocol o_hdr->oh_protocol
+#define o_tid o_hdr->oh_tid
+#define o_threadctx o_hdr->oh_threadctx
+#define o_tmpmemctx o_hdr->oh_tmpmemctx
+#define o_tmpmfuncs o_hdr->oh_tmpmfuncs
+
+#define        o_tmpalloc      o_tmpmfuncs->bmf_malloc
+#define o_tmpcalloc    o_tmpmfuncs->bmf_calloc
+#define        o_tmprealloc    o_tmpmfuncs->bmf_realloc
+#define        o_tmpfree       o_tmpmfuncs->bmf_free
+
+#define o_log_prefix o_hdr->oh_log_prefix
+
+#ifdef LDAP_SLAPI
+#define o_pb o_hdr->oh_pb
+#define o_extensions o_hdr->oh_extensions
+#endif
 
-       ber_int_t       o_msgid;        /* msgid of the request */
-       ber_int_t       o_protocol;     /* version of the LDAP protocol used by client */
        ber_tag_t       o_tag;          /* tag of the request */
        time_t          o_time;         /* time op was initiated */
 
+       BackendDB       *o_bd;  /* backend DB processing this op */
        struct berval   o_req_dn;       /* DN of target of request */
        struct berval   o_req_ndn;
 
@@ -2213,9 +2258,6 @@ typedef struct slap_op {
 #define ore_reqoid oq_extended.rs_reqoid
 #define ore_flags oq_extended.rs_flags
 #define ore_reqdata oq_extended.rs_reqdata
-
-       ldap_pvt_thread_t       o_tid;  /* thread handling this op */
-
        volatile sig_atomic_t o_abandon;        /* abandon flag */
        volatile sig_atomic_t o_cancel;         /* cancel flag */
 #define SLAP_CANCEL_NONE                               0x00
@@ -2297,16 +2339,10 @@ typedef struct slap_op {
 #define o_pagedresults o_ctrlflag[slap_cids.sc_pagedResults]
 #define o_pagedresults_state   o_controls[slap_cids.sc_pagedResults]
 
-#define get_pagedresults(op)                   ((int)(op)->o_pagedresults)
+#define o_sync                 o_ctrlflag[slap_cids.sc_LDAPsync]
 
-#define        o_sync  o_ctrlflag[slap_cids.sc_LDAPsync]
-       /* o_sync_mode uses data bits of o_sync */
-#define        o_sync_mode     o_ctrlflag[slap_cids.sc_LDAPsync]
+#define get_pagedresults(op)                   ((int)(op)->o_pagedresults)
 
-#define SLAP_SYNC_NONE                                 (LDAP_SYNC_NONE<<SLAP_CONTROL_SHIFT)
-#define SLAP_SYNC_REFRESH                              (LDAP_SYNC_REFRESH_ONLY<<SLAP_CONTROL_SHIFT)
-#define SLAP_SYNC_PERSIST                              (LDAP_SYNC_RESERVED<<SLAP_CONTROL_SHIFT)
-#define SLAP_SYNC_REFRESH_AND_PERSIST  (LDAP_SYNC_REFRESH_AND_PERSIST<<SLAP_CONTROL_SHIFT)
 #ifdef BDB_PSEARCH
        struct sync_cookie      o_sync_state;
        int                                     o_sync_rhint;
@@ -2337,27 +2373,15 @@ typedef struct slap_op {
        slap_callback *o_callback;      /* callback pointers */
        LDAPControl     **o_ctrls;       /* controls */
 
-       void    *o_threadctx;           /* thread pool thread context */
-       void    *o_tmpmemctx;           /* slab malloc context */
-       BerMemoryFunctions *o_tmpmfuncs;
-#define        o_tmpalloc      o_tmpmfuncs->bmf_malloc
-#define o_tmpcalloc    o_tmpmfuncs->bmf_calloc
-#define        o_tmprealloc    o_tmpmfuncs->bmf_realloc
-#define        o_tmpfree       o_tmpmfuncs->bmf_free
        void    *o_private;     /* anything the backend needs */
 
        LDAP_STAILQ_ENTRY(slap_op)      o_next; /* next operation in list         */
 
-
        int o_nocaching;
        int     o_delete_glue_parent;
 
-#ifdef LDAP_SLAPI
-       void    *o_pb;                  /* NS-SLAPI plugin */
-       void    *o_extensions;          /* NS-SLAPI plugin */
-#endif
-
 } Operation;
+#define        OPERATION_BUFFER_SIZE   (sizeof(Operation)+sizeof(Opheader)+SLAP_MAX_CIDS*sizeof(void *))
 
 #define send_ldap_error( op, rs, err, text ) do { \
                (rs)->sr_err = err; (rs)->sr_text = text; \
@@ -2653,7 +2677,7 @@ typedef int (SLAP_CTRL_PARSE_FN) LDAP_P((
 #define LDAP_COMP_FILTER_ITEM          ((ber_tag_t) 0xa3U)
 #define LDAP_COMP_FILTER_UNDEFINED     ((ber_tag_t) 0xa4U)
 
-typedef struct slap_component_id{
+typedef struct slap_component_id {
        int     ci_type;
        struct slap_component_id *ci_next;
 
@@ -2662,6 +2686,7 @@ typedef struct slap_component_id{
                ber_int_t       ci_from_beginning;
                ber_int_t       ci_count;
                ber_int_t       ci_from_end;
+               ber_int_t       ci_content;
                BerValue        ci_select_value;
                char            ci_all;
        } ci_val;
@@ -2679,7 +2704,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;
+       ComponentData           ca_comp_data; /* componentized assertion */
        struct slap_component_filter    *ca_cf;
        MatchingRuleAssertion   *ca_mra;
 } ComponentAssertion;
@@ -2707,14 +2732,17 @@ typedef struct slap_component_assertion_value {
        char* cav_ptr;
        char* cav_end;
 } ComponentAssertionValue;
-/*
+
+#if 0
 typedef int encoder_func LDAP_P((
        void* b,
-       void* comp));*/
+       void* comp));
+#endif
 
 struct slap_component_syntax_info;
 
 typedef int gser_decoder_func LDAP_P((
+       void* mem_op,
        void* b,
        struct slap_component_syntax_info** comp_syn_info,
        int* len,
@@ -2724,6 +2752,7 @@ typedef int comp_free_func LDAP_P((
        void* b));
 
 typedef int ber_decoder_func LDAP_P((
+       void* mem_op,
        void* b,
        int tag,
        int elmtLen,
@@ -2732,12 +2761,14 @@ typedef int ber_decoder_func LDAP_P((
        int mode));
 
 typedef int ber_tag_decoder_func LDAP_P((
+       void* mem_op,
        void* b,
        struct slap_component_syntax_info* comp_syn_info,
        int* len,
        int mode));
 
 typedef void* extract_component_from_id_func LDAP_P((
+       void* mem_op,
        ComponentReference* cr,
        void* comp ));
 
@@ -2746,8 +2777,15 @@ typedef void* convert_attr_to_comp_func LDAP_P ((
        Syntax* syn,
         struct berval* bv ));
 
+typedef void* alloc_nibble_func LDAP_P ((
+       int initial_size,
+       int increment_size ));
+
+typedef void free_nibble_func LDAP_P ((
+       void* nm ));
+
 struct slap_component_syntax_info;                                                                          
-typedef int convert_assert_to_comp_func LDAP_P ((
+typedef void* convert_assert_to_comp_func LDAP_P ((
         struct slap_component_syntax_info* csi_attr,
         struct berval* bv,
         struct slap_component_syntax_info** csi,
@@ -2759,7 +2797,12 @@ typedef int convert_asn_to_ldap_func LDAP_P ((
         struct berval *bv ));
 
 typedef void free_component_func LDAP_P ((
-        struct slap_component_syntax_info* csi ));
+        void* mem_op));
+
+typedef int test_component_func LDAP_P ((
+       void* mem_op,
+        struct slap_component_syntax_info* csi,
+       struct slap_component_assertion* ca));
 
 typedef int allcomponent_matching_func LDAP_P((
        char* oid,
@@ -2770,6 +2813,7 @@ typedef struct slap_component_desc{
        int             cd_tag;
        int             cd_type;
        int             cd_type_id;
+       int             cd_compref_type;
        gser_decoder_func       *cd_gser_decoder;
        ber_decoder_func        *cd_ber_decoder;
        comp_free_func          *cd_free;