Table of Contents

Class SeenPackets

Namespace
Pamoja.Mesh
Assembly
Pamoja.Mesh.dll

A memory of recently seen packets, so a node relays each one only once.

public sealed class SeenPackets : IDisposable
Inheritance
SeenPackets
Implements
Inherited Members

Remarks

Without one, a flood multiplies without bound. The core cache is generic over its size, which cannot cross the C ABI, so this one is sized when it is built.

Constructors

SeenPackets(int)

Creates an empty cache.

public SeenPackets(int capacity = 64)

Parameters

capacity int

How many recently seen packets to remember. A capacity of 0 remembers nothing, so every copy of a packet is relayed.

Exceptions

PamojaException

The native cache could not be created.

Properties

Capacity

How many packets this cache remembers.

public int Capacity { get; }

Property Value

int

Methods

Contains(uint, ushort)

Reports whether a packet is remembered, without recording it.

public bool Contains(uint src, ushort id)

Parameters

src uint

The address the packet came from.

id ushort

The sequence number the packet carries.

Returns

bool

Whether the packet has been seen recently.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Record(uint, ushort)

Records a packet and reports whether it was new.

public bool Record(uint src, ushort id)

Parameters

src uint

The address the packet came from.

id ushort

The sequence number the packet carries.

Returns

bool

true when the packet had not been seen, which is when a node should act on it and relay it, and false for a duplicate.