Exemple #1
0
        /// <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>
        ///     Create an RfcLdapMessage by copying the content array.
        /// </summary>
        /// <param name="origContent">
        ///     the array list to copy.
        /// </param>
        internal RfcLdapMessage(Asn1Object[] origContent, IRfcRequest origRequest, string dn, string filter,
                                bool reference)
            : base(origContent, origContent.Length)
        {
            set_Renamed(0, new RfcMessageId()); // MessageID has static counter

            var req    = (IRfcRequest)origContent[1];
            var newreq = req.DupRequest(dn, filter, reference);

            _op = (Asn1Object)newreq;
            set_Renamed(1, (Asn1Object)newreq);
        }
Exemple #3
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);
        }
Exemple #4
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);
        }
 /// <summary> Create an RfcLdapMessage using the specified Ldap Request.</summary>
 public RfcLdapMessage(IRfcRequest op)
     : this(op, null)
 {
 }