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> (original author)
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
42 interface nsILDAPBERValue;
43 interface nsILDAPOperation;
44
45 %{C++
46 #define NS_LDAPMESSAGE_CONTRACTID "@mozilla.org/network/ldap-message;1"
47 %}
48
49 [scriptable, uuid(973ff50f-2002-4f0c-b57d-2242156139a2)]
50 interface nsILDAPMessage : nsISupports
51 {
52 /**
53 * The Distinguished Name of the entry associated with this message.
54 *
55 * @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
56 * @exception NS_ERROR_ILLEGAL_VALUE null pointer passed in
57 * @exception NS_ERROR_LDAP_DECODING_ERROR problem during BER-decoding
58 * @exception NS_ERROR_UNEXPECTED bug or memory corruption
59 */
60 readonly attribute AUTF8String dn;
61
62 /**
63 * Get all the attributes in this message.
64 *
65 * @exception NS_ERROR_OUT_OF_MEMORY
66 * @exception NS_ERROR_ILLEGAL_VALUE null pointer passed in
67 * @exception NS_ERROR_UNEXPECTED bug or memory corruption
68 * @exception NS_ERROR_LDAP_DECODING_ERROR problem during BER decoding
69 *
70 * @return array of all attributes in the current message
71 */
72 void getAttributes(out unsigned long count,
73 [retval, array, size_is(count)] out string aAttributes);
74
75 /**
76 * Get an array of all the attribute values in this message.
77 *
78 * @param attr The attribute whose values are to be returned
79 * @param count Number of values in the outbound array.
80 * @param values Array of values
81 *
82 * @exception NS_ERROR_UNEXPECTED Bug or memory corruption
83 * @exception NS_ERROR_LDAP_DECODING_ERROR Attribute not found or other
84 * decoding error.
85 * @exception NS_ERROR_OUT_OF_MEMORY
86 */
87 void getValues(in string attr, out unsigned long count,
88 [retval, array, size_is(count)] out wstring values);
89
90 /**
91 * The operation this message originated from
92 *
93 * @exception NS_ERROR_NULL_POINTER NULL pointer to getter
94 */
95 readonly attribute nsILDAPOperation operation;
96
97 /**
98 * The result code (aka lderrno) for this message.
99 *
100 * IDL definitions for these constants live in nsILDAPErrors.idl.
101 *
102 * @exception NS_ERROR_ILLEGAL_VALUE null pointer passed in
103 */
104 readonly attribute long errorCode;
105
106 /**
107 * The result type of this message. Possible types listed below, the
108 * values chosen are taken from the draft-ietf-ldapext-ldap-c-api-04.txt
109 * and are the same ones used in the ldap.h include file from the Mozilla
110 * LDAP C SDK.
111 *
112 * @exception NS_ERROR_ILLEGAL_VALUE null pointer passed in
113 * @exception NS_ERROR_UNEXPECTED internal error (possible memory
114 * corruption)
115 */
116 readonly attribute long type;
117
118 /**
119 * Result of a bind operation
120 */
121 const long RES_BIND = 0x61;
122
123 /**
124 * An entry found in an search operation.
125 */
126 const long RES_SEARCH_ENTRY = 0x64;
127
128 /**
129 * An LDAPv3 search reference (a referral to another server)
130 */
131 const long RES_SEARCH_REFERENCE = 0x73;
132
133 /**
134 * The result of a search operation (i.e. the search is done; no more
135 * entries to follow).
136 */
137 const long RES_SEARCH_RESULT = 0x65;
138
139 /**
140 * The result of a modify operation.
141 */
142 const long RES_MODIFY = 0x67;
143
144 /**
145 * The result of an add operation
146 */
147 const long RES_ADD = 0x69;
148
149 /**
150 * The result of a delete operation
151 */
152 const long RES_DELETE = 0x6B;
153
154 /**
155 * The result of an modify DN operation
156 */
157 const long RES_MODDN = 0x6D;
158
159 /**
160 * The result of a compare operation
161 */
162 const long RES_COMPARE = 0x6F;
163
164 /**
165 * The result of an LDAPv3 extended operation
166 */
167 const long RES_EXTENDED = 0x78;
168
169 /**
170 * get an LDIF-like string representation of this message
171 *
172 * @return unicode encoded string representation.
173 */
174 wstring toUnicode();
175
176 /**
177 * Additional error information optionally sent by the server.
178 */
179 readonly attribute AUTF8String errorMessage;
180
181 /**
182 * In LDAPv3, when the server returns any of the following errors:
183 * NO_SUCH_OBJECT, ALIAS_PROBLEM, INVALID_DN_SYNTAX, ALIAS_DEREF_PROBLEM,
184 * it also returns the closest existing DN to the entry requested.
185 */
186 readonly attribute AUTF8String matchedDn;
187
188 /**
189 * Get an array of all the attribute values in this message (a wrapper
190 * around the LDAP C SDK's get_values_len()).
191 *
192 * @param attr The attribute whose values are to be returned
193 * @param count Number of values in the outbound array.
194 * @param values Array of nsILDAPBERValue objects
195 *
196 * @exception NS_ERROR_UNEXPECTED Bug or memory corruption
197 * @exception NS_ERROR_LDAP_DECODING_ERROR Attribute not found or other
198 * decoding error.
199 * @exception NS_ERROR_OUT_OF_MEMORY
200 */
201 void getBinaryValues(in string attr, out unsigned long count,
202 [retval, array, size_is(count)] out nsILDAPBERValue values);
203 };