Expand description
Control construction and parsing.
A control can be associated with a request or a response. Several common
controls, such as PagedResults
, are implemented
directly by this library. If an implemented control has the same form for
the request and the response, there will be a single structure for both.
(This is the case for PagedResults
.) If the response control is different,
its name will consist of the request control name with the Resp
suffix.
A request control can be created by instantiating its structure and converting
it to ASN.1 with into()
when passing the instance or constructing the request
control vector in the call to with_controls()
.
A third-party control must implement the conversion from an instance
of itself to RawControl
, a general form of control.
RawControl
, together with an optional instance of ControlType
,
forms the type Control
; a vector of Control
s is part
of the result of all LDAP operation which return one.
The first element of Control
will have a value if the parser recognizes
the control’s OID as one that is implemented by the library itself. Since the
list of implemented controls is expected to grow, the ControlType
enum cannot
be exhaustively matched.
A recognized response control can be parsed by calling
parse()
on the instance of RawControl
representing it. A third-party control must implement the
ControlParser
trait to support this interface.
§Example
With an LdapResult
in res
, iterating through controls and matching the desired ones
could be done like this:
for ctrl in res.ctrls {
match ctrl {
// matching a control implemented by the library
Control(Some(ControlType::PagedResults), ref raw) => {
dbg!(raw.parse::<PagedResults>());
},
// matching a control unknown to the library
// the OID is actually that of PagedResults
Control(None, ref raw) if raw.ctype == "1.2.840.113556.1.4.319" => {
dbg!(raw.parse::<PagedResults>());
},
_ => (),
}
}
Structs§
- Assertion
- Assertion control (RFC 4528).
- Control
- Response control.
- Critical
Control - Wrapper for a control marked as critical.
- Manage
DsaIt - ManageDsaITcontrol (RFC 3296).
- Matched
Values - Matched Values control (RFC 3876)
- Paged
Results - Paged Results control (RFC 2696).
- Post
Read - Post-Read request control (RFC 4527).
- PreRead
- Pre-Read request control (RFC 4527).
- Proxy
Auth - Proxy Authorization control (RFC 4370).
- RawControl
- Generic control.
- Read
Entry Resp - Response for Pre-Read and Post-Read controls.
- Relax
Rules - Relax Rules control (draft specification).
- Sync
Done - Sync Done response control (RFC 4533).
- Sync
Request - Sync Request control (RFC 4533).
- Sync
State - Sync State response control (RFC 4533).
Enums§
- Control
Type - Recognized control types.
- Entry
State - Possible states for the Sync State control.
- Refresh
Mode - Content refresh mode.
- Sync
Info - Values of the Sync Info intermediate message (RFC 4533).
Traits§
- Control
Parser - Conversion trait for response controls.
- Into
RawControl Vec - Make
Critical - Mark a control as critical.
Functions§
- parse_
syncinfo - Parse the Sync Info value from the Search result entry.
Type Aliases§
- Post
Read Resp - Type alias for Post-Read response.
- PreRead
Resp - Type alias for Pre-Read response.