use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class ExtendedResponseProtocolOp method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_EXTENDED_RESPONSE);
buffer.addEnumerated(resultCode);
buffer.addOctetString(matchedDN);
buffer.addOctetString(diagnosticMessage);
if (!referralURLs.isEmpty()) {
final ASN1BufferSequence refSequence = buffer.beginSequence(GenericResponseProtocolOp.TYPE_REFERRALS);
for (final String s : referralURLs) {
buffer.addOctetString(s);
}
refSequence.end();
}
if (responseOID != null) {
buffer.addOctetString(TYPE_RESPONSE_OID, responseOID);
}
if (responseValue != null) {
buffer.addOctetString(TYPE_RESPONSE_VALUE, responseValue.getValue());
}
opSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class LDAPMessage method writeTo.
/**
* Writes an encoded representation of this LDAP message to the provided ASN.1
* buffer.
*
* @param buffer The ASN.1 buffer to which the encoded representation should
* be written.
*/
public void writeTo(@NotNull final ASN1Buffer buffer) {
final ASN1BufferSequence messageSequence = buffer.beginSequence();
buffer.addInteger(messageID);
protocolOp.writeTo(buffer);
if (!controls.isEmpty()) {
final ASN1BufferSequence controlsSequence = buffer.beginSequence(MESSAGE_TYPE_CONTROLS);
for (final Control c : controls) {
c.writeTo(buffer);
}
controlsSequence.end();
}
messageSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class ModifyRequestProtocolOp method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public void writeTo(@NotNull final ASN1Buffer writer) {
final ASN1BufferSequence opSequence = writer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_MODIFY_REQUEST);
writer.addOctetString(dn);
final ASN1BufferSequence modSequence = writer.beginSequence();
for (final Modification m : modifications) {
m.writeTo(writer);
}
modSequence.end();
opSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class AddRequest method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
final ASN1BufferSequence requestSequence = 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();
requestSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class BindRequestProtocolOp method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_BIND_REQUEST);
buffer.addInteger(version);
buffer.addOctetString(bindDN);
if (credentialsType == CRED_TYPE_SIMPLE) {
buffer.addElement(simplePassword);
} else {
final ASN1BufferSequence saslSequence = buffer.beginSequence(CRED_TYPE_SASL);
buffer.addOctetString(saslMechanism);
if (saslCredentials != null) {
buffer.addElement(saslCredentials);
}
saslSequence.end();
}
opSequence.end();
buffer.setZeroBufferOnClear();
}
Aggregations