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 mozilla.org code.
17 *
18 * The Initial Developer of the Original Code is
19 * Netscape Communications Corporation.
20 * Portions created by the Initial Developer are Copyright (C) 2001
21 * the Initial Developer. All Rights Reserved.
22 *
23 * Contributor(s):
24 * Dan Mosedale <dmose@netscape.com> (Original Author)
25 *
26 * Alternatively, the contents of this file may be used under the terms of
27 * either of the GNU General Public License Version 2 or later (the "GPL"),
28 * or 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 "nsIAutoCompleteSession.idl"
41
42 // forward decls
43 //
44 interface nsILDAPURL;
45 interface nsILDAPAutoCompFormatter;
46 interface nsIMutableArray;
47
48 /**
49 * Extends nsIAutoCompleteSession to have various LDAP-specific parameters.
50 * and output format.
51 */
52 [scriptable, uuid(aced5f6f-013d-4e21-97a6-9da3779c8663)]
53 interface nsILDAPAutoCompleteSession : nsIAutoCompleteSession {
54
55 /**
56 * A template used to construct the RFC 1960 LDAP search filter to use
57 * while autocompleting.
58 *
59 * The authoritative documentation for the format in use can be found at
60 * at <http://docs.iplanet.com/docs/manuals/dirsdk/csdk41/html/filter.htm>.
61 * The Linux/OpenLDAP man page for ldapfilter.conf(5) does a pretty decent
62 * job as well, however.
63 *
64 * As of this writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
65 * contractid happens to use a default value of
66 * (|(cn=%v1*%v2-*)(mail=%v1*%v2-*)(sn=%v1*%v2-*))
67 *
68 * @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
69 * @exception NS_ERROR_OUT_OF_MEMORY Getter couldn't allocate string
70 */
71 attribute AUTF8String filterTemplate;
72
73 /**
74 * At most this many nsIAutoCompleteItems will be returned. This
75 * is useful for keeping bandwidth usage over slow-speed
76 * connections as well as ensuring that the number of choices
77 * offered in the UI is manageble.
78 *
79 * 1-65535 are interpreted literally
80 * 0 means "unlimited"
81 * -1 uses the default limit for the LDAP connection in use
82 *
83 * @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
84 * @exception NS_ERROR_ILLEGAL_VALUE Out-of-range value passed to setter
85 */
86 attribute long maxHits;
87
88 /**
89 * Strings shorter than this will return |nsIAutoCompleteStatus::ignored|
90 * rather than triggering a search. This allows browsers to be
91 * configured to not search on substrings so short that they
92 * aren't indexed by the LDAP server (such searches can use
93 * significantly more server resources and return a very large
94 * number of entries). cjkMinStringLength is used for CJK
95 * languages, and minStringLength for everything else. As of this
96 * writing, the "@mozilla.org/autocompleteSession;1?type=ldap"
97 * contractid uses defaults of two and zero, respectively. This
98 * avoids most unindexed searches with at least one widely-deployed
99 * webserver, but allows CJK languages, where a single glyph can be an
100 * an entire name to still get results.
101 *
102 * @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
103 */
104 attribute unsigned long minStringLength;
105 attribute unsigned long cjkMinStringLength;
106
107 /**
108 * LDAP server to complete against, in ldap: URL format.
109 * May change to an nsILDAPServer once that infrastructure lands.
110 *
111 * @exception NS_ERROR_NULL_POINTER NULL pointer passed to getter
112 */
113 attribute nsILDAPURL serverURL;
114
115 /**
116 * Callback used to format an individual LDAP message into an
117 * nsIAutoCompleteItem.
118 */
119 attribute nsILDAPAutoCompFormatter formatter;
120
121 /**
122 * "Login as..." this ID. Currently, this must be specified as a DN.
123 * In the future, we may support userid and/or email address as well.
124 * If unset, bind anonymously.
125 */
126 attribute AUTF8String login;
127
128 /**
129 * What version of the LDAP protocol should be used? Allowed version
130 * number constants are defined in nsILDAPConnection.idl.
131 *
132 * @exception NS_ERROR_ILLEGAL_VALUE illegal version num passed to setter
133 * @exception NS_ERROR_NULL_POINTER null pointer passed to getter
134 */
135 attribute unsigned long version;
136
137 /**
138 * If set, these arrays of nsILDAPControls are passed through to the
139 * nsILDAPOperation that searchExt is called on.
140 */
141 attribute nsIMutableArray searchServerControls;
142 attribute nsIMutableArray searchClientControls;
143 };