/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is part of the mozilla.org LDAP XPCOM SDK.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 2001
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *   Dan Mosedale <dmose@netscape.com> (Original Author)
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

#include "nsISupports.idl"

/**
 * Error codes used in the LDAP XPCOM SDK.
 *
 * Taken from the Mozilla C SDK's ldap.h include file, these should be
 * the same as those specified in the draft-ietf-ldapext-ldap-c-api-04.txt 
 * Internet Draft.  
 *
 * The only good documentation I'm aware of for these error codes is
 * at <http://docs.iplanet.com/docs/manuals/directory.html#SDKC>.
 * Unfortunately, this does not currently seem to be available under any
 * open source license, so I can't include that documentation here as
 * doxygen comments.
 *
 */
[scriptable, uuid(f9ac10fa-1dd1-11b2-9798-8d5cbda95d74)]
interface nsILDAPErrors : nsISupports
{

    const long SUCCESS = 0x00;

    const long OPERATIONS_ERROR = 0x01;

    const long PROTOCOL_ERROR = 0x02;

    const long TIMELIMIT_EXCEEDED = 0x03;

    const long SIZELIMIT_EXCEEDED = 0x04;

    const long COMPARE_FALSE = 0x05;

    const long COMPARE_TRUE = 0x06;

    const long STRONG_AUTH_NOT_SUPPORTED = 0x07;

    const long STRONG_AUTH_REQUIRED = 0x08;


    /**
     * UMich LDAPv2 extension
     */
    const long PARTIAL_RESULTS = 0x09;

    /**
     * new in LDAPv3
     */
    const long REFERRAL = 0x0a;

    /**
     * new in LDAPv3
     */
    const long ADMINLIMIT_EXCEEDED = 0x0b;

    /**
     * new in LDAPv3
     */
    const long UNAVAILABLE_CRITICAL_EXTENSION = 0x0c;

    /**
     * new in LDAPv3
     */
    const long CONFIDENTIALITY_REQUIRED = 0x0d;

    /**
     * new in LDAPv3
     */
    const long SASL_BIND_IN_PROGRESS = 0x0e;

    const long NO_SUCH_ATTRIBUTE = 0x10;

    const long UNDEFINED_TYPE = 0x11;

    const long INAPPROPRIATE_MATCHING = 0x12;

    const long CONSTRAINT_VIOLATION = 0x13;

    const long TYPE_OR_VALUE_EXISTS = 0x14;

    const long INVALID_SYNTAX = 0x15;

    const long NO_SUCH_OBJECT = 0x20;

    const long ALIAS_PROBLEM = 0x21;

    const long INVALID_DN_SYNTAX = 0x22;

    /**
     * not used in LDAPv3
     */
    const long IS_LEAF = 0x23;

    const long ALIAS_DEREF_PROBLEM = 0x24;

    const long INAPPROPRIATE_AUTH = 0x30;

    const long INVALID_CREDENTIALS = 0x31;
 
    const long INSUFFICIENT_ACCESS = 0x32;

    const long BUSY = 0x33;

    const long UNAVAILABLE = 0x34;    

    const long UNWILLING_TO_PERFORM = 0x35;

    const long LOOP_DETECT = 0x36;

    /**
     * server side sort extension
     */
    const long SORT_CONTROL_MISSING = 0x3C;

    /**
     * VLV extension
     */
    const long INDEX_RANGE_ERROR = 0x3D;

    const long NAMING_VIOLATION = 0x40;

    const long OBJECT_CLASS_VIOLATION = 0x41;

    const long NOT_ALLOWED_ON_NONLEAF = 0x42;

    const long NOT_ALLOWED_ON_RDN = 0x43;

    const long ALREADY_EXISTS = 0x44;

    const long NO_OBJECT_CLASS_MODS = 0x45;

    /**
     * reserved CLDAP
     */
    const long RESULTS_TOO_LARGE = 0x46;

    /**
     * new in LDAPv3
     */
    const long AFFECTS_MULTIPLE_DSAS = 0x47;

    const long OTHER = 0x50;

