Skip to content

Commit 96eb8d7

Browse files
daviessmJulianSchmid
authored andcommitted
Add serde derive macros where applicable
1 parent 4b6e0b6 commit 96eb8d7

31 files changed

Lines changed: 35 additions & 0 deletions

etherparse/src/internet/ip_auth_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ pub type IpAuthenticationHeader = IpAuthHeader;
1313

1414
/// IP Authentication Header (rfc4302)
1515
#[derive(Clone)]
16+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1617
pub struct IpAuthHeader {
1718
/// IP protocol number specifying the next header or transport layer protocol.
1819
///
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#[derive(Clone)]
2+
pub struct IpAuthIcv {
3+
pub(crate) len: u8,
4+
pub(crate) buf: [u8; 40],
5+
}

etherparse/src/internet/ip_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ use crate::err::{Layer, LenError, LenSource, ValueTooBigError};
55

66
/// Internet protocol headers version 4 & 6.
77
#[derive(Clone, Debug, Eq, PartialEq)]
8+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
89
#[allow(clippy::large_enum_variant)]
910
pub enum IpHeader {
1011
/// IPv4 header & extension headers.

etherparse/src/internet/ipv4_exts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ use crate::{err::ipv4_exts::ExtsWalkError, *};
88
/// Currently not supported:
99
/// - Encapsulating Security Payload Header (ESP)
1010
#[derive(Clone, Debug, Eq, PartialEq, Default)]
11+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
1112
pub struct Ipv4Extensions {
1213
pub auth: Option<IpAuthHeader>,
1314
}

etherparse/src/internet/ipv4_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ use arrayvec::ArrayVec;
3333
/// assert_eq!(slice_rest, &[]);
3434
/// ```
3535
#[derive(Clone, Debug, Eq, PartialEq, Hash)]
36+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3637
pub struct Ipv4Header {
3738
/// Differentiated Services Code Point
3839
pub dscp: Ipv4Dscp,

etherparse/src/internet/ipv6_exts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ use crate::{err::ipv6_exts::*, *};
1818
/// * IP Mobility
1919
/// * Site Multihoming by IPv6 Intermediation (SHIM6)
2020
#[derive(Clone, Debug, Eq, PartialEq, Default)]
21+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2122
pub struct Ipv6Extensions {
2223
pub hop_by_hop_options: Option<Ipv6RawExtHeader>,
2324
pub destination_options: Option<Ipv6RawExtHeader>,

etherparse/src/internet/ipv6_fragment_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use super::super::*;
22

33
/// IPv6 fragment header.
44
#[derive(Clone, Debug, Eq, PartialEq)]
5+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
56
pub struct Ipv6FragmentHeader {
67
/// IP protocol number specifying the next header or transport layer protocol.
78
///

etherparse/src/internet/ipv6_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::{err::ValueTooBigError, *};
22

33
/// IPv6 header according to rfc8200.
44
#[derive(Clone, Debug, Eq, PartialEq, Default)]
5+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
56
pub struct Ipv6Header {
67
pub traffic_class: u8,
78
/// If non 0 serves as a hint to router and switches with multiple outbound paths that these packets should stay on the same path, so that they will not be reordered.

etherparse/src/internet/ipv6_raw_ext_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ pub type Ipv6RawExtensionHeader = Ipv6RawExtHeader;
2525
/// * Host Identity Protocol
2626
/// * Shim6 Protocol
2727
#[derive(Clone)]
28+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2829
pub struct Ipv6RawExtHeader {
2930
/// IP protocol number specifying the next header or transport layer protocol.
3031
///

etherparse/src/link/double_vlan_header.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use crate::*;
22

33
/// IEEE 802.1Q double VLAN Tagging Header
44
#[derive(Clone, Debug, Eq, PartialEq)]
5+
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
56
pub struct DoubleVlanHeader {
67
/// The outer vlan tagging header
78
pub outer: SingleVlanHeader,

0 commit comments

Comments
 (0)