cla

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cla defines two interfaces for Convergence Layer Adapters.

The ConvergenceReceiver specifies a type which receives bundles and forwards those to an exposed channel.

The ConvergenceSender specifies a type which sends bundles to a remote endpoint.

An implemented convergence layer can be a ConvergenceReceiver, ConvergenceSender or even both. This depends on the convergence layer's specification and is an implemention matter.

Furthermore, the ConvergenceProvider provides the ability to create new instances of Convergence objects.

Those types are generalized by the Convergable interface.

A centralized instance for CLA management offers the Manager, designed to work seamlessly with the types above.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Convergable added in v0.4.0

type Convergable interface {
	// Close signals this Convergable to shut down.
	Close()
}

Convergable describes any kind of type which supports convergence layer- related services. This can be both a more specified Convergence interface type or a ConvergenceProvider.

type Convergence

type Convergence interface {
	Convergable

	// Start starts this Convergence{Receiver,Sender} and might return an error
	// and a boolean indicating if another Start should be tried later.
	Start() (error, bool)

	// Channel represents a return channel for transmitted bundles, status
	// messages, etc.
	Channel() chan ConvergenceStatus

	// Address should return a unique address string to both identify this
	// Convergence{Receiver,Sender} and ensure it will not opened twice.
	Address() string

	// IsPermanent returns true, if this CLA should not be removed after failures.
	IsPermanent() bool
}

Convergence is an interface to describe all kinds of Convergence Layer Adapters. There should not be a direct implemention of this interface. One must implement ConvergenceReceiver and/or ConvergenceSender, which are both extending this interface. A type can be both a ConvergenceReceiver and ConvergenceSender.

type ConvergenceMessageType added in v0.2.0

type ConvergenceMessageType uint

ConvergenceMessageType indicates the kind of a ConvergenceStatus.

const (

	// ReceivedBundle shows the reception of a bundle. The Message's type must be
	// a ConvergenceReceivedBundle struct.
	ReceivedBundle ConvergenceMessageType

	// PeerDisappeared shows the disappearance of a peer. The Message's type must
	// be a bundle.EndpointID.
	PeerDisappeared

	// PeerAppeared shows the appearance of a peer. The Message's type must be
	// a bundle.EndpointID
	PeerAppeared
)

func (ConvergenceMessageType) String added in v0.2.0

func (cms ConvergenceMessageType) String() string

type ConvergenceProvider added in v0.4.0

type ConvergenceProvider interface {
	Convergable

	// RegisterManager tells the ConvergenceProvider where to report new instances
	// of Convergence to.
	RegisterManager(*Manager)

	// Start starts this ConvergenceProvider. Before being started, the the
	// RegisterManager method tells this ConvergenceProvider its Manager. However,
	// the Manager will both call the RegisterManager and Start methods.
	Start() error
}

ConvergenceProvider is a more general kind of CLA service which does not transfer any Bundles by itself, but supplies/creates new Convergence types. Those Convergence objects will be passed to a Manager. Thus, one might think of a ConvergenceProvider as some kind of middleware.

type ConvergenceReceivedBundle added in v0.2.0

type ConvergenceReceivedBundle struct {
	Endpoint bundle.EndpointID
	Bundle   *bundle.Bundle
}

ConvergenceReceivedBundle is an optional Message content for a ConvergenceStatus for the ReceivedBundle MessageType.

type ConvergenceReceiver

type ConvergenceReceiver interface {
	Convergence

	// GetEndpointID returns the endpoint ID assigned to this CLA.
	GetEndpointID() bundle.EndpointID
}

ConvergenceReceiver is an interface for types which are able to receive bundles and write them to a channel. This channel can be accessed through the Channel method.

type ConvergenceSender

type ConvergenceSender interface {
	Convergence

	// Send transmits a bundle to this ConvergenceSender's endpoint. This method
	// should be thread safe and finish transmitting one bundle, before acting
	// on the next. This could be achieved by using a mutex or the like.
	Send(bndl *bundle.Bundle) error

	// GetPeerEndpointID returns the endpoint ID assigned to this CLA's peer,
	// if it's known. Otherwise the zero endpoint will be returned.
	GetPeerEndpointID() bundle.EndpointID
}

