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 control (RFC 4528).
- Response control.
- Wrapper for a control marked as critical.
- ManageDsaITcontrol (RFC 3296).
- Matched Values control (RFC 3876)
- Paged Results control (RFC 2696).
- Post-Read request control (RFC 4527).
- Pre-Read request control (RFC 4527).
- Proxy Authorization control (RFC 4370).
- Generic control.
- Response for Pre-Read and Post-Read controls.
- Relax Rules control (draft specification).
- Sync Done response control (RFC 4533).
- Sync Request control (RFC 4533).
- Sync State response control (RFC 4533).
Enums
- Recognized control types.
- Possible states for the Sync State control.
- Content refresh mode.
- Values of the Sync Info intermediate message (RFC 4533).
Traits
- Conversion trait for response controls.
- Mark a control as critical.
Functions
- Parse the Sync Info value from the Search result entry.
Type Definitions
- Type alias for Post-Read response.
- Type alias for Pre-Read response.