1+ //! Ancillary data (control message) support for connected streams.
2+ //!
3+ //! Ancillary messages are used to pass out-of-band information such as file
4+ //! descriptors (Unix domain sockets), credentials, or kTLS record types.
5+ //!
6+ //! # Types
7+ //!
8+ //! - [`AncillaryRef`]: A reference to a single ancillary data entry.
9+ //! - [`AncillaryIter`]: An iterator over a buffer of ancillary messages.
10+ //! - [`AncillaryBuilder`]: A builder for constructing ancillary messages into a
11+ //! caller-supplied send buffer.
12+
113use std:: { marker:: PhantomData , mem:: MaybeUninit } ;
214
315cfg_if:: cfg_if! {
@@ -10,10 +22,10 @@ cfg_if::cfg_if! {
1022 }
1123}
1224
13- /// Reference to a control message.
14- pub struct CMsgRef < ' a > ( sys:: CMsgRef < ' a > ) ;
25+ /// Reference to an ancillary ( control) message.
26+ pub struct AncillaryRef < ' a > ( sys:: CMsgRef < ' a > ) ;
1527
16- impl CMsgRef < ' _ > {
28+ impl AncillaryRef < ' _ > {
1729 /// Returns the level of the control message.
1830 pub fn level ( & self ) -> i32 {
1931 self . 0 . level ( )
@@ -41,14 +53,14 @@ impl CMsgRef<'_> {
4153 }
4254}
4355
44- /// An iterator for control messages.
45- pub struct CMsgIter < ' a > {
56+ /// An iterator for ancillary ( control) messages.
57+ pub struct AncillaryIter < ' a > {
4658 inner : sys:: CMsgIter ,
4759 _p : PhantomData < & ' a ( ) > ,
4860}
4961
50- impl < ' a > CMsgIter < ' a > {
51- /// Create [`CMsgIter `] with the given buffer.
62+ impl < ' a > AncillaryIter < ' a > {
63+ /// Create [`AncillaryIter `] with the given buffer.
5264 ///
5365 /// # Panics
5466 ///
@@ -66,28 +78,28 @@ impl<'a> CMsgIter<'a> {
6678 }
6779}
6880
69- impl < ' a > Iterator for CMsgIter < ' a > {
70- type Item = CMsgRef < ' a > ;
81+ impl < ' a > Iterator for AncillaryIter < ' a > {
82+ type Item = AncillaryRef < ' a > ;
7183
7284 fn next ( & mut self ) -> Option < Self :: Item > {
7385 unsafe {
7486 let cmsg = self . inner . current ( ) ;
7587 self . inner . next ( ) ;
76- cmsg. map ( CMsgRef )
88+ cmsg. map ( AncillaryRef )
7789 }
7890 }
7991}
8092
81- /// Helper to construct control message .
82- pub struct CMsgBuilder < ' a > {
93+ /// Helper to construct ancillary ( control) messages .
94+ pub struct AncillaryBuilder < ' a > {
8395 inner : sys:: CMsgIter ,
8496 len : usize ,
8597 _p : PhantomData < & ' a mut ( ) > ,
8698}
8799
88- impl < ' a > CMsgBuilder < ' a > {
89- /// Create [`CMsgBuilder `] with the given buffer. The buffer will be zeroed
90- /// on creation.
100+ impl < ' a > AncillaryBuilder < ' a > {
101+ /// Create [`AncillaryBuilder `] with the given buffer. The buffer will be
102+ /// zeroed on creation.
91103 ///
92104 /// # Panics
93105 ///
0 commit comments