arecord

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2020 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package arecord includes an abstration for administrative records, as defined in the Bundle Protocol. Furthermore, a status report implementation is provided.

Index

Constants

View Source
const ARTypeStatusReport uint64 = 1

Variables

This section is empty.

Functions

func AdministrativeRecordToCbor

func AdministrativeRecordToCbor(ar AdministrativeRecord) (blk bundle.CanonicalBlock, err error)

AdministrativeRecordToCbor creates a canonical block, containing this administrative record. The surrounding bundle _must_ have a set AdministrativeRecordPayload bundle processing control flag.

Types

type AdministrativeRecord

type AdministrativeRecord interface {
	cboring.CborMarshaler

	// TypeCode returns this AdministrativeRecord's type code.
	TypeCode() uint64
}

AdministrativeRecord describes a possible administrative record, like a status report, implemented in the StatusReport struct.

func NewAdministrativeRecordFromCbor

func NewAdministrativeRecordFromCbor(data []byte) (ar AdministrativeRecord, err error)

NewAdministrativeRecordFromCbor creates a new AdministrativeRecord from a given byte array.

type BundleStatusItem

type BundleStatusItem struct {
	Asserted        bool
	Time            bundle.DtnTime
	StatusRequested bool
}

BundleStatusItem represents the a bundle status item, as used as an element in the bundle status information array of each Bundle Status Report.

func NewBundleStatusItem

func NewBundleStatusItem(asserted bool) BundleStatusItem

NewBundleStatusItem returns a new BundleStatusItem, indicating an optional assertion - givenas asserted -, but no status time request.

func NewTimeReportingBundleStatusItem

func NewTimeReportingBundleStatusItem(time bundle.DtnTime) BundleStatusItem

NewTimeReportingBundleStatusItem returns a new BundleStatusItem, indicating both a positive assertion and a requested status time report.

func (*BundleStatusItem) MarshalCbor

func (bsi *BundleStatusItem) MarshalCbor(w io.Writer) error

func (BundleStatusItem) String

func (bsi BundleStatusItem) String() string

func (*BundleStatusItem) UnmarshalCbor

func (bsi *BundleStatusItem) UnmarshalCbor(r io.Reader) error

type StatusInformationPos

type StatusInformationPos int

StatusInformationPos describes the different bundle status information entries. Each bundle status report must contain at least the following bundle status items.

const (

	// ReceivedBundle is the first bundle status information entry, indicating
	// the reporting node received this bundle.
	ReceivedBundle StatusInformationPos = 0

	// ForwardedBundle is the second bundle status information entry, indicating
	// the reporting node forwarded this bundle.
	ForwardedBundle StatusInformationPos = 1

	// DeliveredBundle is the third bundle status information entry, indicating
	// the reporting node delivered this bundle.
	DeliveredBundle StatusInformationPos = 2

	// DeletedBundle is the fourth bundle status information entry, indicating
	// the reporting node deleted this bundle.
	DeletedBundle StatusInformationPos = 3
)

func (StatusInformationPos) String

func (sip StatusInformationPos) String() string

type StatusReport

type StatusReport struct {
	StatusInformation []BundleStatusItem
	ReportReason      StatusReportReason
	RefBundle         bundle.BundleID
}

StatusReport is the bundle status report, used in an administrative record.

func NewStatusReport

func NewStatusReport(bndl bundle.Bundle, statusItem StatusInformationPos,
	reason StatusReportReason, time bundle.DtnTime) StatusReport

NewStatusReport creates a bundle status report for the given bundle and StatusInformationPos, which creates the right bundle status item. The bundle status report reason code will be used and the bundle status item gets the given timestamp.

func (*StatusReport) MarshalCbor

func (sr *StatusReport) MarshalCbor(w io.Writer) error

func (StatusReport) StatusInformations

func (sr StatusReport) StatusInformations() (sips []StatusInformationPos)

StatusInformations returns an array of available StatusInformationPos.

func (StatusReport) String

func (sr StatusReport) String() string

func (*StatusReport) TypeCode

func (sr *StatusReport) TypeCode() uint64

func (*StatusReport) UnmarshalCbor

func (sr *StatusReport) UnmarshalCbor(r io.Reader) error

type StatusReportReason

type StatusReportReason uint64

StatusReportReason is the bundle status report reason code, which is used as the second element of the bundle status report array.

const (
	// NoInformation is the "No additional information" bundle status report
	// reason code.
	NoInformation StatusReportReason = 0

	// LifetimeExpired is the "Lifetime expired" bundle status report reason code.
	LifetimeExpired StatusReportReason = 1

	// ForwardUnidirectionalLink is the "Forwarded over unidirectional link"
	// bundle status report reason code.
	ForwardUnidirectionalLink StatusReportReason = 2

	// TransmissionCanceled is the "Transmission canceled" bundle status report
	// reason code.
	TransmissionCanceled StatusReportReason = 3

	// DepletedStorage is the "Depleted storage" bundle status report reason code.
	DepletedStorage StatusReportReason = 4

	// DestEndpointUnintelligible is the "Destination endpoint ID unintelligible"
	// bundle status report reason code.
	DestEndpointUnintelligible StatusReportReason = 5

	// NoRouteToDestination is the "No known route to destination from here"
	// bundle status report reason code.
	NoRouteToDestination StatusReportReason = 6

	// NoNextNodeContact is the "No timely contact with next node on route" bundle
	// status report reason code.
	NoNextNodeContact StatusReportReason = 7

	// BlockUnintelligible is the "Block unintelligible" bundle status report
	// reason code.
	BlockUnintelligible StatusReportReason = 8

	// HopLimitExceeded is the "Hop limit exceeded" bundle status report reason
	// code.
	HopLimitExceeded StatusReportReason = 9
)

func (StatusReportReason) String

func (srr StatusReportReason) String() string

Jump to

Keyboard shortcuts

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