public AddRequest_attrs_element(
     AttributeType type,
     Asn1SetOf<AttributeValue> values)
 {
     this.type = type;
     this.values = values;
 }
 public ModifyRequest_modifications_element_modification(
     AttributeType type,
     Asn1SetOf<AttributeValue> values)
 {
     this.type = type;
     this.values = values;
 }
 public SearchResponse_entry_attributes_element(
     AttributeType type,
     Asn1SetOf<AttributeValue> values)
 {
     this.type = type;
     this.values = values;
 }
 public SubstringFilter(
     AttributeType type,
     Asn1SequenceOf<SubstringFilter_substrings_element> substrings)
 {
     this.type = type;
     this.substrings = substrings;
 }
 public AttributeValueAssertion(
     AttributeType attributeType,
     AttributeValue attributeValue)
 {
     this.attributeType = attributeType;
     this.attributeValue = attributeValue;
 }
        /// <summary>
        /// Creates a SearchRequest packet.
        /// </summary>
        /// <param name="context">The user context which contains message ID.</param>
        /// <param name="dn">The DN to be searched.</param>
        /// <param name="sizeLimit">Size limit.</param>
        /// <param name="timeLimit">Time limit, in seconds.</param>
        /// <param name="scope">Search scope. Base, single level, or subtree.</param>
        /// <param name="dereferenceAliases">Dereference aliase options.</param>
        /// <param name="filter">Search filter.</param>
        /// <param name="typesOnly">
        /// Specifies whether the search returns only the attribute names without the attribute values.
        /// </param>
        /// <param name="attributes">The attributes to be retrieved.</param>
        /// <returns>The packet that contains the request.</returns>
        internal override AdtsSearchRequestPacket CreateSearchRequest(
            AdtsLdapContext context,
            string dn,
            long sizeLimit,
            long timeLimit,
            MsLdap.SearchScope scope,
            MsLdap.DereferenceAlias dereferenceAliases,
            Asn1Choice filter,
            bool typesOnly,
            params string[] attributes)
        {
            int length = (attributes != null) ? attributes.Length : 0;

            AttributeType[] attributeTypeArray = new AttributeType[length];
            for (int i = 0; i < length; i++)
            {
                attributeTypeArray[i] = new AttributeType(attributes[i]);
            }
            Asn1SequenceOf<AttributeType> attributeList = new Asn1SequenceOf<AttributeType>(attributeTypeArray);

            SearchRequest searchRequest = new SearchRequest(
                new LDAPDN(dn ?? string.Empty),
                new SearchRequest_scope((long)scope),
                new SearchRequest_derefAliases((long)dereferenceAliases),
                new Asn1Integer(sizeLimit),
                new Asn1Integer(timeLimit),
                new Asn1Boolean(typesOnly),
                (Filter)filter,
                attributeList);

            LDAPMessage_protocolOp operation = new LDAPMessage_protocolOp();
            operation.SetData(LDAPMessage_protocolOp.searchRequest, searchRequest);

            LDAPMessage message = new LDAPMessage(new MessageID(context.MessageId), operation);
            AdtsSearchRequestPacket packet = new AdtsSearchRequestPacket();
            packet.ldapMessagev2 = message;
            packet.messageId = context.MessageId;

            return packet;
        }