    const long SERVER_DOWN = 0x51;

    const long LOCAL_ERROR = 0x52;

    const long ENCODING_ERROR = 0x53;

    const long DECODING_ERROR = 0x54;

    const long TIMEOUT = 0x55;

    const long AUTH_UNKNOWN = 0x56;

    const long FILTER_ERROR = 0x57;

    const long USER_CANCELLED = 0x58;

    const long PARAM_ERROR = 0x59;

    const long NO_MEMORY = 0x5a;

    const long CONNECT_ERROR = 0x5b;

    /**
     * new in LDAPv3
     */
    const long NOT_SUPPORTED = 0x5c;

    /**
     * new in LDAPv3
     */
    const long CONTROL_NOT_FOUND = 0x5d;

    /**
     * new in LDAPv3
     */
    const long NO_RESULTS_RETURNED = 0x5e;

    /**
     * new in LDAPv3
     */
    const long MORE_RESULTS_TO_RETURN = 0x5f;

    /**
     * new in LDAPv3
     */
    const long CLIENT_LOOP = 0x60;

    /**
     * new in LDAPv3
     */
    const long REFERRAL_LIMIT_EXCEEDED = 0x61;
};

/* 
 * Map these errors codes into the nsresult namespace in C++
 */
%{C++

#define NS_ERROR_LDAP_OPERATIONS_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::OPERATIONS_ERROR)

#define NS_ERROR_LDAP_PROTOCOL_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::PROTOCOL_ERROR)

#define NS_ERROR_LDAP_TIMELIMIT_EXCEEDED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::TIMELIMIT_EXCEEDED)

#define NS_ERROR_LDAP_SIZELIMIT_EXCEEDED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::SIZELIMIT_EXCEEDED)

#define NS_ERROR_LDAP_COMPARE_FALSE \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::COMPARE_FALSE)

#define NS_ERROR_LDAP_COMPARE_TRUE \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::COMPARE_TRUE)

#define NS_ERROR_LDAP_STRONG_AUTH_NOT_SUPPORTED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::STRONG_AUTH_NOT_SUPPORTED)

#define NS_ERROR_LDAP_STRONG_AUTH_REQUIRED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::STRONG_AUTH_REQUIRED)

#define NS_ERROR_LDAP_PARTIAL_RESULTS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::PARTIAL_RESULTS)

#define NS_ERROR_LDAP_REFERRAL \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::REFERRAL)

#define NS_ERROR_LDAP_ADMINLIMIT_EXCEEDED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::ADMINLIMIT_EXCEEDED)

#define NS_ERROR_LDAP_UNAVAILABLE_CRITICAL_EXTENSION \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::UNAVAILABLE_CRITICAL_EXTENSION)

#define NS_ERROR_LDAP_CONFIDENTIALITY_REQUIRED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::CONFIDENTIALITY_REQUIRED)

#define NS_ERROR_LDAP_SASL_BIND_IN_PROGRESS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::SASL_BIND_IN_PROGRESS)

#define NS_ERROR_LDAP_NO_SUCH_ATTRIBUTE \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NO_SUCH_ATTRIBUTE)

#define NS_ERROR_LDAP_UNDEFINED_TYPE \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::UNDEFINED_TYPE)

#define NS_ERROR_LDAP_INAPPROPRIATE_MATCHING \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INAPPROPRIATE_MATCHING)

#define NS_ERROR_LDAP_CONSTRAINT_VIOLATION \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::CONSTRAINT_VIOLATION)

#define NS_ERROR_LDAP_TYPE_OR_VALUE_EXISTS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::TYPE_OR_VALUE_EXISTS)

#define NS_ERROR_LDAP_INVALID_SYNTAX \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INVALID_SYNTAX)

#define NS_ERROR_LDAP_NO_SUCH_OBJECT \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NO_SUCH_OBJECT)

#define NS_ERROR_LDAP_ALIAS_PROBLEM \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::ALIAS_PROBLEM)

#define NS_ERROR_LDAP_INVALID_DN_SYNTAX \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INVALID_DN_SYNTAX)

#define NS_ERROR_LDAP_IS_LEAF \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::IS_LEAF)

#define NS_ERROR_LDAP_ALIAS_DEREF_PROBLEM \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::ALIAS_DEREF_PROBLEM)

#define NS_ERROR_LDAP_INAPPROPRIATE_AUTH \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INAPPROPRIATE_AUTH)

#define NS_ERROR_LDAP_INVALID_CREDENTIALS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INVALID_CREDENTIALS)

#define NS_ERROR_LDAP_INSUFFICIENT_ACCESS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INSUFFICIENT_ACCESS)

#define NS_ERROR_LDAP_BUSY \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::BUSY)

#define NS_ERROR_LDAP_UNAVAILABLE \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::UNAVAILABLE)

#define NS_ERROR_LDAP_UNWILLING_TO_PERFORM \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::UNWILLING_TO_PERFORM)

#define NS_ERROR_LDAP_LOOP_DETECT \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::LOOP_DETECT)

#define NS_ERROR_LDAP_SORT_CONTROL_MISSING \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::SORT_CONTROL_MISSING)

#define NS_ERROR_LDAP_INDEX_RANGE_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::INDEX_RANGE_ERROR)

#define NS_ERROR_LDAP_NAMING_VIOLATION \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NAMING_VIOLATION)

#define NS_ERROR_LDAP_OBJECT_CLASS_VIOLATION \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::OBJECT_CLASS_VIOLATION)

#define NS_ERROR_LDAP_NOT_ALLOWED_ON_NONLEAF \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NOT_ALLOWED_ON_NONLEAF)

#define NS_ERROR_LDAP_NOT_ALLOWED_ON_RDN \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NOT_ALLOWED_ON_RDN)

#define NS_ERROR_LDAP_ALREADY_EXISTS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::ALREADY_EXISTS)

#define NS_ERROR_LDAP_NO_OBJECT_CLASS_MODS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NO_OBJECT_CLASS_MODS)

#define NS_ERROR_LDAP_RESULTS_TOO_LARGE \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::RESULTS_TOO_LARGE)

#define NS_ERROR_LDAP_AFFECTS_MULTIPLE_DSAS \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::AFFECTS_MULTIPLE_DSAS)

#define NS_ERROR_LDAP_OTHER \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::OTHER)

#define NS_ERROR_LDAP_SERVER_DOWN \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::SERVER_DOWN)

#define NS_ERROR_LDAP_LOCAL_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::LOCAL_ERROR)

#define NS_ERROR_LDAP_ENCODING_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::ENCODING_ERROR)

#define NS_ERROR_LDAP_DECODING_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::DECODING_ERROR)

#define NS_ERROR_LDAP_TIMEOUT \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::TIMEOUT)

#define NS_ERROR_LDAP_AUTH_UNKNOWN \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::AUTH_UNKNOWN)

#define NS_ERROR_LDAP_FILTER_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::FILTER_ERROR)

#define NS_ERROR_LDAP_USER_CANCELLED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::USER_CANCELLED)

#define NS_ERROR_LDAP_PARAM_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::PARAM_ERROR)

#define NS_ERROR_LDAP_NO_MEMORY \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NO_MEMORY)

#define NS_ERROR_LDAP_CONNECT_ERROR \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::CONNECT_ERROR)

#define NS_ERROR_LDAP_NOT_SUPPORTED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NOT_SUPPORTED)

#define NS_ERROR_LDAP_CONTROL_NOT_FOUND \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::CONTROL_NOT_FOUND)

#define NS_ERROR_LDAP_NO_RESULTS_RETURNED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::NO_RESULTS_RETURNED)

#define NS_ERROR_LDAP_MORE_RESULTS_TO_RETURN \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::MORE_RESULTS_TO_RETURN)

#define NS_ERROR_LDAP_CLIENT_LOOP \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::CLIENT_LOOP)

#define NS_ERROR_LDAP_REFERRAL_LIMIT_EXCEEDED \
    NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, \
                              nsILDAPErrors::REFERRAL_LIMIT_EXCEEDED)

%}
