Crates.io | linktype |
lib.rs | linktype |
version | 0.1.3 |
source | src |
created_at | 2024-08-04 14:16:40.055304 |
updated_at | 2024-08-04 16:31:18.818453 |
description | A simple and publicly managed enum for different link types present in PCAP files. |
homepage | |
repository | https://github.com/starkbamse/linktype |
max_upload_size | |
id | 1325023 |
size | 8,902 |
linktype
- All PCAP Link Types for your rust needsThis crate/repository provides a list of all known PCAP link types as per the tcpdump linktype list. It was created because I required a list of all link types for a project and could not find a rust crate that provided this information. Including this manually just for a single project, seemed like a waste of time. Therefore, to avoid repeating this process, I decided to create this crate.
An unofficial publicly managed linktype list as per https://www.tcpdump.org/linktypes.html.
To use this crate, add the following to your Cargo.toml
:
[dependencies]
linktype = "0.1.3"
Then, you can use the crate as follows:
use linktype::LinkType;
fn main() {
let link_type = LinkType::Ethernet;
println!("Link type: {:?}", link_type);
match link_type {
LinkType::Ethernet => {
// Adjust code execution according to the link type
},
_ => println!("Unknown link type"),
}
let some_link_value=1;
let link_type=LinkType::from_u32(some_link_value);
println!("Link type: {:?}", link_type);
}
This crate is licensed under the MIT license. See the LICENSE file for more details.
If you would like to contribute to this crate, feel free to open a pull request or an issue. I am always open to suggestions and improvements.