/// <summary> /// Initializes a new instance of the <see cref="RfcLdapMessage"/> class. /// Create an RfcLdapMessage request from input parameters. /// </summary> /// <param name="op">The op.</param> /// <param name="controls">The controls.</param> public RfcLdapMessage(IRfcRequest op, RfcControls controls) : base(3) { _op = (Asn1Object)op; Add(new RfcMessageID()); // MessageID has static counter Add((Asn1Object)op); if (controls != null) { Add(controls); } }
/// <summary> /// Initializes a new instance of the <see cref="RfcLdapMessage"/> class. /// Create an RfcLdapMessage response from input parameters. /// </summary> /// <param name="op">The op.</param> /// <param name="controls">The controls.</param> public RfcLdapMessage(Asn1Sequence op, RfcControls controls = null) : base(3) { _op = op; Add(new RfcMessageID()); // MessageID has static counter Add(op); if (controls != null) { Add(controls); } }
/// <summary> /// Initializes a new instance of the <see cref="LdapMessage"/> class. /// Creates an LdapMessage when sending a protocol operation and sends /// some optional controls with the message. /// </summary> /// <param name="type">The type.</param> /// <param name="op">The operation type of message.</param> /// <param name="controls">The controls to use with the operation.</param> /// <seealso cref="Type"></seealso> internal LdapMessage(LdapOperation type, IRfcRequest op, LdapControl[] controls) { // Get a unique number for this request message _messageType = type; RfcControls asn1Ctrls = null; if (controls != null) { // Move LdapControls into an RFC 2251 Controls object. asn1Ctrls = new RfcControls(); foreach (var t in controls) { asn1Ctrls.Add(t.Asn1Object); } } // create RFC 2251 LdapMessage Message = new RfcLdapMessage(op, asn1Ctrls); }