reservation

package
v0.1.2 Latest Latest
Warning

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

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

Documentation

Overview

Package reservation defines the dataplane representation of the bandwidth reservation token in the bandwidth allocation system for star topologies.

Index

Constants

View Source
const (
	// PathType is the path type unique value of the reservation path.
	PathType path.Type = 250
	// MetaLen is the length of the PathMetaHeader.
	MetaLen = 16
)

Variables

This section is empty.

Functions

func MAC

func MAC(h hash.Hash, scion *slayers.SCION, path *Path) []byte

MAC calculates the Reservation MAC.

func MACInput

func MACInput(scion *slayers.SCION, path *Path) []byte

MACInput returns the MAC input data block with the following layout:

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            DstISD             |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                             DstAS                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            SrcISD             |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                             SrcAS                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           DstHost (var)                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                           SrcHost (var)                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ID                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            ExpTime                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           RateLimit           |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                               0                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                        SCION Path (var)                       |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func RegisterPath

func RegisterPath()

RegisterPath registers the path type with the path package. It must be invoked to activate the reservation path type.

func VerifyMAC

func VerifyMAC(h hash.Hash, scion *slayers.SCION, path *Path) error

VerifyMAC verifies that the MAC in the Reservation header is correct, i.e., matches the value calculated with MAC(h, scion, path). Returns nil if the MACs match, error otherwise.

Types

type MetaHdr

type MetaHdr struct {
	// ID represents the unique ID of the reservation.
	ID uint32
	// ExpTime is the time that the reservation expires, expressed in Unix time as a
	// 4 byte integer with 1 second granularity.
	ExpTime uint32
	// RateLimit is the resevation rate limit with 1 Mbit/s granularity.
	RateLimit uint16
	// MAC is the 6-byte Message Authentication Code to authenticate the reservation.
	MAC []byte
}

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

 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
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                              ID                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            ExpTime                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|           RateLimit           |                               |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+                               +
|                              Mac                              |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func (*MetaHdr) DecodeFromBytes

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

DecodeFromBytes populates the fields from a raw buffer. The buffer must be of length >= 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 >= MetaLen.

type Path

type Path struct {
	MetaHdr
	scion.Decoded
}

Path encodes a reservation path. A reservation path is essentially a SCION path with an additional path meta header.

func (*Path) DecodeFromBytes

func (p *Path) DecodeFromBytes(raw []byte) error

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

func (*Path) Len

func (p *Path) Len() int

Len returns the length of the path in bytes.

func (*Path) Reverse

func (p *Path) Reverse() (path.Path, error)

Reverse reverses a Reservation path. The reservation token is stripped from the returned regular SCION path.

func (*Path) SerializeTo

func (p *Path) SerializeTo(b []byte) error

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

func (*Path) Type

func (p *Path) Type() path.Type

Type returns the type of the path.

Jump to

Keyboard shortcuts

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