use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class BindResponseProtocolOp method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
final ASN1BufferSequence opSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_BIND_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 (serverSASLCredentials != null) {
buffer.addElement(serverSASLCredentials);
}
opSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class Filter method writeTo.
/**
* Writes an ASN.1-encoded representation of this filter 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) {
switch(filterType) {
case FILTER_TYPE_AND:
case FILTER_TYPE_OR:
final ASN1BufferSet compSet = buffer.beginSet(filterType);
for (final Filter f : filterComps) {
f.writeTo(buffer);
}
compSet.end();
break;
case FILTER_TYPE_NOT:
buffer.addElement(new ASN1Element(filterType, notComp.encode().encode()));
break;
case FILTER_TYPE_EQUALITY:
case FILTER_TYPE_GREATER_OR_EQUAL:
case FILTER_TYPE_LESS_OR_EQUAL:
case FILTER_TYPE_APPROXIMATE_MATCH:
final ASN1BufferSequence avaSequence = buffer.beginSequence(filterType);
buffer.addOctetString(attrName);
buffer.addElement(assertionValue);
avaSequence.end();
break;
case FILTER_TYPE_SUBSTRING:
final ASN1BufferSequence subFilterSequence = buffer.beginSequence(filterType);
buffer.addOctetString(attrName);
final ASN1BufferSequence valueSequence = buffer.beginSequence();
if (subInitial != null) {
buffer.addOctetString(SUBSTRING_TYPE_SUBINITIAL, subInitial.getValue());
}
for (final ASN1OctetString s : subAny) {
buffer.addOctetString(SUBSTRING_TYPE_SUBANY, s.getValue());
}
if (subFinal != null) {
buffer.addOctetString(SUBSTRING_TYPE_SUBFINAL, subFinal.getValue());
}
valueSequence.end();
subFilterSequence.end();
break;
case FILTER_TYPE_PRESENCE:
buffer.addOctetString(filterType, attrName);
break;
case FILTER_TYPE_EXTENSIBLE_MATCH:
final ASN1BufferSequence mrSequence = buffer.beginSequence(filterType);
if (matchingRuleID != null) {
buffer.addOctetString(EXTENSIBLE_TYPE_MATCHING_RULE_ID, matchingRuleID);
}
if (attrName != null) {
buffer.addOctetString(EXTENSIBLE_TYPE_ATTRIBUTE_NAME, attrName);
}
buffer.addOctetString(EXTENSIBLE_TYPE_MATCH_VALUE, assertionValue.getValue());
if (dnAttributes) {
buffer.addBoolean(EXTENSIBLE_TYPE_DN_ATTRIBUTES, true);
}
mrSequence.end();
break;
}
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class ExtendedRequest method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public final void writeTo(@NotNull final ASN1Buffer writer) {
final ASN1BufferSequence requestSequence = writer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_EXTENDED_REQUEST);
writer.addOctetString(TYPE_EXTENDED_REQUEST_OID, oid);
if (value != null) {
writer.addOctetString(TYPE_EXTENDED_REQUEST_VALUE, value.getValue());
}
requestSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class CompareRequest method writeTo.
/**
* {@inheritDoc}
*/
@Override()
public void writeTo(@NotNull final ASN1Buffer buffer) {
final ASN1BufferSequence requestSequence = buffer.beginSequence(LDAPMessage.PROTOCOL_OP_TYPE_COMPARE_REQUEST);
buffer.addOctetString(dn);
final ASN1BufferSequence avaSequence = buffer.beginSequence();
buffer.addOctetString(attributeName);
buffer.addElement(assertionValue);
avaSequence.end();
requestSequence.end();
}
use of com.unboundid.asn1.ASN1BufferSequence in project ldapsdk by pingidentity.
the class Control method writeTo.
/**
* Writes an ASN.1-encoded representation of this control to the provided
* ASN.1 stream writer.
*
* @param writer The ASN.1 stream writer to which the encoded representation
* should be written.
*/
public final void writeTo(@NotNull final ASN1Buffer writer) {
final ASN1BufferSequence controlSequence = writer.beginSequence();
writer.addOctetString(oid);
if (isCritical) {
writer.addBoolean(true);
}
if (value != null) {
writer.addOctetString(value.getValue());
}
controlSequence.end();
}
Aggregations