コード例 #1
0
        /// <summary>
        /// Overrode method from System.Object.
        /// </summary>
        /// <param name="obj">The object to be compared.</param>
        /// <returns>True if obj has same data with this instance. False if not.</returns>
        public override bool Equals(object obj)
        {
            // If parameter is null or cannot be cast to Asn1Choice return false.
            Asn1Choice p = obj as Asn1Choice;

            if (p == null)
            {
                return(false);
            }

            // Return true if the fields match.
            return(GetData().Equals(p.GetData()));
        }
コード例 #2
0
        /// <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;
        }
コード例 #3
0
 /// <summary>
 /// Creates a SearchRequest packet.
 /// </summary>
 /// <param name="dn">The DN to be searched.</param>
 /// <param name="sizeLimit">Size limit for search response.</param>
 /// <param name="timeLimit">
 /// Time limit of search, in seconds, before DC returns an timeLimitExceeded error.
 /// </param>
 /// <param name="scope">Search scope. Base, single level, or subtree.</param>
 /// <param name="dereferenceAliases">Dereference alias 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 response.</returns>
 public virtual AdtsSearchRequestPacket CreateSearchRequest(
     string dn,
     long sizeLimit,
     long timeLimit,
     SearchScope scope,
     DereferenceAlias dereferenceAliases,
     Asn1Choice filter,
     bool typesOnly,
     params string[] attributes)
 {
     return this.encoder.CreateSearchRequest(
         this.context,
         dn,
         sizeLimit,
         timeLimit,
         scope,
         dereferenceAliases,
         filter,
         typesOnly,
         attributes);
 }
コード例 #4
0
 /// <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 abstract AdtsSearchRequestPacket CreateSearchRequest(
     AdtsLdapContext context,
     string dn,
     long sizeLimit,
     long timeLimit,
     SearchScope scope,
     DereferenceAlias dereferenceAliases,
     Asn1Choice filter,
     bool typesOnly,
     params string[] attributes);