Documentation ¶
Index ¶
- Constants
- func RegisterPath()
- type Base
- type Decoded
- type MetaHdr
- type Raw
- func (s *Raw) CurrINFMatchesCurrHF() bool
- func (s *Raw) DecodeFromBytes(data []byte) error
- func (s *Raw) GetCurrentHopField() (path.HopField, error)
- func (s *Raw) GetCurrentInfoField() (path.InfoField, error)
- func (s *Raw) GetHopField(idx int) (path.HopField, error)
- func (s *Raw) GetInfoField(idx int) (path.InfoField, error)
- func (s *Raw) IncPath() error
- func (s *Raw) IsFirstHop() bool
- func (s *Raw) IsLastHop() bool
- func (s *Raw) IsPenultimateHop() bool
- func (s *Raw) Reverse() (path.Path, error)
- func (s *Raw) SerializeTo(b []byte) error
- func (s *Raw) SetHopField(hop path.HopField, idx int) error
- func (s *Raw) SetInfoField(info path.InfoField, idx int) error
- func (s *Raw) ToDecoded() (*Decoded, error)
Constants ¶
const ( // MaxINFs is the maximum number of info fields in a SCION path. MaxINFs = 3 // MaxHops is the maximum number of hop fields in a SCION path. MaxHops = 64 // MetaLen is the length of the PathMetaHeader. MetaLen = 4 PathType path.Type = 1 )
Variables ¶
This section is empty.
Functions ¶
func RegisterPath ¶
func RegisterPath()
Types ¶
type Base ¶
type Base struct { // PathMeta is the SCION path meta header. It is always instantiated when // decoding a path from bytes. PathMeta MetaHdr // NumINF is the number of InfoFields in the path. NumINF int // NumHops is the number HopFields in the path. NumHops int }
Base holds the basic information that is used by both raw and fully decoded paths.
func (*Base) DecodeFromBytes ¶
func (*Base) IsFirstHopAfterXover ¶ added in v0.9.0
IsFirstHopAfterXover returns whether this is the first hop field after a crossover point.
func (*Base) IsXover ¶
IsXover returns whether we are at a crossover point. This includes all segment switches, even over a peering link. Note that handling of a regular segment switch and handling of a segment switch over a peering link are fundamentally different. To distinguish the two, you will need to extract the information from the info field.
type Decoded ¶
type Decoded struct { Base // InfoFields contains all the InfoFields of the path. InfoFields []path.InfoField // HopFields contains all the HopFields of the path. HopFields []path.HopField }
Decoded implements the SCION (data-plane) path type. Decoded is intended to be used in non-performance critical code paths, where the convenience of having a fully parsed path trumps the loss of performance.
func (*Decoded) DecodeFromBytes ¶
DecodeFromBytes fully decodes the SCION path into the corresponding fields.
func (*Decoded) SerializeTo ¶
SerializeTo writes the path to a slice. The slice must be big enough to hold the entire data, otherwise an error is returned.
type MetaHdr ¶
MetaHdr is the PathMetaHdr of a SCION (data-plane) path type.
func (*MetaHdr) DecodeFromBytes ¶
DecodeFromBytes populates the fields from a raw buffer. The buffer must be of length >= scion.MetaLen.
func (*MetaHdr) SerializeTo ¶
SerializeTo writes the fields into the provided buffer. The buffer must be of length >= scion.MetaLen.
type Raw ¶
Raw is a raw representation of the SCION (data-plane) path type. It is designed to parse as little as possible and should be used if performance matters.
func (*Raw) CurrINFMatchesCurrHF ¶ added in v0.12.0
CurrINFMatchesCurrHF returns whether the the path's current hopfield is in the path's current segment.
func (*Raw) DecodeFromBytes ¶
DecodeFromBytes only decodes the PathMetaHeader. Otherwise the nothing is decoded and simply kept as raw bytes.
func (*Raw) GetCurrentHopField ¶
GetCurrentHopField is a convenience method that returns the current hop field pointed to by the CurrHF index in the path meta header.
func (*Raw) GetCurrentInfoField ¶
GetCurrentInfoField is a convenience method that returns the current hop field pointed to by the CurrINF index in the path meta header.
func (*Raw) GetHopField ¶
GetHopField returns the HopField at a given index.
func (*Raw) GetInfoField ¶
GetInfoField returns the InfoField at a given index.
func (*Raw) IsFirstHop ¶ added in v0.9.0
IsFirstHop returns whether the current hop is the first hop on the path.
func (*Raw) IsPenultimateHop ¶
IsPenultimateHop returns whether the current hop is the penultimate hop on the path.
func (*Raw) SerializeTo ¶
SerializeTo writes the path to a slice. The slice must be big enough to hold the entire data, otherwise an error is returned.
func (*Raw) SetHopField ¶
SetHopField updates the HopField at a given index.
func (*Raw) SetInfoField ¶
SetInfoField updates the InfoField at a given index.