Back to Site
Loading...
Searching...
No Matches
librats Namespace Reference

Namespaces

namespace  framer
 

Classes

struct  Address
 
class  Bittorrent
 
class  ByteSpan
 Non-owning view over a contiguous run of writable bytes. More...
 
class  ByteView
 Non-owning view over a contiguous run of bytes. More...
 
class  CircuitService
 
class  DhtDiscovery
 
struct  DhtService
 
class  DialService
 
class  EventBus
 
class  ExternalAddressService
 The read side, published in the node's ServiceRegistry so a NAT-traversal module can consult it without holding the Node: More...
 
class  FileTransfer
 
struct  Frame
 A decoded inner message. payload is a non-owning view into the source bytes. More...
 
struct  FrameHeader
 Fixed header of an inner message. More...
 
class  HolePunch
 Published as HolePunchService, so a module that discovers a peer it cannot dial (PeerExchange) can hand the id over without depending on this class. More...
 
struct  HolePunchService
 
class  Json
 
class  JsonError
 Thrown by the throwing parse path and by type-mismatched accessors. More...
 
class  MdnsDiscovery
 
class  MessageJson
 
class  NatStatus
 
class  Node
 
struct  NodeConfig
 
struct  NodeContext
 
class  Peer
 
class  PeerExchange
 
class  PeerId
 
struct  PeerInfo
 
class  PeerNetwork
 
class  PingService
 
struct  PortMappingConfig
 Configuration for automatic port forwarding (see PortMappingService). More...
 
class  PortMappingService
 Maps the node's TCP listen port through the home router via UPnP and/or NAT-PMP. More...
 
struct  PortMapResult
 Result of a port mapping attempt. More...
 
class  PubSub
 
class  ReconnectionService
 
class  Relay
 
struct  RelayService
 
class  ServiceRegistry
 
struct  StorageChangeEvent
 Storage change event - passed to change callbacks. More...
 
struct  StorageConfig
 Storage configuration. More...
 
struct  StorageEntry
 Storage entry - represents a single key-value pair in the database. More...
 
class  StorageManager
 StorageManager - Distributed key-value storage with peer synchronization. More...
 
struct  StorageStatistics
 Storage statistics. More...
 
class  Subsystem
 A pluggable network subsystem. More...
 

Typedefs

using StorageChangeCallback = std::function< void(const StorageChangeEvent &)>
 Callback function types for storage events.
 
using StorageSyncCompleteCallback = std::function< void(bool success, const std::string &error_message)>
 
using Bytes = std::vector< uint8_t >
 
using PortMapCallback = std::function< void(const PortMapResult &)>
 Callback invoked whenever a mapping is established, refreshed, removed or fails.
 

Enumerations

enum  PeerTransports : uint8_t { PeerTransportNone = 0 , PeerTransportTcp = 1 << 0 , PeerTransportUdp = 1 << 1 }
 Transports a peer says it accepts, as a bitmask (see IdentifyMessage). More...
 
enum class  MessageType : uint8_t {
  App = 1 , Control = 2 , Gossip = 3 , FileChunk = 4 ,
  Ping = 5 , Storage = 6 , Typed = 7 , Pex = 8 ,
  Punch = 9 , Relay = 10
}
 Inner-message kind. Application traffic uses App, addressed by channel. More...
 
enum class  ValidationResult { Accept , Reject , Ignore }
 Outcome of validating an inbound published message before it is delivered or forwarded. More...
 
enum class  StorageValueType : uint8_t {
  BINARY = 0x01 , STRING = 0x02 , INT64 = 0x03 , DOUBLE = 0x04 ,
  JSON = 0x05
}
 Value types supported by the distributed storage. More...
 
enum class  StorageOperation : uint8_t { OP_PUT = 0x01 , OP_DELETE = 0x02 }
 Storage operation types for change events. More...
 
enum class  StorageSyncStatus { NOT_STARTED , IN_PROGRESS , COMPLETED , FAILED }
 Storage synchronization status. More...
 
enum class  NatMapping : uint8_t { Unknown , Open , EndpointIndependent , EndpointDependent }
 How the NAT in front of our shared datagram socket maps it, as far as the mesh has been able to show. More...
 
enum class  PortMapProtocol : uint8_t { TCP , UDP }
 Transport protocol of a port mapping. More...
 
enum class  PortMapTransport : uint8_t { UPnP , NatPMP }
 Which NAT traversal backend produced a result. More...
 

Functions

uint32_t storage_calculate_crc32 (const void *data, size_t length)
 
std::string storage_value_type_to_string (StorageValueType type)
 
StorageValueType string_to_storage_value_type (const std::string &str)
 
const char * to_string (NatMapping) noexcept
 
std::istream & operator>> (std::istream &is, Json &j)
 
std::ostream & operator<< (std::ostream &os, const Json &j)
 
const char * to_string (PortMapProtocol p)
 Human readable protocol name ("TCP"/"UDP").
 
