Skip to content

Commit 6964a83

Browse files
committed
fix: imports in docs
1 parent c051a57 commit 6964a83

6 files changed

Lines changed: 20 additions & 16 deletions

File tree

src/control_client/mod.rs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,18 @@ use tokio::net::TcpStream;
1717
use tokio::sync::oneshot;
1818
use tracing::*;
1919

20-
/// Control-Client is responsible for initiating and handling TWAMP-Control with a Server.
20+
/// Control-Client is responsible for initiating and handling TWAMP-Control with a
21+
/// [Server](crate::server::Server).
2122
///
22-
/// Responsibilites of Control-Client on TWAMP-Control are:
23+
/// Responsibilites of Control-Client on TWAMP-Control, in sequence, are:
2324
/// - [Read Server Greeting](Self::read_server_greeting)
2425
/// - [Send Set-Up-Response](Self::send_set_up_response)
2526
/// - [Read Server-Start](Self::read_server_start)
2627
/// - [Send Request-TW-Session](Self::send_request_tw_session)
28+
/// - [Read Accept-Session](Self::read_accept_session)
29+
/// - [Send Start-Sessions](Self::send_start_sessions)
30+
/// - [Read Start-Ack](Self::read_start_ack)
31+
/// - [Send Stop-Sessions](Self::send_stop_sessions)
2732
#[derive(Debug)]
2833
pub struct ControlClient {
2934
/// TCP stream on which TWAMP-Control is being used.
@@ -34,7 +39,7 @@ impl ControlClient {
3439
pub fn new() -> Self {
3540
Self { stream: None }
3641
}
37-
/// Initiates TCP connection and starts the [TWAMP-Control](twamp_control) protocol with
42+
/// Initiates TCP connection and starts the [TWAMP-Control](crate::twamp_control) protocol with
3843
/// Server, handling communication until the test ends or connection is killed/stopped.
3944
pub async fn do_twamp_control(
4045
&mut self,
@@ -75,13 +80,12 @@ impl ControlClient {
7580
Ok(())
7681
}
7782

78-
/// Reads from TWAMP-Control stream assuming the bytes to be received will be of a
79-
/// `ServerGreeting`. Converts those bytes into a `ServerGreeting` struct and returns it.
83+
/// Reads [`ServerGreeting`] from TWAMP-Control stream.
8084
pub async fn read_server_greeting(&mut self) -> Result<ServerGreeting> {
8185
let mut buf = [0; size_of::<ServerGreeting>()];
8286
info!("Reading ServerGreeting");
8387
self.stream.as_mut().unwrap().read_exact(&mut buf).await?;
84-
let (_rest, server_greeting) = ServerGreeting::from_bytes((&buf, 0)).unwrap();
88+
let (_rest, server_greeting) = ServerGreeting::from_bytes((&buf, 0)).expect("should have received valid ServerGreeting");
8589
debug!("Server greeting: {:?}", server_greeting);
8690
info!("Done reading ServerGreeting");
8791
Ok(server_greeting)

src/server/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use tokio::net::TcpStream;
1616
use tokio::sync::oneshot;
1717
use tracing::*;
1818

19-
/// Server is responsible for handling incoming [TWAMP-Control](twamp_control) connection from a
19+
/// Server is responsible for handling incoming [TWAMP-Control](crate::twamp_control) connection from a
2020
/// Control-Client.
2121
#[derive(Debug)]
2222
pub struct Server {

src/twamp_control/accept_session.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use super::Accept;
22
use deku::prelude::*;
33

4-
/// Response for a Request-TW-Session command.
4+
/// Response for a [Request-TW-Session](super::RequestTwSession) command.
55
#[derive(Clone, Debug, PartialEq, DekuRead, DekuWrite)]
66
#[deku(endian = "big")]
77
pub struct AcceptSession {

src/twamp_control/server_greeting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use super::SecurityMode;
44
use deku::prelude::*;
55
use rand::random;
66

7-
/// Server Greeting sent by `Server` to `Control-Client` after `Control-Client` opens up a TCP
7+
/// Server Greeting sent by [`Server`](crate::server::Server) to [`Control-Client`](crate::control_client) after [`Control-Client`](crate::control_client) opens up a TCP
88
/// connection.
99
///
1010
/// See details in [RFC 4656](https://datatracker.ietf.org/doc/html/rfc4656#section-3.1).

src/twamp_control/server_start.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use deku::prelude::*;
44
use rand::random;
55
use std::time::Duration;
66

7-
/// Sent by Server to Control-Client after receiving a [Set-Up-Response](crate::set_up_response::SetUpResponse) command.
7+
/// Sent by Server to Control-Client after receiving a [Set-Up-Response](crate::twamp_control::SetUpResponse) command.
88
#[derive(Clone, Debug, PartialEq, DekuRead, DekuWrite)]
99
#[deku(endian = "big")]
1010
pub struct ServerStart {
@@ -16,7 +16,7 @@ pub struct ServerStart {
1616
accept: Accept,
1717

1818
/// Generated randomly. Unused in
19-
/// [unauthenticated mode](crate::security_mode::Mode::Unauthenticated).
19+
/// [unauthenticated mode](crate::twamp_control::SecurityMode::Unauthenticated).
2020
server_iv: [u8; 16],
2121

2222
/// The time when the Server binary was executed.

src/twamp_control/set_up_response.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ use anyhow::Result;
33
use deku::prelude::*;
44

55
/// Sent by Control-Client to Server through TWAMP-Control after receiving
6-
/// [Server Greeting](crate::server_greeting::ServerGreeting).
6+
/// [Server Greeting](crate::twamp_control::ServerGreeting).
77
#[derive(Clone, Debug, PartialEq, DekuRead, DekuWrite)]
88
#[deku(endian = "big")]
99
pub struct SetUpResponse {
1010
/// The [security mode](crate::security_mode::Mode) that `Control-Client` wishes to use.
1111
/// It **should** be a mode that the Server supports, which it had sent in
12-
/// [Server Greeting](crate::server_greeting::ServerGreeting).
12+
/// [Server Greeting](crate::twamp_control::ServerGreeting).
1313
mode: SecurityMode,
1414

1515
/// UTF-8 string up to 80 bytes, padded with zeros if shorter. Tells `Server` which shared
@@ -19,14 +19,14 @@ pub struct SetUpResponse {
1919
/// acts as MBZ (Must Be Zero).
2020
key_id: [u8; 80],
2121

22-
/// Concatenation of [challenge](crate::server_greeting::ServerGreeting::challenge), AES
22+
/// Concatenation of [challenge](crate::twamp_control::ServerGreeting::challenge), AES
2323
/// Session-Key and HMAC-SHA1 Session-Key.
2424
///
25-
/// Unused in [unauthenticated mode](crate::security_mode::Mode::Unauthenticated) and
25+
/// Unused in [unauthenticated mode](crate::twamp_control::SecurityMode::Unauthenticated) and
2626
/// acts as MBZ (Must Be Zero).
2727
token: [u8; 64],
2828

29-
/// Unused in [unauthenticated mode](crate::security_mode::Mode::Unauthenticated) and
29+
/// Unused in [unauthenticated mode](crate::twamp_control::SecurityMode::Unauthenticated) and
3030
/// acts as MBZ (Must Be Zero).
3131
client_iv: [u8; 16],
3232
}

0 commit comments

Comments
 (0)