summaryrefslogtreecommitdiffstats
path: root/ldap/xpcom/public/nsILDAPConnection.idl
blob: 63b36736372eee38a38e39ba166a69fb5f3e0093 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
 *
 * This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

interface nsILDAPOperation;
interface nsILDAPMessageListener;
interface nsILDAPURL;

%{C++
#define NS_LDAPCONNECTION_CONTRACTID "@mozilla.org/network/ldap-connection;1" 
%}

[scriptable, uuid(360c1ff7-15e3-4ffe-b4b8-0eda72ebc096)]
interface nsILDAPConnection : nsISupports
{
    /**
     * the string version of lderrno
     */
    readonly attribute wstring errorString;

    /**
     * DN to bind as.  use the init() method to set this.
     *
     * @exception NS_ERROR_OUT_OF_MEMORY
     */
    readonly attribute AUTF8String bindName;
    
    /**
     * private parameter (anything caller desires)
     */
    attribute nsISupports closure;

    /** 
     * Set up the connection.  Note that init() must be called on a thread
     * that already has an nsIEventQueue.
     *
     * @param aUrl              A URL for the ldap server. The host, port and
     *                          ssl connection type will be extracted from this
     * @param aBindName         DN to bind as
     * @param aMessageListener  Callback for DNS resolution completion
     * @param aClosure          private parameter (anything caller desires)
     * @param aVersion          LDAP version to use (currently VERSION2 or 
     *                          VERSION3)
     *
     * @exception NS_ERROR_ILLEGAL_VALUE        null pointer or invalid version
     * @exception NS_ERROR_OUT_OF_MEMORY        ran out of memory
     * @exception NS_ERROR_OFFLINE              we are in off-line mode
     * @exception NS_ERROR_FAILURE              
     * @exception NS_ERROR_UNEXPECTED           internal error
     */
    void init(in nsILDAPURL aUrl,
              in AUTF8String aBindName,
              in nsILDAPMessageListener aMessageListener,
              in nsISupports aClosure, in unsigned long aVersion);

    const unsigned long VERSION2 = 2;
    const unsigned long VERSION3 = 3;

    /**
     * Get information about the last error that occured on this connection.
     *
     * @param matched   if the server is returning LDAP_NO_SUCH_OBJECT, 
     *                  LDAP_ALIAS_PROBLEM, LDAP_INVALID_DN_SYNTAX, 
     *                  or LDAP_ALIAS_DEREF_PROBLEM, this will contain
     *                  the portion of DN that matches the entry that is 
     *                  closest to the requested entry
     *
     * @param s         additional error information from the server
     * 
     * @return          the error code, as defined in nsILDAPErrors.idl
     */
    long getLdErrno(out AUTF8String matched, out AUTF8String s);
};