RaspberryIO/Unosquare.Swan/Networking/Ldap/RfcModifyRequest.cs
2019-12-03 18:44:25 +01:00

42 lines
1.3 KiB
C#

using System;
using System.IO;
namespace Unosquare.Swan.Networking.Ldap {
/// <summary>
/// Represents an Ldap Modify Request.
/// <pre>
/// ModifyRequest ::= [APPLICATION 6] SEQUENCE {
/// object LdapDN,
/// modification SEQUENCE OF SEQUENCE {
/// operation ENUMERATED {
/// add (0),
/// delete (1),
/// replace (2) },
/// modification AttributeTypeAndValues } }
/// </pre>
/// </summary>
/// <seealso cref="Unosquare.Swan.Networking.Ldap.Asn1Sequence" />
/// <seealso cref="Unosquare.Swan.Networking.Ldap.IRfcRequest" />
internal sealed class RfcModifyRequest
: Asn1Sequence, IRfcRequest {
public RfcModifyRequest(String obj, Asn1SequenceOf modification)
: base(2) {
this.Add(obj);
this.Add(modification);
}
public Asn1SequenceOf Modifications => (Asn1SequenceOf)this.Get(1);
public override Asn1Identifier GetIdentifier() => new Asn1Identifier(LdapOperation.ModifyRequest);
public String GetRequestDN() => ((Asn1OctetString)this.Get(0)).StringValue();
}
internal class RfcModifyResponse : RfcLdapResult {
public RfcModifyResponse(Stream stream, Int32 len)
: base(stream, len) {
}
public override Asn1Identifier GetIdentifier() => new Asn1Identifier(LdapOperation.ModifyResponse);
}
}