зеркало из https://github.com/mozilla/pjs.git
156 строки
5.5 KiB
Plaintext
156 строки
5.5 KiB
Plaintext
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
*
|
|
* ***** BEGIN LICENSE BLOCK *****
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
*
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
* the License. You may obtain a copy of the License at
|
|
* http://www.mozilla.org/MPL/
|
|
*
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
* for the specific language governing rights and limitations under the
|
|
* License.
|
|
*
|
|
* The Original Code is the mozilla.org LDAP XPCOM SDK.
|
|
*
|
|
* The Initial Developer of the Original Code is
|
|
* Oracle Corporation.
|
|
* Portions created by the Initial Developer are Copyright (C) 2005
|
|
* the Initial Developer. All Rights Reserved.
|
|
*
|
|
* Contributor(s):
|
|
* Dan Mosedale <dan.mosedale@oracle.com> (Original Author)
|
|
*
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
* the provisions above, a recipient may use your version of this file under
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
*
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
#include "nsISupports.idl"
|
|
|
|
interface nsILDAPBERValue;
|
|
|
|
|
|
/**
|
|
* nsILDAPBERElement is a wrapper interface for a C-SDK BerElement object.
|
|
* Typically, this is used as an intermediate object to aid in the manual
|
|
* construction of a BER value. Once the construction is completed by calling
|
|
* methods on this object, an nsILDAPBERValue can be retrieved from the
|
|
* asValue attribute on this interface.
|
|
*
|
|
* <http://www.mozilla.org/directory/ietf-docs/draft-ietf-ldapext-ldap-c-api-05.txt>
|
|
* contains some documentation that mostly (but not exactly) matches
|
|
* the code that this wraps in section 17.
|
|
*/
|
|
|
|
[scriptable, uuid(409f5b31-c062-4d11-a35b-0a09e7967bf2)]
|
|
interface nsILDAPBERElement : nsISupports
|
|
{
|
|
/**
|
|
* Initialize this object. Must be called before calling any other method
|
|
* on this interface.
|
|
*
|
|
* @param aValue value to preinitialize with; 0 for a new empty object
|
|
*
|
|
* @exception NS_ERROR_NOT_IMPLEMENTED preinitialization is currently
|
|
* not implemented
|
|
* @exception NS_ERROR_OUT_OF_MEMORY unable to allocate the internal
|
|
* BerElement
|
|
*/
|
|
void init(in nsILDAPBERValue aValue);
|
|
|
|
/**
|
|
* Most TAG_* constants can be used in the construction or passing in of
|
|
* values to the aTag arguments to most of the methods in this interface.
|
|
*/
|
|
|
|
/**
|
|
* When returned from a parsing method, 0xffffffff is referred to
|
|
* has the parse-error semantic (ie TAG_LBER_ERROR); when passing it to
|
|
* a construction method, it is used to mean "pick the default tag for
|
|
* this type" (ie TAG_LBER_DEFAULT).
|
|
*/
|
|
const unsigned long TAG_LBER_ERROR = 0xffffffff;
|
|
const unsigned long TAG_LBER_DEFAULT = 0xffffffff;
|
|
const unsigned long TAG_LBER_END_OF_SEQORSET = 0xfffffffe;
|
|
|
|
/**
|
|
* BER encoding types and masks
|
|
*/
|
|
const unsigned long TAG_LBER_PRIMITIVE = 0x00;
|
|
|
|
/**
|
|
* The following two tags are carried over from the LDAP C SDK; their
|
|
* exact purpose there is not well documented. They both have
|
|
* the same value there as well.
|
|
*/
|
|
const unsigned long TAG_LBER_CONSTRUCTED = 0x20;
|
|
const unsigned long TAG_LBER_ENCODING_MASK = 0x20;
|
|
|
|
const unsigned long TAG_LBER_BIG_TAG_MASK = 0x1f;
|
|
const unsigned long TAG_LBER_MORE_TAG_MASK = 0x80;
|
|
|
|
/**
|
|
* general BER types we know about
|
|
*/
|
|
const unsigned long TAG_LBER_BOOLEAN = 0x01;
|
|
const unsigned long TAG_LBER_INTEGER = 0x02;
|
|
const unsigned long TAG_LBER_BITSTRING = 0x03;
|
|
const unsigned long TAG_LBER_OCTETSTRING = 0x04;
|
|
const unsigned long TAG_LBER_NULL = 0x05;
|
|
const unsigned long TAG_LBER_ENUMERATED = 0x0a;
|
|
const unsigned long TAG_LBER_SEQUENCE = 0x30;
|
|
const unsigned long TAG_LBER_SET = 0x31;
|
|
|
|
/**
|
|
* Write a string to this element.
|
|
*
|
|
* @param aString string to write
|
|
* @param aTag tag for this string (if TAG_LBER_DEFAULT is used,
|
|
* TAG_LBER_OCTETSTRING will be written).
|
|
*
|
|
* @return number of bytes written
|
|
*
|
|
* @exception NS_ERROR_FAILUE C-SDK returned error
|
|
*/
|
|
unsigned long putString(in AUTF8String aString, in unsigned long aTag);
|
|
|
|
/**
|
|
* Start a set. Sets may be nested.
|
|
*
|
|
* @param aTag tag for this set (if TAG_LBER_DEFAULT is used,
|
|
* TAG_LBER_SET will be written).
|
|
*
|
|
* @exception NS_ERROR_FAILUE C-SDK returned an error
|
|
*/
|
|
void startSet(in unsigned long aTag);
|
|
|
|
/**
|
|
* Cause the entire set started by the last startSet() call to be written.
|
|
*
|
|
* @exception NS_ERROR_FAILUE C-SDK returned an error
|
|
*
|
|
* @return number of bytes written
|
|
*/
|
|
unsigned long putSet();
|
|
|
|
/**
|
|
* an nsILDAPBERValue version of this element. Calls ber_flatten() under
|
|
* the hood.
|
|
*
|
|
* @exception NS_ERROR_OUT_OF_MEMORY
|
|
*/
|
|
readonly attribute nsILDAPBERValue asValue;
|
|
};
|