protected virtual void ReadResponse(LdapStreamReader reader, ProtocolOperation protocol) { if (reader.NextElementIs(0x30)) { int messageLength = reader.ReadElementLength(); MessageId = reader.ReadIntElement(); if (reader.NextElementIs((int)protocol)) { int contentLength = reader.ReadElementLength(); ReadResponseBody(reader); } } }
public override ICollection <byte> Serialize() { var content = new List <byte>(); content.AddRange(MessageId.Serialize()); content.AddRange(ProtocolOperation.Serialize()); if (Controls != null && Controls.Values.Any()) { content.AddRange(Controls.Serialize(0xa0)); } Length = content.Count(); var result = new List <byte>(); result.AddRange(SerializeDerStructure(true)); result.AddRange(content); return(result); }
protected override void ReadResponse(LdapStreamReader reader, ProtocolOperation protocol) { Results = new List <SearchResult> (); while (true) { if (reader.NextElementIs(0x30)) { int messageLength = reader.ReadElementLength(); MessageId = reader.ReadIntElement(); int operation = reader.ReadByte(); if (operation == (int)ProtocolOperation.SearchResultEntry) { Results.Add(new SearchResult(reader)); } else if (operation == (int)ProtocolOperation.SearchResultDone) { int contentLength = reader.ReadElementLength(); ReadResponseBody(reader); break; } } } }
public LdapRequest(int messageId, ProtocolOperation protocol) { MessageId = messageId; Protocol = protocol; }