public SearchRequest( LDAPDN baseObject, SearchRequest_scope scope, SearchRequest_derefAliases derefAliases, Asn1Integer sizeLimit, Asn1Integer timeLimit, Asn1Boolean typesOnly, Filter filter, AttributeDescriptionList attributes) { this.baseObject = baseObject; this.scope = scope; this.derefAliases = derefAliases; this.sizeLimit = sizeLimit; this.timeLimit = timeLimit; this.typesOnly = typesOnly; this.filter = filter; this.attributes = attributes; }
/// <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; AttributeDescription[] attributeDescriptionArray = new AttributeDescription[length]; for (int i = 0; i < length; i++) { attributeDescriptionArray[i] = new AttributeDescription(attributes[i]); } AttributeDescriptionList attributeList = new AttributeDescriptionList(attributeDescriptionArray); 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, null); AdtsSearchRequestPacket packet = new AdtsSearchRequestPacket(); packet.ldapMessagev3 = message; packet.messageId = context.MessageId; return(packet); }
/// <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; AttributeDescription[] attributeDescriptionArray = new AttributeDescription[length]; for (int i = 0; i < length; i++) { attributeDescriptionArray[i] = new AttributeDescription(attributes[i]); } AttributeDescriptionList attributeList = new AttributeDescriptionList(attributeDescriptionArray); 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, null); AdtsSearchRequestPacket packet = new AdtsSearchRequestPacket(); packet.ldapMessagev3 = message; packet.messageId = context.MessageId; return packet; }