com.novell.ldap.rfc2251.RfcExtendedResponse Maven / Gradle / Ivy
/* **************************************************************************
* $OpenLDAP: pkg/jldap/com/novell/ldap/rfc2251/RfcExtendedResponse.java,v 1.18 2004/01/27 08:50:34 sunilk Exp $
*
* Copyright (C) 1999, 2000, 2001 Novell, Inc. All Rights Reserved.
*
* THIS WORK IS SUBJECT TO U.S. AND INTERNATIONAL COPYRIGHT LAWS AND
* TREATIES. USE, MODIFICATION, AND REDISTRIBUTION OF THIS WORK IS SUBJECT
* TO VERSION 2.0.1 OF THE OPENLDAP PUBLIC LICENSE, A COPY OF WHICH IS
* AVAILABLE AT HTTP://WWW.OPENLDAP.ORG/LICENSE.HTML OR IN THE FILE "LICENSE"
* IN THE TOP-LEVEL DIRECTORY OF THE DISTRIBUTION. ANY USE OR EXPLOITATION
* OF THIS WORK OTHER THAN AS AUTHORIZED IN VERSION 2.0.1 OF THE OPENLDAP
* PUBLIC LICENSE, OR OTHER PRIOR WRITTEN CONSENT FROM NOVELL, COULD SUBJECT
* THE PERPETRATOR TO CRIMINAL AND CIVIL LIABILITY.
******************************************************************************/
package com.novell.ldap.rfc2251;
import java.io.IOException;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import com.novell.ldap.*;
import com.novell.ldap.asn1.*;
/**
* Represents an LDAP Extended Response.
*
*
* ExtendedResponse ::= [APPLICATION 24] SEQUENCE {
* COMPONENTS OF LDAPResult,
* responseName [10] LDAPOID OPTIONAL,
* response [11] OCTET STRING OPTIONAL }
*
*/
public class RfcExtendedResponse extends ASN1Sequence implements RfcResponse {
/**
* Context-specific TAG for optional responseName.
*/
public final static int RESPONSE_NAME = 10;
/**
* Context-specific TAG for optional response.
*/
public final static int RESPONSE = 11;
private int referralIndex;
private int responseNameIndex;
private int responseIndex;
//*************************************************************************
// Constructors for ExtendedResponse
//*************************************************************************
/**
* Creates the RFC Extended Response Object passing the individual parameters.
*
* @param resultCode The result code as defined in LDAPException.
*
* @param matchedDN The name of the lowest entry that was matched
* for some error result codes, an empty string
* or null
if none.
*
* @param errorMessage A diagnostic message returned by the server,
* an empty string or null
if none.
*
* @param referral The referral URLs returned for a REFERRAL result
* code or null
if none.
*
* @param responseName The LDAPOID for this extended operation
*
* @param response Any Response returned by the server
*/
public RfcExtendedResponse(ASN1Enumerated resultCode, RfcLDAPDN matchedDN,
RfcLDAPString errorMessage, RfcReferral referral,RfcLDAPOID responseName ,ASN1OctetString response)
{
super(6);
add(resultCode);
add(matchedDN);
add(errorMessage);
int counter = 3;
if(referral != null)
{
add(referral);
referralIndex = counter++;
}
if (responseName != null)
{
responseNameIndex = counter++;
add(responseName);
}
if (response != null)
{
add(response);
responseIndex = counter++;
}
return;
}
/**
* The only time a client will create a ExtendedResponse is when it is
* decoding it from an InputStream
*/
public RfcExtendedResponse(ASN1Decoder dec, InputStream in, int len)
throws IOException
{
super(dec, in, len);
// decode optional tagged elements
if(size() > 3) {
for(int i=3; i
© 2015 - 2025 Weber Informatics LLC | Privacy Policy