Search in sources :

Example 16 with ASN1BufferSequence

use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.

the class ExtendedRequestProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_EXTENDED_REQUEST);
    buffer.addOctetString(TYPE_OID, oid);
    if (value != null) {
        buffer.addOctetString(TYPE_VALUE, value.getValue());
    }
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence)

Example 17 with ASN1BufferSequence

use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.

the class GenericResponseProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public final void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(type);
    buffer.addEnumerated(resultCode);
    buffer.addOctetString(matchedDN);
    buffer.addOctetString(diagnosticMessage);
    if (!referralURLs.isEmpty()) {
        final ASN1BufferSequence refSequence = buffer.beginSequence(TYPE_REFERRALS);
        for (final String s : referralURLs) {
            buffer.addOctetString(s);
        }
        refSequence.end();
    }
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence)

Example 18 with ASN1BufferSequence

use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.

the class IntermediateResponseProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_INTERMEDIATE_RESPONSE);
    if (oid != null) {
        buffer.addOctetString(TYPE_OID, oid);
    }
    if (value != null) {
        buffer.addElement(value);
    }
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence)

Example 19 with ASN1BufferSequence

use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.

the class AddRequestProtocolOp method writeTo.

/**
 * {@inheritDoc}
 */
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
    final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_ADD_REQUEST);
    buffer.addOctetString(dn);
    final ASN1BufferSequence attrSequence = buffer.beginSequence();
    for (final Attribute a : attributes) {
        a.writeTo(buffer);
    }
    attrSequence.end();
    opSequence.end();
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence) Attribute(com.unboundid.ldap.sdk.Attribute)

Example 20 with ASN1BufferSequence

use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.

the class BindResultTestCase method testReadBindResultFromTooShort.

/**
 * Tests the {@code readBindResultFrom} method with an element containing
 * a response sequence that is too short.
 *
 * @throws  Exception  If an unexpected problem occurs.
 */
@Test(expectedExceptions = { LDAPException.class })
public void testReadBindResultFromTooShort() throws Exception {
    ASN1Buffer b = new ASN1Buffer();
    ASN1BufferSequence msgSequence = b.beginSequence();
    b.addInteger(1);
    ASN1BufferSequence opSequence = b.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_BIND_RESPONSE);
    b.addEnumerated(0);
    opSequence.end();
    msgSequence.end();
    ByteArrayInputStream inputStream = new ByteArrayInputStream(b.toByteArray());
    ASN1StreamReader reader = new ASN1StreamReader(inputStream);
    LDAPMessage.readLDAPResponseFrom(reader, true);
}
Also used : ASN1BufferSequence(com.unboundid.asn1.ASN1BufferSequence) ByteArrayInputStream(java.io.ByteArrayInputStream) ASN1Buffer(com.unboundid.asn1.ASN1Buffer) ASN1StreamReader(com.unboundid.asn1.ASN1StreamReader) Test(org.testng.annotations.Test)

Aggregations

ASN1BufferSequence (com.unboundid.asn1.ASN1BufferSequence)47 ASN1Buffer (com.unboundid.asn1.ASN1Buffer)22 ASN1StreamReader (com.unboundid.asn1.ASN1StreamReader)22 ByteArrayInputStream (java.io.ByteArrayInputStream)22 Test (org.testng.annotations.Test)22 ASN1OctetString (com.unboundid.asn1.ASN1OctetString)9 ASN1BufferSet (com.unboundid.asn1.ASN1BufferSet)3 Attribute (com.unboundid.ldap.sdk.Attribute)2 ASN1Element (com.unboundid.asn1.ASN1Element)1 Control (com.unboundid.ldap.sdk.Control)1 Modification (com.unboundid.ldap.sdk.Modification)1 JSONObjectFilter (com.unboundid.ldap.sdk.unboundidds.jsonfilter.JSONObjectFilter)1