GHS
Leader Election Based on GHS Minimum Spanning Tree
|
Go to the documentation of this file.
41 #ifndef GHS_DEMO_COMMS
42 #define GHS_DEMO_COMMS
49 #include <unordered_map>
54 #ifndef COMMS_DEMO_MAX_N
55 #define COMMS_DEMO_MAX_N 8
59 #ifndef PAYLOAD_MAX_SZ
60 #define PAYLOAD_MAX_SZ 1024
112 #define MESSAGE_DEST_UNSET -1
302 void validate_sockets();
310 nng_listener ctr_listener = NNG_LISTENER_INITIALIZER;
311 nng_listener ghs_listener = NNG_LISTENER_INITIALIZER;
312 nng_socket incoming=NNG_SOCKET_INITIALIZER;
313 nng_socket outgoing=NNG_SOCKET_INITIALIZER;
315 std::array<size_t,COMMS_DEMO_MAX_N> sequence_counters;
316 std::array<Kbps,COMMS_DEMO_MAX_N> kbps;
319 std::thread reader_thread;
Control control
Msg control information.
Definition: ghs-demo-comms.h:173
Provides some convenience functions for dealing with demo::WireMessage buffers.
void little_iperf()
Definition: ghs-demo-comms.cpp:381
A wire-ready message structure that can encapsulate a variety of payloads for sending across the wire...
Definition: ghs-demo-comms.h:168
@ ERR_BAD_PAYLOAD_SZ
Incorrect or no payload size.
Definition: ghs-demo-comms.h:74
provides the main comms metric calculation.
Comms & with_config(Config &)
Definition: ghs-demo-comms.cpp:133
@ ERR_DEST_UNSET
Bad or unspecified Destination.
Definition: ghs-demo-comms.h:78
uint64_t OptMask
Definition: ghs-demo-comms.h:105
Errno
return codes for the Comms object
Definition: ghs-demo-comms.h:72
uint32_t Kbps
a 32 bit throughput measuremeng. 32 bits is important!
Definition: ghs-demo-edgemetrics.h:50
void print_iperf()
Definition: ghs-demo-comms.cpp:407
a static-sized single-ended queue for use in GhsState
void exchange_iperf()
Definition: ghs-demo-comms.cpp:355
SequenceCounter sequence
The sequence counter used to avoid duplicates or detect lost messagesa.
Definition: ghs-demo-comms.h:156
Definition: ghs-demo-clireader.cpp:44
@ ERR_HANGUP
Connection was lost.
Definition: ghs-demo-comms.h:79
a message passing class that uses nng, suitable for testing GhsState
Definition: ghs-demo-comms.h:199
@ ERR_NNG
NNG returned an error code, please see logging output.
Definition: ghs-demo-comms.h:80
Header header
Msg meta information.
Definition: ghs-demo-comms.h:175
@ PAYLOAD_TYPE_GHS
message was intended for GHS, don't process, just send it
Definition: ghs-demo-comms.h:93
void start_receiver()
Definition: ghs-demo-comms.cpp:472
#define PAYLOAD_MAX_SZ
The max size of the payload to send over the wire.
Definition: ghs-demo-comms.h:61
uint8_t bytes[PAYLOAD_MAX_SZ]
The actual payload to send. Note only the first N=demo::WireMessageHeader::payload_size will be sent ...
Definition: ghs-demo-comms.h:177
A struct that holds the union of all configuration variables.
Definition: ghs-demo-config.h:64
@ PAYLOAD_TYPE_METRICS
Metrics messages are for exchanging data about links.
Definition: ghs-demo-comms.h:91
contains all the Config objects and methods for configuring demo::Comms
void stop_receiver()
Definition: ghs-demo-comms.cpp:477
size_t SequenceCounter
Definition: ghs-demo-comms.h:122
size_t size() const
Definition: ghs-demo-comms.h:182
@ ERR_UNRECOGNIZED_PAYLOAD_TYPE
Payload type unrecognized.
Definition: ghs-demo-comms.h:76
uint16_t Destination
Definition: ghs-demo-comms.h:111
CommsEdgeMetric unique_link_metric_to(const uint16_t agent_id) const
This function is really important for the working of your system
Definition: ghs-demo-comms.cpp:483
@ PAYLOAD_TYPE_NOT_SET
Not set (produces error)
Definition: ghs-demo-comms.h:89
bool has_msg()
Definition: ghs-demo-comms.cpp:295
bool get_next(demo::WireMessage &)
Definition: ghs-demo-comms.cpp:300
@ ERR_NO_PAYLOAD_TYPE
Payload type not specified.
Definition: ghs-demo-comms.h:75
a structure that contains control information for WireMessage objects
Definition: ghs-demo-comms.h:151
Kbps kbps_to(const uint16_t agent_id) const
Definition: ghs-demo-comms.cpp:489
@ PAYLOAD_TYPE_PING
Ping messages are used to benchmark links to gather metrics.
Definition: ghs-demo-comms.h:92
@ PAYLOAD_TYPE_CONTROL
Control message are for resetting internal state or commanding.
Definition: ghs-demo-comms.h:90
Errno send(demo::WireMessage &, demo::OptMask=0)
Definition: ghs-demo-comms.cpp:336
@ ERR_NULL_SRC
Bad from field or not set.
Definition: ghs-demo-comms.h:77
PayloadType
the payload type
Definition: ghs-demo-comms.h:87
@ OK
No error.
Definition: ghs-demo-comms.h:73
uint64_t CommsEdgeMetric
a 64-bit edge metric. 64 bits is important!
Definition: ghs-demo-edgemetrics.h:45