@@ -91,6 +91,7 @@ pub const MAGIC_COOKIE: u32 = 0x2112A442;
91
91
/// message.
92
92
pub const BINDING : u16 = 0x0001 ;
93
93
94
+ /// Possible errors when parsing a STUN message.
94
95
#[ derive( Debug , thiserror:: Error ) ]
95
96
pub enum StunParseError {
96
97
/// Not a STUN message.
@@ -263,7 +264,9 @@ impl ShortTermCredentials {
263
264
#[ derive( Debug , Clone , PartialEq , Eq ) ]
264
265
#[ cfg_attr( feature = "arbitrary" , derive( arbitrary:: Arbitrary ) ) ]
265
266
pub enum MessageIntegrityCredentials {
267
+ /// Short term integrity credentials.
266
268
ShortTerm ( ShortTermCredentials ) ,
269
+ /// Long term integrity credentials.
267
270
LongTerm ( LongTermCredentials ) ,
268
271
}
269
272
@@ -311,9 +314,13 @@ impl MessageIntegrityCredentials {
311
314
/// - [Error][`MessageClass::Error`] class indicates that an error was produced.
312
315
#[ derive( Copy , Clone , Debug , PartialEq , Eq ) ]
313
316
pub enum MessageClass {
317
+ /// A request that is expecting a response of either Success, or Error.
314
318
Request ,
319
+ /// A request that does not expect a response.
315
320
Indication ,
321
+ /// A success response to a previous Request.
316
322
Success ,
323
+ /// An error response to a previous Request.
317
324
Error ,
318
325
}
319
326
@@ -614,7 +621,9 @@ impl<'a> std::fmt::Display for Message<'a> {
614
621
/// The supported hashing algorithms for ensuring integrity of a [`Message`]
615
622
#[ derive( Clone , Copy , Debug , PartialEq , Eq ) ]
616
623
pub enum IntegrityAlgorithm {
624
+ /// SHA-1 algorithm
617
625
Sha1 ,
626
+ /// SHA-256 algorithm
618
627
Sha256 ,
619
628
}
620
629
@@ -1475,6 +1484,8 @@ impl<'a> MessageBuilder<'a> {
1475
1484
ret
1476
1485
}
1477
1486
1487
+ /// Write this builder into the provided destination buffer returning the length in bytes that
1488
+ /// has been written, or an error.
1478
1489
#[ tracing:: instrument(
1479
1490
name = "message_build" ,
1480
1491
level = "trace" ,
@@ -1503,6 +1514,8 @@ impl<'a> MessageBuilder<'a> {
1503
1514
Ok ( offset)
1504
1515
}
1505
1516
1517
+ /// The length in bytes this [`MessageBuilder`] would require to successfully construct
1518
+ /// a message.
1506
1519
pub fn byte_len ( & self ) -> usize {
1507
1520
MessageHeader :: LENGTH
1508
1521
+ self
0 commit comments