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 * Leif Hedstrom <leif@netscape.com>
26 *
27 * Alternatively, the contents of this file may be used under the terms of
28 * either the GNU General Public License Version 2 or later (the "GPL"), or
29 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
30 * in which case the provisions of the GPL or the LGPL are applicable instead
31 * of those above. If you wish to allow use of your version of this file only
32 * under the terms of either the GPL or the LGPL, and not to allow others to
33 * use your version of this file under the terms of the MPL, indicate your
34 * decision by deleting the provisions above and replace them with the notice
35 * and other provisions required by the GPL or the LGPL. If you do not delete
36 * the provisions above, a recipient may use your version of this file under
37 * the terms of any one of the MPL, the GPL or the LGPL.
38 *
39 * ***** END LICENSE BLOCK ***** */
40
41 #include "nsIURI.idl"
42
43 %{C++
44 #define NS_LDAPURL_CONTRACTID "@mozilla.org/network/ldap-url;1"
45 %}
46
47 /**
48 * Strings in methods inherited from nsIURI, which are using XPIDL
49 * |string| types, are expected to be UTF8 encoded. All such strings
50 * in this interface, except attribute types (e.g. "cn"), should in fact
51 * be UTF8. It's important to remember that attributes can not be UTF8,
52 * they can only be of a limited subset of ASCII (see RFC 2251).
53 */
54
55 [scriptable, uuid(7310562d-1567-43c7-a123-633c1ba3663e)]
56 interface nsILDAPURL : nsIURI {
57
58 /**
59 * The distinguished name of the URL (ie the base DN for the search).
60 * This string is expected to be a valid UTF8 string.
61 *
62 * for the getter:
63 *
64 * @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
65 * @exception NS_ERROR_OUT_OF_MEMORY Ran out of memory
66 */
67 attribute AUTF8String dn;
68
69 /**
70 * Return all LDAP attributes currently set. The empty array indicates
71 * that all attributes are requested.
72 *
73 * @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
74 * @exception NS_ERROR_OUT_OF_MEMORY Ran out of memory
75 */
76 void getAttributes(out unsigned long aCount,
77 [retval, array, size_is(aCount)] out string aAttrs);
78
79 /**
80 * Set the array of attributes, dropping whatever was there before.
81 *
82 * @param aAttrs An array of LDAP attributes
83 * @exception NS_ERROR_OUT_OF_MEMORY Ran out of memory
84 */
85 void setAttributes(in unsigned long aCount,
86 [array, size_is(aCount)] in string aAttrs);
87
88 /**
89 * Add one attribute to the array of attributes to request. If the
90 * attribute is already in our array, this becomes a noop.
91 *
92 * @param aAttribute An LDAP attribute (e.g. "cn")
93 */
94 void addAttribute(in string aAttribute);
95
96 /**
97 * Remove one attribute from the array of attributes to request. If
98 * the attribute didn't exist in the array, this becomes a noop.
99 *
100 * @param aAttribute An LDAP attribute (e.g. "cn")
101 * @exception NS_ERROR_OUT_OF_MEMORY Ran out of memory
102 */
103 void removeAttribute(in string aAttribute);
104
105 /**
106 * Test if an attribute is in our list of attributes already
107 *
108 * @param aAttribute An LDAP attribute (e.g. "cn")
109 * @return boolean Truth value
110 * @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
111 */
112 boolean hasAttribute(in string aAttribute);
113
114 /**
115 * The scope of the search. defaults to SCOPE_BASE.
116 *
117 * @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
118 * @exception NS_ERROR_MALFORMED_URI Illegal base to SET method
119 */
120 attribute long scope;
121
122 /**
123 * Search just the base object
124 */
125 const long SCOPE_BASE = 0;
126
127 /**
128 * Search only the children of the base object
129 */
130 const long SCOPE_ONELEVEL = 1;
131
132 /**
133 * Search the entire subtree under and including the base object
134 */
135 const long SCOPE_SUBTREE = 2;
136
137 /**
138 * The search filter. "(objectClass=*)" is the default.
139 */
140 attribute AUTF8String filter;
141
142 /**
143 * Any options defined for this URL (check options using a bitwise and)
144 *
145 * @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
146 * @exception NS_ERROR_OUT_OF_MEMORY Ran out of memory
147 */
148 attribute unsigned long options;
149
150 /**
151 * If this is set/true, this is an ldaps: URL, not an ldap: URL
152 */
153 const unsigned long OPT_SECURE = 0x01;
154
155 };