コード例 #1
0
        /// <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 = null)
        {
            // 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);
        }
コード例 #2
0
        /// <summary>
        ///     Creates an LdapMessage when sending a protocol operation and sends
        ///     some optional controls with the message.
        /// </summary>
        /// <param name="op">
        ///     The operation type of message.
        /// </param>
        /// <param name="controls">
        ///     The controls to use with the operation.
        /// </param>
        /// <seealso cref="Type">
        /// </seealso>
        /*package*/
        internal LdapMessage(int 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();
                for (var i = 0; i < controls.Length; i++)
                {
                    // asn1Ctrls.add(null);
                    asn1Ctrls.Add(controls[i].Asn1Object);
                }
            }

            // create RFC 2251 LdapMessage
            Message = new RfcLdapMessage(op, asn1Ctrls);
        }