Skip to content

Commit 36ff6ae

Browse files
move ethernet, tcp, udp mods
1 parent c0958e9 commit 36ff6ae

39 files changed

+93
-43
lines changed

bench/packets.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818

1919
use anyhow::Result;
2020
use capsule::fieldmap;
21+
use capsule::packets::ethernet::Ethernet;
2122
use capsule::packets::ip::v4::Ipv4;
2223
use capsule::packets::ip::v6::{Ipv6, SegmentRouting};
23-
use capsule::packets::{Ethernet, Mbuf, Packet, Udp4};
24+
use capsule::packets::udp::Udp4;
25+
use capsule::packets::{Mbuf, Packet};
2426
use capsule::testils::criterion::BencherExt;
2527
use capsule::testils::proptest::*;
2628
use capsule::testils::{PacketExt, Rvg};

core/src/packets/arp.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
2121
use crate::ensure;
2222
use crate::net::MacAddr;
23+
use crate::packets::ethernet::{EtherTypes, Ethernet};
2324
use crate::packets::types::u16be;
24-
use crate::packets::{EtherTypes, Ethernet, Internal, Packet, SizeOf};
25+
use crate::packets::{Internal, Packet, SizeOf};
2526
use anyhow::{anyhow, Result};
2627
use std::fmt;
2728
use std::net::Ipv4Addr;

core/src/packets/ethernet.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
* SPDX-License-Identifier: Apache-2.0
1717
*/
1818

19+
//! Ethernet Protocol.
20+
1921
use crate::ensure;
2022
use crate::net::MacAddr;
2123
use crate::packets::types::u16be;

core/src/packets/icmp/v4/echo_reply.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ struct EchoReplyBody {
218218
#[cfg(test)]
219219
mod tests {
220220
use super::*;
221+
use crate::packets::ethernet::Ethernet;
221222
use crate::packets::ip::v4::Ipv4;
222-
use crate::packets::{Ethernet, Mbuf};
223+
use crate::packets::Mbuf;
223224

224225
#[test]
225226
fn size_of_echo_reply_body() {

core/src/packets/icmp/v4/echo_request.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ struct EchoRequestBody {
219219
#[cfg(test)]
220220
mod tests {
221221
use super::*;
222+
use crate::packets::ethernet::Ethernet;
222223
use crate::packets::ip::v4::Ipv4;
223-
use crate::packets::{Ethernet, Mbuf};
224+
use crate::packets::Mbuf;
224225

225226
#[test]
226227
fn size_of_echo_request_body() {

core/src/packets/icmp/v4/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,8 +446,9 @@ pub trait Icmpv4Packet {
446446
#[cfg(test)]
447447
mod tests {
448448
use super::*;
449+
use crate::packets::ethernet::Ethernet;
449450
use crate::packets::ip::v4::Ipv4;
450-
use crate::packets::{Ethernet, Mbuf};
451+
use crate::packets::Mbuf;
451452
use crate::testils::byte_arrays::{ICMPV4_PACKET, IPV4_UDP_PACKET};
452453

453454
#[test]

core/src/packets/icmp/v4/redirect.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,9 @@ impl Default for RedirectBody {
215215
#[cfg(test)]
216216
mod tests {
217217
use super::*;
218+
use crate::packets::ethernet::Ethernet;
218219
use crate::packets::ip::v4::Ipv4;
219-
use crate::packets::{Ethernet, Mbuf};
220+
use crate::packets::Mbuf;
220221
use crate::testils::byte_arrays::IPV4_TCP_PACKET;
221222

222223
#[test]

core/src/packets/icmp/v4/time_exceeded.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,9 @@ struct TimeExceededBody {
179179
#[cfg(test)]
180180
mod tests {
181181
use super::*;
182+
use crate::packets::ethernet::Ethernet;
182183
use crate::packets::ip::v4::Ipv4;
183-
use crate::packets::{Ethernet, Mbuf};
184+
use crate::packets::Mbuf;
184185
use crate::testils::byte_arrays::IPV4_TCP_PACKET;
185186

186187
#[test]

core/src/packets/icmp/v6/echo_reply.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,9 @@ struct EchoReplyBody {
217217
#[cfg(test)]
218218
mod tests {
219219
use super::*;
220+
use crate::packets::ethernet::Ethernet;
220221
use crate::packets::ip::v6::Ipv6;
221-
use crate::packets::{Ethernet, Mbuf};
222+
use crate::packets::Mbuf;
222223

223224
#[test]
224225
fn size_of_echo_reply_body() {

core/src/packets/icmp/v6/echo_request.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ struct EchoRequestBody {
218218
#[cfg(test)]
219219
mod tests {
220220
use super::*;
221+
use crate::packets::ethernet::Ethernet;
221222
use crate::packets::ip::v6::Ipv6;
222-
use crate::packets::{Ethernet, Mbuf};
223+
use crate::packets::Mbuf;
223224

224225
#[test]
225226
fn size_of_echo_request_body() {

0 commit comments

Comments
 (0)