ConvergenceSender is an interface for types which are able to transmit bundles to another node.

type ConvergenceStatus added in v0.2.0

type ConvergenceStatus struct {
	Sender      Convergence
	MessageType ConvergenceMessageType
	Message     interface{}
}

ConvergenceStatus allows transmission of information via a return channel from a Convergence instance.

func NewConvergencePeerAppeared added in v0.2.0

func NewConvergencePeerAppeared(sender Convergence, peerEid bundle.EndpointID) ConvergenceStatus

NewConvergencePeerAppeared creates a new ConvergenceStatus for a PeerAppeared type, transmission the appeared EndpointID.

func NewConvergencePeerDisappeared added in v0.2.0

func NewConvergencePeerDisappeared(sender Convergence, peerEid bundle.EndpointID) ConvergenceStatus

NewConvergencePeerDisappeared creates a new ConvergenceStatus for a PeerDisappeared type, transmission the disappeared EndpointID.

func NewConvergenceReceivedBundle added in v0.2.0

func NewConvergenceReceivedBundle(sender Convergence, eid bundle.EndpointID, bndl *bundle.Bundle) ConvergenceStatus

NewConvergenceReceivedBundle creates a new ConvergenceStatus for a ReceivedBundle type, transmitting both EndpointID and Bundle pointer.

func (ConvergenceStatus) String added in v0.2.0

func (cs ConvergenceStatus) String() string

type Manager added in v0.2.0

type Manager struct {
	// contains filtered or unexported fields
}

Manager monitors and manages the various CLAs, restarts them if necessary, and forwards the ConvergenceStatus messages. The recipient can perform further actions based on these, but does not have to take care of the CLA administration themselves.

func NewManager added in v0.2.0

func NewManager() *Manager

NewManager creates a new Manager to supervise different CLAs.

func (*Manager) Channel added in v0.2.0

func (manager *Manager) Channel() chan ConvergenceStatus

Channel references the outgoing channel for ConvergenceStatus messages.

func (*Manager) Close added in v0.2.0

func (manager *Manager) Close()

Close the Manager and all supervised CLAs.

func (*Manager) Receiver added in v0.2.0

func (manager *Manager) Receiver() (crs []ConvergenceReceiver)

Receiver returns an array of all active ConvergenceReceivers.

func (*Manager) Register added in v0.2.0

func (manager *Manager) Register(conv Convergable)

Register any kind of Convergable.

func (*Manager) Restart added in v0.2.0

func (manager *Manager) Restart(conv Convergable)

Restart a known Convergable.

func (*Manager) Sender added in v0.2.0

func (manager *Manager) Sender() (css []ConvergenceSender)

Sender returns an array of all active ConvergenceSenders.

func (*Manager) Unregister added in v0.2.0

func (manager *Manager) Unregister(conv Convergable)

Unregister any kind of Convergable.

Directories

Path Synopsis
Package bbc describes a simple Bundle Broadcasting Connector to receive and transmit Bundles over a shared broadcasting medium, e.g., LoRa.
Package bbc describes a simple Bundle Broadcasting Connector to receive and transmit Bundles over a shared broadcasting medium, e.g., LoRa.
Package mtcp provides a library for the Minimal TCP Convergence-Layer Protocol as defined in draft-ietf-dtn-mtcpcl-01 Because of the unidirectional design of MTCP, both MTPCServer and MTCPClient exists.
Package mtcp provides a library for the Minimal TCP Convergence-Layer Protocol as defined in draft-ietf-dtn-mtcpcl-01 Because of the unidirectional design of MTCP, both MTPCServer and MTCPClient exists.
Package tcpcl provides a library for the Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4, draft-ietf-dtn-tcpclv4-14.
Package tcpcl provides a library for the Delay-Tolerant Networking TCP Convergence Layer Protocol Version 4, draft-ietf-dtn-tcpclv4-14.

Jump to

Keyboard shortcuts

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