minor fixes

This commit is contained in:
Giuliano Bellini s294739 2022-09-01 12:41:54 +02:00
parent 9ba504994a
commit 5c4a476cd1
2 changed files with 13 additions and 6 deletions

View file

@ -57,7 +57,6 @@ In this document you can find the list of the available command line options, a
## Command line options
- **-a, --adapter**:
name of the network adapter to be inspected, if omitted the default adapter is chosen.
If a non-existing adapter is provided, the application raises an error and terminates.
@ -122,7 +121,6 @@ If a string different from "TCP" or "UDP" is provided (not case-sensitive), the
This option must be followed by a textual value.
```default: "no filter"```
## User interactions during application execution
@ -215,6 +213,11 @@ Specifically, the transport layer protocols field is based on an Enum with only
## Implementation details
<details>
<summary>See details</summary>
The application consists in three different execution flows.
The main thread waits for eventual [user actions](#user-interactions-during-application-execution) (by putting the terminal in raw mode through the ```crossterm::screen::raw::into_raw_mode()``` function and creating a ```crossterm::SyncReader``` which allows to read the input synchronously); in doing so it signals to the secondary threads when to pause or resume their work.
@ -229,14 +232,16 @@ This thread waits for packets without consuming CPU resources through the ```pca
The thread in charge of updating the textual report sleeps for ```interval``` seconds and re-writes the report with updated traffic statistics.
Before updating the report it checks the application status: if it is ```Status::Pause``` it waits, otherwise it proceeds writing the report.
</details>
## Error conditions
In this section are reported the errors that may occur while the application is running.
<details>
<summary>See details</summary>
### Wrong command line options specification
- **Not existing adapter name**:
if a non-existing adapter name is provided, the application raises an error and terminates.
In this case the application will suggest using the ```-d``` option to print on the standard output a list of the available devices.
@ -342,6 +347,7 @@ All those exceptional scenarios are managed through calls to the ```expect()```
The ```unwrap()``` method is used only on ```Option<T>``` values when it's certain they contain ```Some``` value.
</details>
# Authors

View file

@ -3,6 +3,7 @@
use std::collections::HashSet;
use std::fmt;
use thousands::Separable;
/// Struct useful to format the output report file and to keep track of statistics about the sniffed traffic.
///
@ -76,8 +77,8 @@ impl fmt::Display for ReportInfo {
\t\t\t\tProtocols\n\
\t\t\t\t\tTransport layer protocols: {}\n\
\t\t\t\t\tApplication layer protocols: {}\n\n",
n, multiple_transmitted, self.transmitted_packets,
m, multiple_received, self.received_packets,
n, multiple_transmitted, self.transmitted_packets.separate_with_underscores(),
m, multiple_received, self.received_packets.separate_with_underscores(),
self.initial_timestamp, self.final_timestamp,
transport_level_protocols, application_level_protocols
)