Struct etherparse::IpNumber
source · pub struct IpNumber(pub u8);Expand description
Identifiers for the next_header field in ipv6 headers and protocol field in ipv4 headers.
You can access the underlying u8 value by using .0 and any u8
can be converted to an IpNumber:
use etherparse::IpNumber;
assert_eq!(IpNumber::TCP.0, 6);
assert_eq!(IpNumber::TCP, IpNumber(6));
// convert to IpNumber using the from & into trait
let ip_num: IpNumber = 6.into();
assert_eq!(IpNumber::TCP, ip_num);
// convert to u8 using the from & into trait
let num: u8 = IpNumber::TCP.into();
assert_eq!(6, num);The constants are also defined in the ip_number module so they can
be used without the need to write IpNumber:: in front of them:
use etherparse::{ip_number::TCP, IpNumber};
assert_eq!(TCP, IpNumber::TCP);The list original values were copied from https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml
Tuple Fields§
§0: u8Implementations§
source§impl IpNumber
impl IpNumber
sourcepub const IPV6_HEADER_HOP_BY_HOP: IpNumber = _
pub const IPV6_HEADER_HOP_BY_HOP: IpNumber = _
IPv6 Hop-by-Hop Option [RFC8200]
sourcepub const IGP: IpNumber = _
pub const IGP: IpNumber = _
any private interior gateway (used by Cisco for their IGRP) [Internet_Assigned_Numbers_Authority]
sourcepub const BBN_RCC_MON: IpNumber = _
pub const BBN_RCC_MON: IpNumber = _
BBN RCC Monitoring [Steve_Chipman]
sourcepub const XNET: IpNumber = _
pub const XNET: IpNumber = _
Cross Net Debugger [Haverty, J., “XNET Formats for Internet Protocol Version 4”, IEN 158, October 1980.][Jack_Haverty]
sourcepub const MUX: IpNumber = _
pub const MUX: IpNumber = _
Multiplexing [Cohen, D. and J. Postel, “Multiplexing Protocol”, IEN 90, USC/Information Sciences Institute, May 1979.][Jon_Postel]
sourcepub const MFE_NSP: IpNumber = _
pub const MFE_NSP: IpNumber = _
MFE Network Services Protocol [Shuttleworth, B., “A Documentary of MFENet, a National Computer Network”, UCRL-52317, Lawrence Livermore Labs, Livermore, California, June 1977.] [Barry_Howard]
sourcepub const THIRD_PARTY_CONNECT_PROTOCOL: IpNumber = _
pub const THIRD_PARTY_CONNECT_PROTOCOL: IpNumber = _
Third Party Connect Protocol [Stuart_A_Friedberg]
sourcepub const TP_PLUS_PLUS: IpNumber = _
pub const TP_PLUS_PLUS: IpNumber = _
TP++ Transport Protocol [Dirk_Fromhein]
sourcepub const IPV6_ROUTE_HEADER: IpNumber = _
pub const IPV6_ROUTE_HEADER: IpNumber = _
Routing Header for IPv6 [Steve_Deering]
sourcepub const IPV6_FRAGMENTATION_HEADER: IpNumber = _
pub const IPV6_FRAGMENTATION_HEADER: IpNumber = _
Fragment Header for IPv6 [Steve_Deering]
sourcepub const ENCAPSULATING_SECURITY_PAYLOAD: IpNumber = _
pub const ENCAPSULATING_SECURITY_PAYLOAD: IpNumber = _
Encapsulating Security Payload [RFC4303]
sourcepub const AUTHENTICATION_HEADER: IpNumber = _
pub const AUTHENTICATION_HEADER: IpNumber = _
Authentication Header [RFC4302]
sourcepub const TLSP: IpNumber = _
pub const TLSP: IpNumber = _
Transport Layer Security Protocol using Kryptonet key management [Christer_Oberg]
sourcepub const IPV6_NO_NEXT_HEADER: IpNumber = _
pub const IPV6_NO_NEXT_HEADER: IpNumber = _
No Next Header for IPv6 [RFC8200]
sourcepub const IPV6_DESTINATION_OPTIONS: IpNumber = _
pub const IPV6_DESTINATION_OPTIONS: IpNumber = _
Destination Options for IPv6 [RFC8200]
sourcepub const ANY_HOST_INTERNAL_PROTOCOL: IpNumber = _
pub const ANY_HOST_INTERNAL_PROTOCOL: IpNumber = _
any host internal protocol [Internet_Assigned_Numbers_Authority]
sourcepub const CFTP: IpNumber = _
pub const CFTP: IpNumber = _
CFTP [Forsdick, H., “CFTP”, Network Message, Bolt Beranek and Newman, January 1982.][Harry_Forsdick]
sourcepub const ANY_LOCAL_NETWORK: IpNumber = _
pub const ANY_LOCAL_NETWORK: IpNumber = _
any local network [Internet_Assigned_Numbers_Authority]
sourcepub const ANY_DISTRIBUTED_FILE_SYSTEM: IpNumber = _
pub const ANY_DISTRIBUTED_FILE_SYSTEM: IpNumber = _
any distributed file system [Internet_Assigned_Numbers_Authority]
sourcepub const BR_SAT_MON: IpNumber = _
pub const BR_SAT_MON: IpNumber = _
Backroom SATNET Monitoring [Steven_Blumenthal]
sourcepub const SECURE_VMTP: IpNumber = _
pub const SECURE_VMTP: IpNumber = _
SECURE-VMTP [Dave_Cheriton]
sourcepub const TTP_OR_IPTM: IpNumber = _
pub const TTP_OR_IPTM: IpNumber = _
Transaction Transport Protocol or Internet Protocol Traffic Manager [Jim_Stevens]
sourcepub const NSFNET_IGP: IpNumber = _
pub const NSFNET_IGP: IpNumber = _
NSFNET-IGP [Hans_Werner_Braun]
sourcepub const DGP: IpNumber = _
pub const DGP: IpNumber = _
Dissimilar Gateway Protocol [M/A-COM Government Systems, “Dissimilar Gateway Protocol Specification, Draft Version”, Contract no. CS901145, November 16, 1987.][Mike_Little]
sourcepub const SPRITE_RPC: IpNumber = _
pub const SPRITE_RPC: IpNumber = _
Sprite RPC Protocol [Welch, B., “The Sprite Remote Procedure Call System”, Technical Report, UCB/Computer Science Dept., 86/302, University of California at Berkeley, June 1986.][Bruce Willins]
sourcepub const IFMP: IpNumber = _
pub const IFMP: IpNumber = _
Ipsilon Flow Management Protocol [Bob_Hinden][November 1995, 1997.]
sourcepub const ACTIVE_NETWORKS: IpNumber = _
pub const ACTIVE_NETWORKS: IpNumber = _
Active Networks [Bob_Braden]
sourcepub const SITRA_NETWORKS_PROTOCOL: IpNumber = _
pub const SITRA_NETWORKS_PROTOCOL: IpNumber = _
Sitara Networks Protocol [Manickam_R_Sridhar]
sourcepub const COMPAQ_PEER: IpNumber = _
pub const COMPAQ_PEER: IpNumber = _
Compaq Peer Protocol [Victor_Volpe]
sourcepub const ANY_ZERO_HOP_PROTOCOL: IpNumber = _
pub const ANY_ZERO_HOP_PROTOCOL: IpNumber = _
any 0-hop protocol [Internet_Assigned_Numbers_Authority]
sourcepub const LAYER2_TUNNELING_PROTOCOL: IpNumber = _
pub const LAYER2_TUNNELING_PROTOCOL: IpNumber = _
Layer Two Tunneling Protocol [RFC3931][Bernard_Aboba]
sourcepub const SIMPLE_MESSAGE_PROTOCOL: IpNumber = _
pub const SIMPLE_MESSAGE_PROTOCOL: IpNumber = _
Simple Message Protocol [Leif_Ekblad]
sourcepub const SM: IpNumber = _
pub const SM: IpNumber = _
Simple Multicast Protocol (deprecated) [Jon_Crowcroft][draft-perlman-simple-multicast]
sourcepub const ISIS_OVER_IPV4: IpNumber = _
pub const ISIS_OVER_IPV4: IpNumber = _
ISIS over IPv4 [Tony_Przygienda]
sourcepub const RSVP_E2E_IGNORE: IpNumber = _
pub const RSVP_E2E_IGNORE: IpNumber = _
RSVP-E2E-IGNORE [RFC3175]
sourcepub const MOBILITY_HEADER: IpNumber = _
pub const MOBILITY_HEADER: IpNumber = _
MobilityHeader [RFC6275]
sourcepub const MPLS_IN_IP: IpNumber = _
pub const MPLS_IN_IP: IpNumber = _
[RFC4023]
sourcepub const EXPERIMENTAL_AND_TESTING_0: IpNumber = _
pub const EXPERIMENTAL_AND_TESTING_0: IpNumber = _
Use for experimentation and testing
sourcepub const EXPERIMENTAL_AND_TESTING_1: IpNumber = _
pub const EXPERIMENTAL_AND_TESTING_1: IpNumber = _
Use for experimentation and testing
source§impl IpNumber
impl IpNumber
sourcepub fn is_ipv6_ext_header_value(self) -> bool
pub fn is_ipv6_ext_header_value(self) -> bool
Returns true if the given number is the internet number of an IPV6 extension header.
sourcepub fn keyword_str(self) -> Option<&'static str>
pub fn keyword_str(self) -> Option<&'static str>
Returns the “keyword” string if known. Usually this is the abbreviation of the protocol.
§Example
use etherparse::IpNumber;
assert_eq!(IpNumber::UDP.keyword_str(), Some("UDP"));
// Unassigned values return None
assert_eq!(IpNumber(145).keyword_str(), None);§Data Source
The strings were copied from https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml on 2023-04-11.
sourcepub fn protocol_str(self) -> Option<&'static str>
pub fn protocol_str(self) -> Option<&'static str>
Returns the “protocol” string if known. Usually this the non abbreviated name of the protocol.
§Example
use etherparse::IpNumber;
assert_eq!(IpNumber::UDP.protocol_str(), Some("User Datagram"));
// Unassigned values return None
assert_eq!(IpNumber(145).protocol_str(), None);§Data Source
The string was copied from https://www.iana.org/assignments/protocol-numbers/protocol-numbers.xhtml on 2023-04-11.
Trait Implementations§
source§impl Ord for IpNumber
impl Ord for IpNumber
source§impl PartialOrd for IpNumber
impl PartialOrd for IpNumber
impl Copy for IpNumber
impl Eq for IpNumber
impl StructuralPartialEq for IpNumber
Auto Trait Implementations§
impl Freeze for IpNumber
impl RefUnwindSafe for IpNumber
impl Send for IpNumber
impl Sync for IpNumber
impl Unpin for IpNumber
impl UnwindSafe for IpNumber
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)