const char * to_string (PortMapTransport t)
 Human readable transport name ("UPnP"/"NAT-PMP").
 

Typedef Documentation

◆ Bytes

using librats::Bytes = typedef std::vector<uint8_t>

Definition at line 24 of file bytes.h.

◆ PortMapCallback

using librats::PortMapCallback = typedef std::function<void(const PortMapResult&)>

Callback invoked whenever a mapping is established, refreshed, removed or fails.

Always called from the backend's own worker thread.

Definition at line 64 of file port_mapping.h.

◆ StorageChangeCallback

using librats::StorageChangeCallback = typedef std::function<void(const StorageChangeEvent&)>

Callback function types for storage events.

Definition at line 247 of file storage.h.

◆ StorageSyncCompleteCallback

using librats::StorageSyncCompleteCallback = typedef std::function<void(bool success, const std::string& error_message)>

Definition at line 248 of file storage.h.

Enumeration Type Documentation

◆ MessageType

enum class librats::MessageType : uint8_t
strong

Inner-message kind. Application traffic uses App, addressed by channel.

Enumerator
App 
Control 

core control plane (peer exchange…)

Gossip 
FileChunk 
Ping 

liveness / RTT (PingService)

Storage 

distributed key-value store (StorageManager)

Typed 

typed JSON message exchange (MessageJson)

Pex 

peer exchange — gossip of known peer addresses (PeerExchange)

Punch 

NAT hole-punch rendezvous, relayed peer→peer (HolePunch)

Relay 

relayed circuits: a peer's connection carried through a third node (Relay)

Definition at line 39 of file frame.h.

◆ NatMapping

enum class librats::NatMapping : uint8_t
strong

How the NAT in front of our shared datagram socket maps it, as far as the mesh has been able to show.

Enumerator
Unknown 

not enough independent observations yet

Open 

no NAT: peers see us at an address we hold ourselves

EndpointIndependent 

one external port for every destination — punchable

EndpointDependent 

a fresh mapping per destination (symmetric) — not punchable

Definition at line 50 of file nat_status.h.

◆ PeerTransports

enum librats::PeerTransports : uint8_t

Transports a peer says it accepts, as a bitmask (see IdentifyMessage).

Kept separate from transport, which is the one this connection actually uses.

Enumerator
PeerTransportNone 
PeerTransportTcp 
PeerTransportUdp 

Definition at line 22 of file peer_info.h.

◆ PortMapProtocol

enum class librats::PortMapProtocol : uint8_t
strong

Transport protocol of a port mapping.

Enumerator
TCP 
UDP 

Definition at line 22 of file port_mapping.h.

◆ PortMapTransport

enum class librats::PortMapTransport : uint8_t
strong

Which NAT traversal backend produced a result.

Enumerator
UPnP 
NatPMP 

Definition at line 28 of file port_mapping.h.

◆ StorageOperation

enum class librats::StorageOperation : uint8_t
strong

Storage operation types for change events.

Enumerator
OP_PUT 
OP_DELETE 

Definition at line 89 of file storage.h.

◆ StorageSyncStatus

enum class librats::StorageSyncStatus
strong

Storage synchronization status.

Enumerator
NOT_STARTED 
IN_PROGRESS 
COMPLETED 
FAILED 

Definition at line 97 of file storage.h.

◆ StorageValueType

enum class librats::StorageValueType : uint8_t
strong

Value types supported by the distributed storage.

Enumerator
BINARY 
STRING 
INT64 
DOUBLE 
JSON 

Definition at line 78 of file storage.h.

◆ ValidationResult

enum class librats::ValidationResult
strong

Outcome of validating an inbound published message before it is delivered or forwarded.

REJECT drops it (and would penalise the sender in a scored build); IGNORE drops it silently; ACCEPT delivers locally and forwards along the mesh.

Enumerator
Accept 
Reject 
Ignore 

Definition at line 57 of file pubsub.h.

Function Documentation

◆ operator<<()

std::ostream & librats::operator<< ( std::ostream &  os,
const Json j 
)

◆ operator>>()

std::istream & librats::operator>> ( std::istream &  is,
Json j 
)

◆ storage_calculate_crc32()

uint32_t librats::storage_calculate_crc32 ( const void *  data,
size_t  length 
)

◆ storage_value_type_to_string()

std::string librats::storage_value_type_to_string ( StorageValueType  type)

◆ string_to_storage_value_type()

StorageValueType librats::string_to_storage_value_type ( const std::string &  str)

◆ to_string() [1/3]

const char * librats::to_string ( NatMapping  )
noexcept

◆ to_string() [2/3]

const char * librats::to_string ( PortMapProtocol  p)
inline

Human readable protocol name ("TCP"/"UDP").

Definition at line 34 of file port_mapping.h.

References TCP.

◆ to_string() [3/3]

const char * librats::to_string ( PortMapTransport  t)
inline

Human readable transport name ("UPnP"/"NAT-PMP").

Definition at line 39 of file port_mapping.h.

References UPnP.