scion

package
v0.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 4, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
const MetaLen = 4

MetaLen is the length of the PathMetaHeader.

View Source
const 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 (s *Base) DecodeFromBytes(data []byte) error

func (*Base) IncPath

func (s *Base) IncPath() error

IncPath increases the currHF index and currINF index if appropriate.

func (*Base) IsXover

func (s *Base) IsXover() bool

IsXover returns whether we are at a crossover point.

func (*Base) Len

func (s *Base) Len() int

Len returns the length of the path in bytes.

func (*Base) Type

func (s *Base) Type() path.Type

Type returns the type of the path.

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

func (s *Decoded) DecodeFromBytes(data []byte) error

DecodeFromBytes fully decodes the SCION path into the corresponding fields.

func (*Decoded) Reverse

func (s *Decoded) Reverse() (path.Path, error)

Reverse reverses a SCION path.

func (*Decoded) SerializeTo

func (s *Decoded) SerializeTo(b []byte) error

SerializeTo writes the path to a slice. The slice must be big enough to hold the entire data, otherwise an error is returned.

func (*Decoded) ToRaw

func (s *Decoded) ToRaw() (*Raw, error)

ToRaw tranforms scion.Decoded into scion.Raw

type MetaHdr

type MetaHdr struct {
	CurrINF uint8
	CurrHF  uint8
	SegLen  [3]uint8
}

MetaHdr is the PathMetaHdr of a SCION (data-plane) path type.

func (*MetaHdr) DecodeFromBytes

func (m *MetaHdr) DecodeFromBytes(raw []byte) error

DecodeFromBytes populates the fields from a raw buffer. The buffer must be of length >= scion.MetaLen

func (*MetaHdr) SerializeTo

func (m *MetaHdr) SerializeTo(b []byte) error

SerializeTo writes the fields into the provided buffer. The buffer must be of length >= scion.MetaLen

func (MetaHdr) String

func (m MetaHdr) String() string

type Raw

type Raw struct {
	Base
	Raw []byte
}

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) DecodeFromBytes

func (s *Raw) DecodeFromBytes(data []byte) error

DecodeFromBytes only decodes the PathMetaHeader. Otherwise the nothing is decoded and simply kept as raw bytes.

func (*Raw) GetCurrentHopField

func (s *Raw) GetCurrentHopField() (*path.HopField, error)

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

func (s *Raw) GetCurrentInfoField() (*path.InfoField, error)

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

func (s *Raw) GetHopField(idx int) (*path.HopField, error)

GetHopField returns the HopField at a given index.

func (*Raw) GetInfoField

func (s *Raw) GetInfoField(idx int) (*path.InfoField, error)

GetInfoField returns the InfoField at a given index.

func (*Raw) Reverse

func (s *Raw) Reverse() (path.Path, error)

Reverse reverses the path such that it can be used in the reverse direction.

func (*Raw) SerializeTo

func (s *Raw) SerializeTo(b []byte) error

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

func (s *Raw) SetHopField(hop *path.HopField, idx int) error

SetHopField updates the HopField at a given index.

func (*Raw) SetInfoField

func (s *Raw) SetInfoField(info *path.InfoField, idx int) error

SetInfoField updates the InfoField at a given index.

func (*Raw) ToDecoded

func (s *Raw) ToDecoded() (*Decoded, error)

ToDecoded transforms a scion.Raw to a scion.Decoded.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL