]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/slap.h
make unregistered known controls show up as undefined; move LDAPsync cid to frontend...
[openldap] / servers / slapd / slap.h
index af6f8793cb0f0fee08dfe9216a31e67ff208b126..d9186d040cea86de915c3e7a27b9aa53898bfc6d 100644 (file)
@@ -1565,6 +1565,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 +1573,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)          \
@@ -2135,18 +2137,57 @@ struct slap_control_ids {
 /*
  * 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;
 
@@ -2209,9 +2250,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
@@ -2230,6 +2268,7 @@ typedef struct slap_op {
 #define        SLAP_CONTROL_MASK       3
 
 /* spare bits for simple flags */
+#define SLAP_CONTROL_SHIFT     4       /* shift to reach data bits */
 #define SLAP_CONTROL_DATA0     0x10
 #define SLAP_CONTROL_DATA1     0x20
 #define SLAP_CONTROL_DATA2     0x40
@@ -2292,15 +2331,11 @@ 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]
+#define get_pagedresults(op)                   ((int)(op)->o_pagedresults)
 
-       char o_sync_mode;
-#define SLAP_SYNC_NONE                                 LDAP_SYNC_NONE
-#define SLAP_SYNC_REFRESH                              LDAP_SYNC_REFRESH_ONLY
-#define SLAP_SYNC_PERSIST                              LDAP_SYNC_RESERVED
-#define SLAP_SYNC_REFRESH_AND_PERSIST  LDAP_SYNC_REFRESH_AND_PERSIST
+#ifdef BDB_PSEARCH
        struct sync_cookie      o_sync_state;
        int                                     o_sync_rhint;
        struct berval           o_sync_cid;
@@ -2321,6 +2356,7 @@ typedef struct slap_op {
        Avlnode *o_psearch_finished;
        struct pc_entry *o_ps_send_wait;
        ldap_pvt_thread_mutex_t o_pcmutex;
+#endif
 
        AuthorizationInformation o_authz;
 
@@ -2329,27 +2365,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; \
@@ -2372,15 +2396,15 @@ typedef void (SEND_LDAP_INTERMEDIATE)(
        struct slap_op *op, struct slap_rep *rs);
 
 #define send_ldap_result( op, rs ) \
-       (op->o_conn->c_send_ldap_result)( op, rs )
+       ((op)->o_conn->c_send_ldap_result)( op, rs )
 #define send_search_entry( op, rs ) \
-       (op->o_conn->c_send_search_entry)( op, rs )
+       ((op)->o_conn->c_send_search_entry)( op, rs )
 #define send_search_reference( op, rs ) \
-       (op->o_conn->c_send_search_reference)( op, rs )
+       ((op)->o_conn->c_send_search_reference)( op, rs )
 #define send_ldap_extended( op, rs ) \
-       (op->o_conn->c_send_ldap_extended)( op, rs )
+       ((op)->o_conn->c_send_ldap_extended)( op, rs )
 #define send_ldap_intermediate( op, rs ) \
-       (op->o_conn->c_send_ldap_intermediate)( op, rs )
+       ((op)->o_conn->c_send_ldap_intermediate)( op, rs )
 
 typedef struct slap_listener Listener;