private static LdapMessage GetResponse(RfcLdapMessage item) { switch (item.Type) { case LdapOperation.SearchResponse: return(new LdapSearchResult(item)); case LdapOperation.SearchResultReference: return(new LdapSearchResultReference(item)); default: return(new LdapResponse(item)); } }
/// <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); }
/// <summary> /// Initializes a new instance of the <see cref="LdapMessage"/> class. /// Creates an Rfc 2251 LdapMessage when the libraries receive a response /// from a command. /// </summary> /// <param name="message">A response message.</param> internal LdapMessage(RfcLdapMessage message) => Message = message;
internal LdapResponse(RfcLdapMessage message) : base(message) { }
/// <summary> /// Initializes a new instance of the <see cref="LdapSearchResultReference"/> class. /// Constructs an LdapSearchResultReference object. /// </summary> /// <param name="message">The LdapMessage with a search reference.</param> internal LdapSearchResultReference(RfcLdapMessage message) : base(message) { }
internal LdapSearchResult(RfcLdapMessage message) : base(message) { }