1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * ***** BEGIN LICENSE BLOCK *****
4 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 *
6 * The contents of this file are subject to the Mozilla Public License Version
7 * 1.1 (the "License"); you may not use this file except in compliance with
8 * the License. You may obtain a copy of the License at
9 * http://www.mozilla.org/MPL/
10 *
11 * Software distributed under the License is distributed on an "AS IS" basis,
12 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 * for the specific language governing rights and limitations under the
14 * License.
15 *
16 * The Original Code is the mozilla.org LDAP XPCOM SDK.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2000
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Dan Mosedale <dmose@mozilla.org>
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
37 *
38 * ***** END LICENSE BLOCK ***** */
39
40 #include "nsISupports.idl"
41 #include "nsILDAPConnection.idl"
42
43 interface nsILDAPMessage;
44 interface nsILDAPMessageListener;
45 interface nsILDAPModification;
46 interface nsIMutableArray;
47 interface nsIArray;
48
49 %{C++
50 #define NS_LDAPOPERATION_CONTRACTID "@mozilla.org/network/ldap-operation;1"
51 %}
52
53 // XXXdmose check to make sure ctl-related err codes documented
54
55 typedef PRUint32 PRIntervalTime;
56
57 [scriptable, uuid(b9a7ed9d-adf9-4612-8cb7-cdb5c4ef16fd)]
58 interface nsILDAPOperation : nsISupports
59 {
60 /**
61 * The connection this operation is on.
62 *
63 * @exception NS_ERROR_ILLEGAL_VALUE a NULL pointer was passed in
64 */
65 readonly attribute nsILDAPConnection connection;
66
67 /**
68 * Callback for individual result messages related to this operation (set
69 * by the init() method). This is actually an nsISupports proxy object,
70 * as the callback will happen from another thread.
71 *
72 * @exception NS_ERROR_ILLEGAL_VALUE a NULL pointer was passed in
73 */
74 readonly attribute nsILDAPMessageListener messageListener;
75
76 /**
77 * The message-id associated with this operation.
78 *
79 * @exception NS_ERROR_ILLEGAL_VALUE a NULL pointer was passed in
80 */
81 readonly attribute long messageID;
82
83 /**
84 * private parameter (anything caller desires)
85 */
86 attribute nsISupports closure;
87
88 /**
89 * No time and/or size limit specified
90 */
91 const long NO_LIMIT = 0;
92
93 /**
94 * If specified, these arrays of nsILDAPControls are passed into the LDAP
95 * C SDK for any extended operations (ie method calls on this interface
96 * ending in "Ext").
97 */
98 attribute nsIMutableArray serverControls;
99 attribute nsIMutableArray clientControls;
100
101 /**
102 * Initializes this operation. Must be called prior to initiating
103 * any actual operations. Note that by default, the aMessageListener
104 * callbacks happen on the LDAP connection thread. If you need them
105 * to happen on the main thread (or any other thread), then you should
106 * created an nsISupports proxy object and pass that in.
107 *
108 * @param aConnection connection this operation should use
109 * @param aMessageListener interface used to call back the results.
110 * @param aClosure private parameter (anything caller desires)
111 *
112 * @exception NS_ERROR_ILLEGAL_VALUE a NULL pointer was passed in
113 * @exception NS_ERROR_UNEXPECTED failed to get connection handle
114 */
115 void init(in nsILDAPConnection aConnection,
116 in nsILDAPMessageListener aMessageListener,
117 in nsISupports aClosure);
118
119 /**
120 * Asynchronously authenticate to the LDAP server.
121 *
122 * @param passwd the password used for binding; NULL for anon-binds
123 *
124 * @exception NS_ERROR_LDAP_ENCODING_ERROR problem encoding bind request
125 * @exception NS_ERROR_LDAP_SERVER_DOWN server down (XXX rebinds?)
126 * @exception NS_ERROR_LDAP_CONNECT_ERROR connection failed or lost
127 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
128 * @exception NS_ERROR_UNEXPECTED internal error
129 */
130 void simpleBind(in AUTF8String passwd);
131
132 /**
133 * Kicks off an asynchronous add request. The "ext" stands for
134 * "extensions", and is intended to convey that this method will
135 * eventually support the extensions described in the
136 * draft-ietf-ldapext-ldap-c-api-04.txt Internet Draft.
137 *
138 * @param aBaseDn Base DN to add
139 * @param aModCount Number of modifications
140 * @param aMods Array of modifications
141 *
142 * @exception NS_ERROR_NOT_INITIALIZED operation not initialized
143 * @exception NS_ERROR_INVALID_ARG invalid argument
144 * @exception NS_ERROR_LDAP_ENCODING_ERROR error during BER-encoding
145 * @exception NS_ERROR_LDAP_SERVER_DOWN the LDAP server did not
146 * receive the request or the
147 * connection was lost
148 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
149 * @exception NS_ERROR_LDAP_NOT_SUPPORTED not supported in the version
150 * of the LDAP protocol that the
151 * client is using
152 * @exception NS_ERROR_UNEXPECTED an unexpected error has
153 * occurred
154 *
155 * XXX doesn't currently handle LDAPControl params
156 */
157 void addExt(in AUTF8String aBaseDn, in nsIArray aMods);
158
159 /**
160 * Kicks off an asynchronous delete request. The "ext" stands for
161 * "extensions", and is intended to convey that this method will
162 * eventually support the extensions described in the
163 * draft-ietf-ldapext-ldap-c-api-04.txt Internet Draft.
164 *
165 * @param aBaseDn Base DN to delete
166 *
167 * @exception NS_ERROR_NOT_INITIALIZED operation not initialized
168 * @exception NS_ERROR_INVALID_ARG invalid argument
169 * @exception NS_ERROR_LDAP_ENCODING_ERROR error during BER-encoding
170 * @exception NS_ERROR_LDAP_SERVER_DOWN the LDAP server did not
171 * receive the request or the
172 * connection was lost
173 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
174 * @exception NS_ERROR_LDAP_NOT_SUPPORTED not supported in the version
175 * of the LDAP protocol that the
176 * client is using
177 * @exception NS_ERROR_UNEXPECTED an unexpected error has
178 * occurred
179 *
180 * XXX doesn't currently handle LDAPControl params
181 */
182 void deleteExt(in AUTF8String aBaseDn);
183
184 /**
185 * Kicks off an asynchronous modify request. The "ext" stands for
186 * "extensions", and is intended to convey that this method will
187 * eventually support the extensions described in the
188 * draft-ietf-ldapext-ldap-c-api-04.txt Internet Draft.
189 *
190 * @param aBaseDn Base DN to modify
191 * @param aModCount Number of modifications
192 * @param aMods Array of modifications
193 *
194 * @exception NS_ERROR_NOT_INITIALIZED operation not initialized
195 * @exception NS_ERROR_INVALID_ARG invalid argument
196 * @exception NS_ERROR_LDAP_ENCODING_ERROR error during BER-encoding
197 * @exception NS_ERROR_LDAP_SERVER_DOWN the LDAP server did not
198 * receive the request or the
199 * connection was lost
200 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
201 * @exception NS_ERROR_LDAP_NOT_SUPPORTED not supported in the version
202 * of the LDAP protocol that the
203 * client is using
204 * @exception NS_ERROR_UNEXPECTED an unexpected error has
205 * occurred
206 *
207 * XXX doesn't currently handle LDAPControl params
208 */
209 void modifyExt(in AUTF8String aBaseDn, in nsIArray aMods);
210
211 /**
212 * Kicks off an asynchronous rename request.
213 *
214 * @param aBaseDn Base DN to rename
215 * @param aNewRDn New relative DN
216 * @param aNewParent DN of the new parent under which to move the
217 * entry
218 * @param aDeleteOldRDn Indicates whether to remove the old relative
219 * DN as a value in the entry or not
220 *
221 * @exception NS_ERROR_NOT_INITIALIZED operation not initialized
222 * @exception NS_ERROR_INVALID_ARG invalid argument
223 * @exception NS_ERROR_LDAP_ENCODING_ERROR error during BER-encoding
224 * @exception NS_ERROR_LDAP_SERVER_DOWN the LDAP server did not
225 * receive the request or the
226 * connection was lost
227 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
228 * @exception NS_ERROR_LDAP_NOT_SUPPORTED not supported in the version
229 * of the LDAP protocol that the
230 * client is using
231 * @exception NS_ERROR_UNEXPECTED an unexpected error has
232 * occurred
233 *
234 * XXX doesn't currently handle LDAPControl params
235 */
236 void rename(in AUTF8String aBaseDn, in AUTF8String aNewRDn,
237 in AUTF8String aNewParent, in boolean aDeleteOldRDn);
238
239 /**
240 * Kicks off an asynchronous search request. The "ext" stands for
241 * "extensions", and is intended to convey that this method will
242 * eventually support the extensions described in the
243 * draft-ietf-ldapext-ldap-c-api-04.txt Internet Draft.
244 *
245 * @param aBaseDn Base DN to search
246 * @param aScope One of SCOPE_{BASE,ONELEVEL,SUBTREE}
247 * @param aFilter Search filter
248 * @param aAttrCount Number of attributes we request (0 for all)
249 * @param aAttributes Array of strings, holding the attrs we need
250 * @param aTimeOut How long to wait
251 * @param aSizeLimit Maximum number of entries to return.
252 *
253 * @exception NS_ERROR_NOT_INITIALIZED operation not initialized
254 * @exception NS_ERROR_LDAP_ENCODING_ERROR error during BER-encoding
255 * @exception NS_ERROR_LDAP_SERVER_DOWN the LDAP server did not
256 * receive the request or the
257 * connection was lost
258 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
259 * @exception NS_ERROR_INVALID_ARG invalid argument
260 * @exception NS_ERROR_LDAP_NOT_SUPPORTED not supported in the version
261 * of the LDAP protocol that the
262 * client is using
263 * @exception NS_ERROR_LDAP_FILTER_ERROR
264 * @exception NS_ERROR_UNEXPECTED
265 */
266 void searchExt(in AUTF8String aBaseDn, in PRInt32 aScope,
267 in AUTF8String aFilter, in unsigned long aAttrCount,
268 [array, size_is(aAttrCount)] in string aAttributes,
269 in PRIntervalTime aTimeOut, in PRInt32 aSizeLimit);
270
271 /**
272 * Cancels an async operation that is in progress.
273 *
274 * XXX controls not supported yet
275 *
276 * @exception NS_ERROR_NOT_IMPLEMENTED server or client controls
277 * were set on this object
278 * @exception NS_ERROR_NOT_INITIALIZED operation not initialized
279 * @exception NS_ERROR_LDAP_ENCODING_ERROR error during BER-encoding
280 * @exception NS_ERROR_LDAP_SERVER_DOWN the LDAP server did not
281 * receive the request or the
282 * connection was lost
283 * @exception NS_ERROR_OUT_OF_MEMORY out of memory
284 * @exception NS_ERROR_INVALID_ARG invalid argument
285 * @exception NS_ERROR_UNEXPECTED internal error
286 */
287 void abandonExt();
288 };