Fix the mess with ldb includes.
[metze/samba/wip.git] / source4 / libcli / ldap / ldap.h
index 30c5acc6fb516d6ada3ba914623788102e4a88a8..abb4617c485b43d91fa42c1903f08c4c2940607d 100644 (file)
@@ -5,7 +5,7 @@
     
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
    
 */
 
-#ifndef _SMB_LDAP_H
-#define _SMB_LDAP_H
+#ifndef _SMB_LDAP_H_
+#define _SMB_LDAP_H_
 
+#include "libcli/ldap/ldap_errors.h"
 #include "lib/ldb/include/ldb.h"
+#include "librpc/gen_ndr/misc.h"
 
 enum ldap_request_tag {
        LDAP_TAG_BindRequest = 0,
@@ -52,48 +53,6 @@ enum ldap_auth_mechanism {
        LDAP_AUTH_MECH_SASL = 3
 };
 
-enum ldap_result_code {
-       LDAP_SUCCESS                            = 0,
-       LDAP_OPERATIONS_ERROR                   = 1,
-       LDAP_PROTOCOL_ERROR                     = 2,
-       LDAP_TIME_LIMIT_EXCEEDED                = 3,
-       LDAP_SIZE_LIMIT_EXCEEDED                = 4,
-       LDAP_COMPARE_FALSE                      = 5,
-       LDAP_COMPARE_TRUE                       = 6,
-       LDAP_AUTH_METHOD_NOT_SUPPORTED          = 7,
-       LDAP_STRONG_AUTH_REQUIRED               = 8,
-       LDAP_REFERRAL                           = 10,
-       LDAP_ADMIN_LIMIT_EXCEEDED               = 11,
-       LDAP_UNAVAILABLE_CRITICAL_EXTENSION     = 12,
-       LDAP_CONFIDENTIALITY_REQUIRED           = 13,
-       LDAP_SASL_BIND_IN_PROGRESS              = 14,
-       LDAP_NO_SUCH_ATTRIBUTE                  = 16,
-       LDAP_UNDEFINED_ATTRIBUTE_TYPE           = 17,
-       LDAP_INAPPROPRIATE_MATCHING             = 18,
-       LDAP_CONSTRAINT_VIOLATION               = 19,
-       LDAP_ATTRIBUTE_OR_VALUE_EXISTS          = 20,
-       LDAP_INVALID_ATTRIBUTE_SYNTAX           = 21,
-       LDAP_NO_SUCH_OBJECT                     = 32,
-       LDAP_ALIAS_PROBLEM                      = 33,
-       LDAP_INVALID_DN_SYNTAX                  = 34,
-       LDAP_ALIAS_DEREFERENCING_PROBLEM        = 36,
-       LDAP_INAPPROPRIATE_AUTHENTICATION       = 48,
-       LDAP_INVALID_CREDENTIALS                = 49,
-       LDAP_INSUFFICIENT_ACCESS_RIGHTs         = 50,
-       LDAP_BUSY                               = 51,
-       LDAP_UNAVAILABLE                        = 52,
-       LDAP_UNWILLING_TO_PERFORM               = 53,
-       LDAP_LOOP_DETECT                        = 54,
-       LDAP_NAMING_VIOLATION                   = 64,
-       LDAP_OBJECT_CLASS_VIOLATION             = 65,
-       LDAP_NOT_ALLOWED_ON_NON_LEAF            = 66,
-       LDAP_NOT_ALLOWED_ON_RDN                 = 67,
-       LDAP_ENTRY_ALREADY_EXISTS               = 68,
-       LDAP_OBJECT_CLASS_MODS_PROHIBITED       = 69,
-       LDAP_AFFECTS_MULTIPLE_DSAS              = 71,
-       LDAP_OTHER                              = 80
-};
-
 struct ldap_Result {
        int resultcode;
        const char *dn;
@@ -144,7 +103,7 @@ struct ldap_SearchRequest {
        enum ldap_deref deref;
        uint32_t timelimit;
        uint32_t sizelimit;
-       BOOL attributesonly;
+       bool attributesonly;
        struct ldb_parse_tree *tree;
        int num_attributes;
        const char **attributes;
@@ -191,7 +150,7 @@ struct ldap_DelRequest {
 struct ldap_ModifyDNRequest {
        const char *dn;
        const char *newrdn;
-       BOOL deleteolddn;
+       bool deleteolddn;
        const char *newsuperior;/* optional */
 };
 
@@ -240,18 +199,22 @@ union ldap_Request {
        struct ldap_ExtendedResponse    ExtendedResponse;
 };
 
+
 struct ldap_message {
        int                     messageid;
        enum ldap_request_tag   type;
        union ldap_Request      r;
        struct ldb_control    **controls;
+       bool                   *controls_decoded;
 };
 
-struct event_context;
+struct tevent_context;
 struct cli_credentials;
 struct dom_sid;
 struct asn1_data;
 
-#include "libcli/ldap/ldap_proto.h"
+struct ldap_message *new_ldap_message(TALLOC_CTX *mem_ctx);
+NTSTATUS ldap_decode(struct asn1_data *data, struct ldap_message *msg);
+bool ldap_encode(struct ldap_message *msg, DATA_BLOB *result, TALLOC_CTX *mem_ctx);
 
-#endif
+#endif