r15065: Remove duplicate prototype.
[bbaumbach/samba-autobuild/.git] / source / lib / ldb / include / ldb.h
index 4e457b028fa2763e0694118432e5e86c8dfdfdb6..589bb4b6a14aa953179720efcde8cc32e5564561 100644 (file)
@@ -214,7 +214,6 @@ struct ldb_debug_ops {
 */
 struct ldb_utf8_fns {
        void *context;
-       int (*caseless_cmp)(void *context, const char *s1, const char *s2);
        char *(*casefold)(void *context, void *mem_ctx, const char *s);
 };
 
@@ -456,20 +455,36 @@ typedef int (*ldb_qsort_cmp_fn_t) (void *v1, void *v2, void *opaque);
 /**
    OID for LDAP Attribute Scoped Query extension.
 
-   This control is include in SearchRequest or SearchResponse
+   This control is included in SearchRequest or SearchResponse
    messages as part of the controls field of the LDAPMessage.
 */
 #define LDB_CONTROL_ASQ_OID            "1.2.840.113556.1.4.1504"
 
 /**
-   OID for LDAPrectory Sync extension. 
+   OID for LDAP Directory Sync extension. 
 
-   This control is include in SearchRequest or SearchResponse
+   This control is included in SearchRequest or SearchResponse
    messages as part of the controls field of the LDAPMessage.
 */
 #define LDB_CONTROL_DIRSYNC_OID                "1.2.840.113556.1.4.841"
 
 
+/**
+   OID for LDAP Virtual List View Request extension.
+
+   This control is included in SearchRequest messages
+   as part of the controls field of the LDAPMessage.
+*/
+#define LDB_CONTROL_VLV_REQ_OID                "2.16.840.1.113730.3.4.9"
+
+/**
+   OID for LDAP Virtual List View Response extension.
+
+   This control is included in SearchResponse messages
+   as part of the controls field of the LDAPMessage.
+*/
+#define LDB_CONTROL_VLV_RESP_OID       "2.16.840.1.113730.3.4.10"
+
 struct ldb_paged_control {
        int size;
        int cookie_len;
@@ -505,6 +520,32 @@ struct ldb_dirsync_control {
        char *cookie;
 };
 
+struct ldb_vlv_req_control {
+       int beforeCount;
+       int afterCount;
+       int type;
+       union {
+               struct {
+                       int offset;
+                       int contentCount;
+               } byOffset;
+               struct {
+                       int value_len;
+                       char *value;
+               } gtOrEq;
+       } match;
+       int ctxid_len;
+       char *contextId;
+};
+
+struct ldb_vlv_resp_control {
+       int targetPosition;
+       int contentCount;
+       int vlv_result;
+       int ctxid_len;
+       char *contextId;
+};
+
 struct ldb_control {
        const char *oid;
        int critical;
@@ -519,15 +560,53 @@ enum ldb_request_type {
        LDB_REQ_MODIFY,
        LDB_REQ_DELETE,
        LDB_REQ_RENAME,
+       LDB_ASYNC_SEARCH,
+       LDB_ASYNC_ADD,
+       LDB_ASYNC_MODIFY,
+       LDB_ASYNC_DELETE,
+       LDB_ASYNC_RENAME,
+
        LDB_REQ_REGISTER
 };
 
+enum ldb_reply_type {
+       LDB_REPLY_ENTRY,
+       LDB_REPLY_REFERRAL,
+       LDB_REPLY_DONE
+};
+
+enum ldb_async_wait_type {
+       LDB_WAIT_ALL,
+       LDB_WAIT_NONE
+};
+
+enum ldb_async_state {
+       LDB_ASYNC_INIT,
+       LDB_ASYNC_PENDING,
+       LDB_ASYNC_DONE
+};
+
 struct ldb_result {
        unsigned int count;
        struct ldb_message **msgs;
+       char **refs;
        struct ldb_control **controls;
 };
 
+struct ldb_async_result {
+       enum ldb_reply_type type;
+       struct ldb_message *message;
+       char *referral;
+       struct ldb_control **controls;
+};
+
+struct ldb_async_handle {
+       int status;
+       enum ldb_async_state state;
+       void *private_data;
+       struct ldb_module *module;
+};
+
 struct ldb_search {
        const struct ldb_dn *base;
        enum ldb_scope scope;
@@ -572,10 +651,29 @@ struct ldb_request {
 
        struct ldb_control **controls;
        struct ldb_credentials *creds;
+
+       struct {
+               void *context;
+               int (*callback)(struct ldb_context *, void *, struct ldb_async_result *);
+
+               int timeout;
+               struct ldb_async_handle *handle;
+       } async;
 };
 
 int ldb_request(struct ldb_context *ldb, struct ldb_request *request);
 
+int ldb_async_wait(struct ldb_async_handle *handle, enum ldb_async_wait_type type);
+
+/**
+  Initialise ldbs' global information
+
+  This is required before any other LDB call
+
+  \return 0 if initialisation succeeded, -1 otherwise
+*/
+int ldb_global_init(void);
+
 /**
   Initialise an ldb context
 
@@ -748,21 +846,6 @@ void ldb_set_utf8_default(struct ldb_context *ldb);
 */
 char *ldb_casefold(struct ldb_context *ldb, void *mem_ctx, const char *s);
 
-/**
-   Compare two strings, without regard to case. 
-
-   \param ldb the ldb context
-   \param s1 the first string to compare
-   \param s2 the second string to compare
-
-   \return 0 if the strings are the same, non-zero if there are any
-   differences except for case.
-
-   \note The default function is not yet UTF8 aware. Provide your own
-         set of functions through ldb_set_utf8_fns()
-*/
-int ldb_caseless_cmp(struct ldb_context *ldb, const char *s1, const char *s2);
-
 /**
    Check the attribute name is valid according to rfc2251
    \param s tthe string to check
@@ -972,7 +1055,6 @@ int ldb_dn_cmp(struct ldb_context *ldb, const char *dn1, const char *dn2);
 int ldb_attr_cmp(const char *attr1, const char *attr2);
 char *ldb_attr_casefold(void *mem_ctx, const char *s);
 int ldb_attr_dn(const char *attr);
-char *ldb_dn_escape_value(void *mem_ctx, struct ldb_val value);
 
 /**
    Create an empty message
@@ -1024,6 +1106,11 @@ int ldb_msg_add(struct ldb_message *msg,
 int ldb_msg_add_value(struct ldb_message *msg, 
                      const char *attr_name,
                      const struct ldb_val *val);
+int ldb_msg_add_steal_value(struct ldb_message *msg, 
+                     const char *attr_name,
+                     struct ldb_val *val);
+int ldb_msg_add_steal_string(struct ldb_message *msg, 
+                            const char *attr_name, char *str);
 int ldb_msg_add_string(struct ldb_message *msg, 
                       const char *attr_name, const char *str);
 int ldb_msg_add_fmt(struct ldb_message *msg, 
@@ -1118,7 +1205,6 @@ int ldb_set_debug(struct ldb_context *ldb,
 */
 void ldb_set_utf8_fns(struct ldb_context *ldb,
                        void *context,
-                       int (*cmp)(void *, const char *, const char *),
                        char *(*casefold)(void *, void *, const char *));
 
 /**