Documentation ¶
Overview ¶
Package routing represents a bundle node's router and contains both the bundle protocol agent and application agent.
Here be dragons.
Index ¶
- func CheckHopCount(_ *Pipeline, descriptor BundleDescriptor) (err error)
- func CheckLifetime(_ *Pipeline, descriptor BundleDescriptor) (err error)
- func CheckRouting(pipeline *Pipeline, descriptor BundleDescriptor) (err error)
- type AgentManager
- type Algorithm
- type BinarySpray
- func (_ *BinarySpray) DispatchingAllowed(_ BundleDescriptor) bool
- func (bs *BinarySpray) GarbageCollect()
- func (bs *BinarySpray) NotifyNewBundle(bp BundleDescriptor)
- func (bs *BinarySpray) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
- func (_ *BinarySpray) ReportPeerAppeared(_ cla.Convergence)
- func (_ *BinarySpray) ReportPeerDisappeared(_ cla.Convergence)
- func (bs *BinarySpray) SenderForBundle(bp BundleDescriptor) (css []cla.ConvergenceSender, del bool)
- type BundleDescriptor
- func (descriptor *BundleDescriptor) AddConstraint(c Constraint)
- func (descriptor *BundleDescriptor) AddTag(tag Tag)
- func (descriptor *BundleDescriptor) Bundle() (*bpv7.Bundle, error)
- func (descriptor BundleDescriptor) HasConstraint(c Constraint) bool
- func (descriptor BundleDescriptor) HasConstraints() bool
- func (descriptor BundleDescriptor) HasReceiver() bool
- func (descriptor *BundleDescriptor) HasTag(tag Tag) bool
- func (descriptor BundleDescriptor) ID() bpv7.BundleID
- func (descriptor *BundleDescriptor) MustBundle() *bpv7.Bundle
- func (descriptor *BundleDescriptor) PurgeConstraints()
- func (descriptor *BundleDescriptor) RemoveConstraint(c Constraint)
- func (descriptor *BundleDescriptor) RemoveTag(tag Tag)
- func (descriptor BundleDescriptor) String() string
- func (descriptor BundleDescriptor) Sync() error
- func (descriptor *BundleDescriptor) UpdateBundleAge() (uint64, error)
- type CheckFunc
- type Constraint
- type Core
- func (c *Core) Close()
- func (c *Core) HasEndpoint(endpoint bpv7.EndpointID) bool
- func (c *Core) RegisterApplicationAgent(app agent.ApplicationAgent)
- func (c *Core) RegisterCLA(conv cla.Convergable, claType cla.CLAType, eid bpv7.EndpointID)
- func (c *Core) RegisterConvergable(conv cla.Convergable)
- func (c *Core) RegisteredCLAs(claType cla.CLAType) []bpv7.EndpointID
- func (c *Core) SendBundle(bndl *bpv7.Bundle)
- func (c *Core) SendStatusReport(descriptor BundleDescriptor, status bpv7.StatusInformationPos, ...)
- func (c *Core) SetRoutingAlgorithm(routing Algorithm)
- type Cron
- type DTLSR
- func (_ *DTLSR) DispatchingAllowed(_ BundleDescriptor) bool
- func (dtlsr *DTLSR) NotifyNewBundle(bp BundleDescriptor)
- func (_ *DTLSR) ReportFailure(_ BundleDescriptor, _ cla.ConvergenceSender)
- func (dtlsr *DTLSR) ReportPeerAppeared(peer cla.Convergence)
- func (dtlsr *DTLSR) ReportPeerDisappeared(peer cla.Convergence)
- func (dtlsr *DTLSR) SenderForBundle(bp BundleDescriptor) (sender []cla.ConvergenceSender, delete bool)
- type DTLSRConfig
- type EpidemicRouting
- func (er *EpidemicRouting) DispatchingAllowed(bp BundleDescriptor) bool
- func (er *EpidemicRouting) NotifyNewBundle(bp BundleDescriptor)
- func (er *EpidemicRouting) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
- func (_ *EpidemicRouting) ReportPeerAppeared(_ cla.Convergence)
- func (_ *EpidemicRouting) ReportPeerDisappeared(_ cla.Convergence)
- func (er *EpidemicRouting) SenderForBundle(bp BundleDescriptor) (css []cla.ConvergenceSender, del bool)
- func (_ *EpidemicRouting) String() string
- type IdKeeper
- type Pipeline
- type Prophet
- func (prophet *Prophet) DispatchingAllowed(_ BundleDescriptor) bool
- func (prophet *Prophet) NotifyNewBundle(bp BundleDescriptor)
- func (prophet *Prophet) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
- func (prophet *Prophet) ReportPeerAppeared(peer cla.Convergence)
- func (prophet *Prophet) ReportPeerDisappeared(peer cla.Convergence)
- func (prophet *Prophet) SenderForBundle(bp BundleDescriptor) (sender []cla.ConvergenceSender, delete bool)
- type ProphetConfig
- type RoutingConf
- type SensorNetworkMuleConfig
- type SensorNetworkMuleRouting
- func (snm *SensorNetworkMuleRouting) DispatchingAllowed(bp BundleDescriptor) bool
- func (snm *SensorNetworkMuleRouting) NotifyNewBundle(bp BundleDescriptor)
- func (snm *SensorNetworkMuleRouting) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
- func (snm *SensorNetworkMuleRouting) ReportPeerAppeared(peer cla.Convergence)
- func (snm *SensorNetworkMuleRouting) ReportPeerDisappeared(peer cla.Convergence)
- func (snm *SensorNetworkMuleRouting) SenderForBundle(bp BundleDescriptor) (sender []cla.ConvergenceSender, delete bool)
- func (snm *SensorNetworkMuleRouting) String() string
- type SprayAndWait
- func (_ *SprayAndWait) DispatchingAllowed(_ BundleDescriptor) bool
- func (sw *SprayAndWait) GarbageCollect()
- func (sw *SprayAndWait) NotifyNewBundle(bp BundleDescriptor)
- func (sw *SprayAndWait) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
- func (_ *SprayAndWait) ReportPeerAppeared(_ cla.Convergence)
- func (_ *SprayAndWait) ReportPeerDisappeared(_ cla.Convergence)
- func (sw *SprayAndWait) SenderForBundle(bp BundleDescriptor) (css []cla.ConvergenceSender, del bool)
- type SprayConfig
- type Tag
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckHopCount ¶
func CheckHopCount(_ *Pipeline, descriptor BundleDescriptor) (err error)
CheckHopCount of an optionally exceeded HopCountBlock.
func CheckLifetime ¶
func CheckLifetime(_ *Pipeline, descriptor BundleDescriptor) (err error)
CheckLifetime of the bpv7.Bundle.
func CheckRouting ¶
func CheckRouting(pipeline *Pipeline, descriptor BundleDescriptor) (err error)
CheckRouting wraps the Algorithm.DispatchingAllowed method.
Types ¶
type AgentManager ¶
type AgentManager struct {
// contains filtered or unexported fields
}
AgentManager is a proxy to connect different ApplicationAgents with the routing package.
func NewAgentManager ¶
func NewAgentManager(core *Core) (manager *AgentManager)
NewAgentManager creates a new AgentManager to proxy different ApplicationAgents within the routing package.
func (*AgentManager) Close ¶
func (manager *AgentManager) Close() error
Close down this AgentManager and its underlying ApplicationAgents.
func (*AgentManager) Deliver ¶
func (manager *AgentManager) Deliver(descriptor BundleDescriptor) error
Deliver a Bundle to a registered ApplicationAgent, addressed by the Bundle's destination.
func (*AgentManager) HasEndpoint ¶
func (manager *AgentManager) HasEndpoint(eid bpv7.EndpointID) bool
HasEndpoint checks if some specific EndpointID is registered for some ApplicationAgent.
func (*AgentManager) Register ¶
func (manager *AgentManager) Register(appAgent agent.ApplicationAgent)
Register a new ApplicationAgent.
type Algorithm ¶
type Algorithm interface { // NotifyNewBundle notifies this Algorithm about new bundles. They // might be generated at this node or received from a peer. Whether an // algorithm acts on this information or ignores it, is implementation matter. NotifyNewBundle(descriptor BundleDescriptor) // DispatchingAllowed will be called from within the *dispatching* step of // the processing pipeline. A Algorithm is allowed to drop the // proceeding of a bundle before being inspected further or being delivered // locally or to another node. DispatchingAllowed(descriptor BundleDescriptor) bool // SenderForBundle returns an array of ConvergenceSender for a requested // bundle. Furthermore the delete flags indicates if this BundleDescriptor should // be deleted afterwards. // The CLA selection is based on the algorithm's design. SenderForBundle(descriptor BundleDescriptor) (sender []cla.ConvergenceSender, delete bool) // ReportFailure notifies the Algorithm about a failed transmission to // a previously selected CLA. Compare: SenderForBundle. ReportFailure(descriptor BundleDescriptor, sender cla.ConvergenceSender) // ReportPeerAppeared notifies the Algorithm about a new neighbor. ReportPeerAppeared(peer cla.Convergence) // ReportPeerDisappeared notifies the Algorithm about the // disappearance of a neighbor. ReportPeerDisappeared(peer cla.Convergence) }
Algorithm is an interface to specify routing algorithms for delay-tolerant networks.
type BinarySpray ¶
type BinarySpray struct {
// contains filtered or unexported fields
}
BinarySpray implements the binary Spray and Wait routing protocol In this case, each node hands over floor(copies/2) during the spray phase
func NewBinarySpray ¶
func NewBinarySpray(c *Core, config SprayConfig) *BinarySpray
NewBinarySpray creates new instance of BinarySpray
func (*BinarySpray) DispatchingAllowed ¶
func (_ *BinarySpray) DispatchingAllowed(_ BundleDescriptor) bool
DispatchingAllowed allows the processing of all packages.
func (*BinarySpray) GarbageCollect ¶
func (bs *BinarySpray) GarbageCollect()
GarbageCollect performs periodical cleanup of Bundle metadata
func (*BinarySpray) NotifyNewBundle ¶
func (bs *BinarySpray) NotifyNewBundle(bp BundleDescriptor)
NotifyNewBundle tells the routing algorithm about new bundles.
In this case, we check, whether we are the originator of this bundle If yes, then we initialise the remaining Copies to Multiplicity If not we attempt to ready the routing-metadata-block end get the remaining copies
func (*BinarySpray) ReportFailure ¶
func (bs *BinarySpray) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
ReportFailure resets remaining copies if delivery was unsuccessful.
func (*BinarySpray) ReportPeerAppeared ¶
func (_ *BinarySpray) ReportPeerAppeared(_ cla.Convergence)
func (*BinarySpray) ReportPeerDisappeared ¶
func (_ *BinarySpray) ReportPeerDisappeared(_ cla.Convergence)
func (*BinarySpray) SenderForBundle ¶
func (bs *BinarySpray) SenderForBundle(bp BundleDescriptor) (css []cla.ConvergenceSender, del bool)
SenderForBundle returns the Core's ConvergenceSenders. If a node has more than 1 copy left it will send floor(copies/2) to the peer and keep roof(copies/2) for itself
type BundleDescriptor ¶
type BundleDescriptor struct { Id bpv7.BundleID Receiver bpv7.EndpointID Timestamp time.Time Constraints map[Constraint]bool Tags map[Tag]struct{} // contains filtered or unexported fields }
BundleDescriptor is a meta wrapper around a bpv7.Bundle to supply routing information without having to pass or alter the original bpv7.Bundle.
func NewBundleDescriptor ¶
func NewBundleDescriptor(bid bpv7.BundleID, store *storage.Store) BundleDescriptor
NewBundleDescriptor for a bpv7.BundleID from a Store.
func NewBundleDescriptorFromBundle ¶
func NewBundleDescriptorFromBundle(b bpv7.Bundle, store *storage.Store) BundleDescriptor
NewBundleDescriptorFromBundle for a bpv7.Bundle to be inserted into a Store.
func (*BundleDescriptor) AddConstraint ¶
func (descriptor *BundleDescriptor) AddConstraint(c Constraint)
AddConstraint adds the given constraint.
func (*BundleDescriptor) AddTag ¶
func (descriptor *BundleDescriptor) AddTag(tag Tag)
AddTag to this BundleDescriptor.
func (*BundleDescriptor) Bundle ¶
func (descriptor *BundleDescriptor) Bundle() (*bpv7.Bundle, error)
Bundle returns this BundleDescriptor's internal bpv7.Bundle.
func (BundleDescriptor) HasConstraint ¶
func (descriptor BundleDescriptor) HasConstraint(c Constraint) bool
HasConstraint returns true if the given constraint contains.
func (BundleDescriptor) HasConstraints ¶
func (descriptor BundleDescriptor) HasConstraints() bool
HasConstraints returns true if any constraint exists.
func (BundleDescriptor) HasReceiver ¶
func (descriptor BundleDescriptor) HasReceiver() bool
HasReceiver returns true if this BundleDescriptor has a Receiver value.
func (*BundleDescriptor) HasTag ¶
func (descriptor *BundleDescriptor) HasTag(tag Tag) bool
HasTag checks if this BundleDescriptor has a Tag assigned.
func (BundleDescriptor) ID ¶
func (descriptor BundleDescriptor) ID() bpv7.BundleID
ID returns the wrapped Bundle's ID.
func (*BundleDescriptor) MustBundle ¶
func (descriptor *BundleDescriptor) MustBundle() *bpv7.Bundle
MustBundle returns this BundleDescriptor's internal bpv7.Bundle or panics, compare the Bundle method.
func (*BundleDescriptor) PurgeConstraints ¶
func (descriptor *BundleDescriptor) PurgeConstraints()
PurgeConstraints removes all constraints, except LocalEndpoint.
func (*BundleDescriptor) RemoveConstraint ¶
func (descriptor *BundleDescriptor) RemoveConstraint(c Constraint)
RemoveConstraint removes the given constraint.
func (*BundleDescriptor) RemoveTag ¶
func (descriptor *BundleDescriptor) RemoveTag(tag Tag)
RemoveTag from this BundleDescriptor.
func (BundleDescriptor) String ¶
func (descriptor BundleDescriptor) String() string
func (BundleDescriptor) Sync ¶
func (descriptor BundleDescriptor) Sync() error
Sync this BundleDescriptor to the store.
func (*BundleDescriptor) UpdateBundleAge ¶
func (descriptor *BundleDescriptor) UpdateBundleAge() (uint64, error)
UpdateBundleAge updates the bundle's Bundle Age block based on its reception timestamp, if such a block exists.
type CheckFunc ¶
type CheckFunc func(*Pipeline, BundleDescriptor) error
CheckFunc is used within the Pipeline for bpv7.Bundle / BundleDescriptor inspection.
type Constraint ¶
type Constraint int
Constraint is a retention constraint as defined in the subsections of the fifth chapter of dtn-bpbis.
const ( // DispatchPending is assigned to a bpv7 if its dispatching is pending. DispatchPending Constraint = iota // ForwardPending is assigned to a bundle if its forwarding is pending. ForwardPending Constraint = iota // ReassemblyPending_ is assigned to a fragmented bundle if its reassembly is // pending. ReassemblyPending_ Constraint = iota // Contraindicated is assigned to a bundle if it could not be delivered and // was moved to the contraindicated stage. This Constraint was not defined // in dtn-bpbis, but seemed reasonable for this implementation. Contraindicated Constraint = iota // LocalEndpoint is assigned to a bundle after delivery to a local endpoint. // This constraint demands storage until the endpoint removes this constraint. LocalEndpoint Constraint = iota )
func (Constraint) String ¶
func (c Constraint) String() string
type Core ¶
type Core struct { InspectAllBundles bool NodeId bpv7.EndpointID // contains filtered or unexported fields }
Core is the inner processing of our DTN which handles transmission, reception and reception of bundles.
func NewCore ¶
func NewCore(storePath string, nodeId bpv7.EndpointID, inspectAllBundles bool, routingConf RoutingConf, signPriv ed25519.PrivateKey) (*Core, error)
NewCore will be created according to the parameters.
storePath: path for the bundle and metadata storage nodeId: singleton Endpoint ID/Node ID inspectAllBundles: inspect all administrative records, not only those addressed to this node routingConf: selected routing algorithm and its configuration signPriv: optional ed25519 private key (64 bytes long) to sign all outgoing bundles; or nil to not use this feature
func (*Core) Close ¶
func (c *Core) Close()
Close shuts the Core down and notifies all bounded ConvergenceReceivers to also close the connection.
func (*Core) HasEndpoint ¶
func (c *Core) HasEndpoint(endpoint bpv7.EndpointID) bool
HasEndpoint checks if the given endpoint ID is assigned either to an application or a CLA governed by this Application Agent.
func (*Core) RegisterApplicationAgent ¶
func (c *Core) RegisterApplicationAgent(app agent.ApplicationAgent)
RegisterApplicationAgent adds a new ApplicationAgent to this Core's list.
func (*Core) RegisterCLA ¶
func (c *Core) RegisterCLA(conv cla.Convergable, claType cla.CLAType, eid bpv7.EndpointID)
RegisterCLA registers a CLA with the clamanager (just as the RegisterConvergable-method) but also adds the CLAs endpoint id to the set of registered IDs for its type.
func (*Core) RegisterConvergable ¶
func (c *Core) RegisterConvergable(conv cla.Convergable)
RegisterConvergable is the exposed Register method from the CLA Manager.
func (*Core) RegisteredCLAs ¶
func (c *Core) RegisteredCLAs(claType cla.CLAType) []bpv7.EndpointID
RegisteredCLAs returns the EndpointIDs of all registered CLAs of the specified type. Returns an empty slice if no CLAs of the tye exist.
func (*Core) SendBundle ¶
SendBundle transmits an outbounding bundle.
func (*Core) SendStatusReport ¶
func (c *Core) SendStatusReport(descriptor BundleDescriptor, status bpv7.StatusInformationPos, reason bpv7.StatusReportReason)
SendStatusReport creates a new status report in response to the given BundleDescriptor and transmits it.
func (*Core) SetRoutingAlgorithm ¶
SetRoutingAlgorithm overwrites the used Algorithm, which defaults to EpidemicRouting.
type Cron ¶
type Cron struct {
// contains filtered or unexported fields
}
Cron manages different jobs which require interval based execution.
func (*Cron) Register ¶
Register a new task by its name, function and interval. The interval must be at least one second. The function will be executed in a new Goroutine and must be thread-safe.
type DTLSR ¶
type DTLSR struct {
// contains filtered or unexported fields
}
DTLSR is an implementation of "Delay Tolerant Link State Routing"
func NewDTLSR ¶
func NewDTLSR(c *Core, config DTLSRConfig) *DTLSR
func (*DTLSR) DispatchingAllowed ¶
func (_ *DTLSR) DispatchingAllowed(_ BundleDescriptor) bool
DispatchingAllowed allows the processing of all packages.
func (*DTLSR) NotifyNewBundle ¶
func (dtlsr *DTLSR) NotifyNewBundle(bp BundleDescriptor)
func (*DTLSR) ReportFailure ¶
func (_ *DTLSR) ReportFailure(_ BundleDescriptor, _ cla.ConvergenceSender)
func (*DTLSR) ReportPeerAppeared ¶
func (dtlsr *DTLSR) ReportPeerAppeared(peer cla.Convergence)
func (*DTLSR) ReportPeerDisappeared ¶
func (dtlsr *DTLSR) ReportPeerDisappeared(peer cla.Convergence)
func (*DTLSR) SenderForBundle ¶
func (dtlsr *DTLSR) SenderForBundle(bp BundleDescriptor) (sender []cla.ConvergenceSender, delete bool)
type DTLSRConfig ¶
type DTLSRConfig struct { // RecomputeTime is the interval (in seconds) until the routing table is recomputed. // Note: Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". RecomputeTime string // BroadcastTime is the interval (in seconds) between broadcasts of peer data. // Note: Broadcast only happens when there was a change in peer data. // Note: Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". BroadcastTime string // PurgeTime is the interval after which a disconnected peer is removed from the peer list. // Note: Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". PurgeTime string }
type EpidemicRouting ¶
type EpidemicRouting struct {
// contains filtered or unexported fields
}
EpidemicRouting is an implementation of a Algorithm and behaves in a flooding-based epidemic way.
func NewEpidemicRouting ¶
func NewEpidemicRouting(c *Core) *EpidemicRouting
NewEpidemicRouting creates a new EpidemicRouting Algorithm interacting with the given Core.
func (*EpidemicRouting) DispatchingAllowed ¶
func (er *EpidemicRouting) DispatchingAllowed(bp BundleDescriptor) bool
DispatchingAllowed only allows dispatching, iff the bundle is addressed to this Node or if any known CLA without having received this bundle exists.
func (*EpidemicRouting) NotifyNewBundle ¶
func (er *EpidemicRouting) NotifyNewBundle(bp BundleDescriptor)
NotifyNewBundle tells the EpidemicRouting about new bundles.
In our case, the PreviousNodeBlock will be inspected.
func (*EpidemicRouting) ReportFailure ¶
func (er *EpidemicRouting) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
func (*EpidemicRouting) ReportPeerAppeared ¶
func (_ *EpidemicRouting) ReportPeerAppeared(_ cla.Convergence)
func (*EpidemicRouting) ReportPeerDisappeared ¶
func (_ *EpidemicRouting) ReportPeerDisappeared(_ cla.Convergence)
func (*EpidemicRouting) SenderForBundle ¶
func (er *EpidemicRouting) SenderForBundle(bp BundleDescriptor) (css []cla.ConvergenceSender, del bool)
SenderForBundle returns the Core's ConvergenceSenders.
func (*EpidemicRouting) String ¶
func (_ *EpidemicRouting) String() string
type IdKeeper ¶
type IdKeeper struct {
// contains filtered or unexported fields
}
IdKeeper keeps track of the creation timestamp's sequence number for outbounding bundles.
type Pipeline ¶
type Pipeline struct { NodeId bpv7.EndpointID Store *storage.Store Algorithm Algorithm AgentManager AgentManager // Checks to be passed in the initial processing. Checks []CheckFunc // SendReports only for the allowed bpv7.StatusInformationPos. SendReports map[bpv7.StatusInformationPos]bool // contains filtered or unexported fields }
type Prophet ¶
type Prophet struct {
// contains filtered or unexported fields
}
func NewProphet ¶
func NewProphet(c *Core, config ProphetConfig) *Prophet
func (*Prophet) DispatchingAllowed ¶
func (prophet *Prophet) DispatchingAllowed(_ BundleDescriptor) bool
TODO: dummy implementation
func (*Prophet) NotifyNewBundle ¶
func (prophet *Prophet) NotifyNewBundle(bp BundleDescriptor)
func (*Prophet) ReportFailure ¶
func (prophet *Prophet) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
func (*Prophet) ReportPeerAppeared ¶
func (prophet *Prophet) ReportPeerAppeared(peer cla.Convergence)
func (*Prophet) ReportPeerDisappeared ¶
func (prophet *Prophet) ReportPeerDisappeared(peer cla.Convergence)
func (*Prophet) SenderForBundle ¶
func (prophet *Prophet) SenderForBundle(bp BundleDescriptor) (sender []cla.ConvergenceSender, delete bool)
type ProphetConfig ¶
type ProphetConfig struct { // PInit ist the prophet initialisation constant PInit float64 // Beta is the prophet scaling factor for transitive predictability Beta float64 // Gamma is the prophet ageing factor Gamma float64 // AgeInterval is the duration after which entries are aged AgeInterval string }
type RoutingConf ¶
type RoutingConf struct { // Algorithm is one of the implemented routing algorithms. // // One of: "epidemic", "spray", "binary_spray", "dtlsr", "prophet", "sensor-mule" Algorithm string // SprayConf contains data to initialize "spray" or "binary_spray" SprayConf SprayConfig // DTLSRConf contains data to initialize "dtlsr" DTLSRConf DTLSRConfig // ProphetConf contains data to initialize "prophet" ProphetConf ProphetConfig // SensorNetworkMuleConfig contains data to initialize "sensor-mule" SensorMuleConf SensorNetworkMuleConfig `toml:"sensor-mule-conf"` }
RoutingConf contains necessary configuration data to initialize a routing algorithm.
func (RoutingConf) RoutingAlgorithm ¶
func (routingConf RoutingConf) RoutingAlgorithm(c *Core) (algo Algorithm, err error)
RoutingAlgorithm from its configuration.
type SensorNetworkMuleConfig ¶
type SensorNetworkMuleConfig struct { Algorithm *RoutingConf `toml:"routing"` SensorNodeRegex string `toml:"sensor-node-regex"` }
SensorNetworkMuleConfig describes a SensorNetworkMuleRouting.
type SensorNetworkMuleRouting ¶
type SensorNetworkMuleRouting struct {
// contains filtered or unexported fields
}
SensorNetworkMuleRouting is a simple proxy routing algorithm for data mules in specific sensor networks.
This type of sensor network is constructed in such a way that several unconnected sensors exist in an area. In addition, there is a permanently connected server to which sensor data should be sent. For the connection there are data mules, which are travelling between sensors and server.
Addressing within the network is based on the "dtn" URI scheme, compare bpv7.DtnEndpoint. The role of the node can be determined from the node name, e.g., "dtn://tree23.sensor/" is a sensor. The node naming syntax is configurable.
This algorithm is exclusively for data mules. No completely new algorithm is defined here, but an existing one is used, such as epidemic routing. The only difference is that the selection of the receiving nodes is limited so that sensors do not receive other sensors' data. A data mule therefore only receives data from sensors or forwards bundles to sensors that are addressed to them, such as receipt confirmations as administrative records.
func NewSensorNetworkMuleRouting ¶
func NewSensorNetworkMuleRouting(algorithm Algorithm, sensorNode *regexp.Regexp) *SensorNetworkMuleRouting
NewSensorNetworkMuleRouting based on an underlying algorithm and a regex to identify sensor nodes by their Node ID.
func (*SensorNetworkMuleRouting) DispatchingAllowed ¶
func (snm *SensorNetworkMuleRouting) DispatchingAllowed(bp BundleDescriptor) bool
DispatchingAllowed if the underlying algorithm says so.
func (*SensorNetworkMuleRouting) NotifyNewBundle ¶
func (snm *SensorNetworkMuleRouting) NotifyNewBundle(bp BundleDescriptor)
NotifyNewBundle will be handled by the underlying algorithm.
func (*SensorNetworkMuleRouting) ReportFailure ¶
func (snm *SensorNetworkMuleRouting) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
ReportFailure back to the underlying algorithm.
func (*SensorNetworkMuleRouting) ReportPeerAppeared ¶
func (snm *SensorNetworkMuleRouting) ReportPeerAppeared(peer cla.Convergence)
ReportPeerAppeared to the underlying algorithm.
func (*SensorNetworkMuleRouting) ReportPeerDisappeared ¶
func (snm *SensorNetworkMuleRouting) ReportPeerDisappeared(peer cla.Convergence)
ReportPeerDisappeared to the underlying algorithm.
func (*SensorNetworkMuleRouting) SenderForBundle ¶
func (snm *SensorNetworkMuleRouting) SenderForBundle(bp BundleDescriptor) (sender []cla.ConvergenceSender, delete bool)
SenderForBundle queries the underlying algorithm and optionally filters the result.
func (*SensorNetworkMuleRouting) String ¶
func (snm *SensorNetworkMuleRouting) String() string
type SprayAndWait ¶
type SprayAndWait struct {
// contains filtered or unexported fields
}
SprayAndWait implements the vanilla Spray and Wait routing protocol In this case, the bundle originator distributes all Multiplicity copies themselves
func NewSprayAndWait ¶
func NewSprayAndWait(c *Core, config SprayConfig) *SprayAndWait
NewSprayAndWait creates new instance of SprayAndWait
func (*SprayAndWait) DispatchingAllowed ¶
func (_ *SprayAndWait) DispatchingAllowed(_ BundleDescriptor) bool
DispatchingAllowed allows the processing of all packages.
func (*SprayAndWait) GarbageCollect ¶
func (sw *SprayAndWait) GarbageCollect()
GarbageCollect performs periodical cleanup of Bundle metadata
func (*SprayAndWait) NotifyNewBundle ¶
func (sw *SprayAndWait) NotifyNewBundle(bp BundleDescriptor)
NotifyNewBundle tells the routing algorithm about new bundles.
In this case, we simply check if we originated this bundle and set Multiplicity if we did If we are not the originator, we don't further distribute the bundle
func (*SprayAndWait) ReportFailure ¶
func (sw *SprayAndWait) ReportFailure(bp BundleDescriptor, sender cla.ConvergenceSender)
ReportFailure re-increments remaining copies if delivery was unsuccessful.
func (*SprayAndWait) ReportPeerAppeared ¶
func (_ *SprayAndWait) ReportPeerAppeared(_ cla.Convergence)
func (*SprayAndWait) ReportPeerDisappeared ¶
func (_ *SprayAndWait) ReportPeerDisappeared(_ cla.Convergence)
func (*SprayAndWait) SenderForBundle ¶
func (sw *SprayAndWait) SenderForBundle(bp BundleDescriptor) (css []cla.ConvergenceSender, del bool)
SenderForBundle returns the Core's ConvergenceSenders. The bundle's originator will distribute Multiplicity copies amongst its peers Forwarders will only every deliver the bundle to its final destination
type SprayConfig ¶
type SprayConfig struct { // Multiplicity is the number of copies of a bundle which are sprayed Multiplicity uint64 }
type Tag ¶
type Tag uint64
Tag describes a bpv7.Bundle / BundleDescriptor.
const ( // Incoming Bundle received from another node. Incoming Tag // Outgoing Bundle originated at this node. Outgoing // Faulty Bundle, e.g., because some CheckFunc failed. This will lead to deletion. Faulty // ReassemblyPending is a fragmented, Incoming Bundle which needs to be reassembled before local delivery. ReassemblyPending // NoLocalAgent is an Incoming Bundle addressed to this node with an unregistered EndpointID. NoLocalAgent // Delivered Bundle to all recipients. Delivered )