[][src]Struct capsule::packets::ip::v6::SegmentRouting

pub struct SegmentRouting<E: Ipv6Packet> { /* fields omitted */ }

IPv6 Segment Routing based on IETF DRAFT.

Routing Headers are defined in IETF RFC 8200. The Segment Routing Header has a new Routing Type (suggested value 4) to be assigned by IANA.

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Next Header   |  Hdr Ext Len  | Routing Type  | Segments Left |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|  Last Entry   |     Flags     |              Tag              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Segment List[0] (128 bits IPv6 address)            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                                                               |
                             ...
|                                                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            Segment List[n] (128 bits IPv6 address)            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|         Optional Type Length Value objects (variable)         |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
  • Next Header: 8-bit selector. Identifies the type of header immediately following the SRH.

  • Hdr Ext Len: 8-bit unsigned integer, is the length of the SRH header in 8-octet units, not including the first 8 octets.

  • Routing Type: TBD, to be assigned by IANA (suggested value: 4).

  • Segments Left: 8-bit unsigned integer Number of route segments remaining, i.e., number of explicitly listed intermediate nodes still to be visited before reaching the final destination.

  • Last Entry: Contains the index (zero based), in the Segment List, of the last element of the Segment List.

  • Flags: 8 bits of flags. Following flags are defined:

     0 1 2 3 4 5 6 7
    +-+-+-+-+-+-+-+-+
    |U U U U U U U U|
    +-+-+-+-+-+-+-+-+
    • U: Unused and for future use. MUST be 0 on transmission and ignored on receipt.
  • Tag: Tag a packet as part of a class or group of packets, e.g., packets sharing the same set of properties.

  • Segment List[n]: 128 bit IPv6 addresses representing the nth segment in the Segment List. The Segment List is encoded starting from the last segment of the SR Policy, i.e., the first element of the segment list (Segment List [0]) contains the last segment of the SR Policy, the second element contains the penultimate segment of the SR Policy and so on.

  • Type Length Value: A TLV provides meta-data for segment processing. The TLVs defined in this spec are the HMAC and PAD TLVs.

Remarks

TLVs are not supported yet.

Implementations

impl<E: Ipv6Packet> SegmentRouting<E>[src]

pub fn hdr_ext_len(&self) -> u8[src]

Returns the length of the segment routing header in 8-octet units, not including the first 8 octets.

pub fn routing_type(&self) -> u8[src]

Returns the routing type. Suggested value is 4 to be assigned by IANA.

pub fn segments_left(&self) -> u8[src]

Returns the number of route segments remaining.

pub fn set_segments_left(&mut self, segments_left: u8)[src]

Sets the number of route segments remaining.

Remarks

Should also call Ipv6::set_dst to keep the packet's destination in sync with the segment routing header.

pub fn last_entry(&self) -> u8[src]

Returns the index of the last element of the segment list, 0 based.

pub fn tag(&self) -> u16[src]

Returns the tag that marks a packet as part of a class or group of packets.

pub fn set_tag(&mut self, tag: u16)[src]

Tags a packet as part of a class or group of packets.

pub fn segments(&self) -> &[Ipv6Addr][src]

Returns the segment list.

pub fn set_segments(&mut self, segments: &[Ipv6Addr]) -> Fallible<()>[src]

Sets the segment list.

Remarks

Be aware that when invoking this function, it can affect Tcp and Udp checksum calculations, as the last segment is used as part of the pseudo header.

Trait Implementations

impl<E: Ipv6Packet> Debug for SegmentRouting<E>[src]

impl<E: Ipv6Packet> IpPacket for SegmentRouting<E>[src]

fn pseudo_header(
    &self,
    packet_len: u16,
    protocol: ProtocolNumber
) -> PseudoHeader
[src]

Returns the pseudo header.

Based on IETF RFC 8200, if the IPv6 packet contains a Routing header, the Destination Address used in the pseudo-header is that of the final destination. At the originating node, that address will be in the last element of the Routing header; at the recipient(s), that address will be in the Destination Address field of the IPv6 header.

impl<E: Ipv6Packet> Ipv6Packet for SegmentRouting<E>[src]

impl<E: Ipv6Packet> Packet for SegmentRouting<E>[src]

type Envelope = E

The preceding type for an IPv6 segment routing packet can be either an IPv6 packet or any possible IPv6 extension packets.

fn try_parse(envelope: Self::Envelope, _internal: Internal) -> Fallible<Self>[src]

Parses the envelope's payload as an IPv6 segment routing packet.

next_header of the envelope must be set to ProtocolNumbers::Ipv6Route. Otherwise a parsing error is returned.

fn try_push(envelope: Self::Envelope, _internal: Internal) -> Fallible<Self>[src]

Prepends an IPv6 segment routing packet with a segment list of one to the beginning of the envelope's payload.

next_header is set to the value of the next_header field of the envelope, and the envelope is set to ProtocolNumbers::Ipv6Route.

fn remove(self) -> Fallible<Self::Envelope>[src]

Removes IPv6 segment routing packet from the message buffer.

The envelope's next_header field is set to the value of the next_header field on the segment routing packet.

Auto Trait Implementations

impl<E> RefUnwindSafe for SegmentRouting<E> where
    E: RefUnwindSafe

impl<E> !Send for SegmentRouting<E>

impl<E> !Sync for SegmentRouting<E>

impl<E> Unpin for SegmentRouting<E> where
    E: Unpin

impl<E> UnwindSafe for SegmentRouting<E> where
    E: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,