GHS
Leader Election Based on GHS Minimum Spanning Tree
Classes | Typedefs | Enumerations | Functions | Variables
demo Namespace Reference

Classes

class  Comms
 a message passing class that uses nng, suitable for testing GhsState More...
 
struct  Config
 A struct that holds the union of all configuration variables. More...
 
struct  Control
 a structure that contains control information for WireMessage objects More...
 
class  GhsDemoExec
 The main demo logic for executing le::ghs::GhsState across a network More...
 
struct  Header
 a structure that defines source and destination for WireMessage objects More...
 
struct  WireMessage
 A wire-ready message structure that can encapsulate a variety of payloads for sending across the wire to an endpoint. More...
 

Typedefs

typedef uint64_t OptMask
 
typedef uint16_t Destination
 
typedef size_t SequenceCounter
 

Enumerations

enum  Errno {
  OK = 0, ERR_BAD_PAYLOAD_SZ, ERR_NO_PAYLOAD_TYPE, ERR_UNRECOGNIZED_PAYLOAD_TYPE,
  ERR_NULL_SRC, ERR_DEST_UNSET, ERR_HANGUP, ERR_NNG
}
 return codes for the Comms object More...
 
enum  PayloadType {
  PAYLOAD_TYPE_NOT_SET =0, PAYLOAD_TYPE_CONTROL, PAYLOAD_TYPE_METRICS, PAYLOAD_TYPE_PING,
  PAYLOAD_TYPE_GHS
}
 the payload type More...
 

Functions

void read_cfg_cli (int argc, char **argv, Config *config)
 
bool cfg_is_ok (Config config)
 
void read_cfg_file (const char *fname, Config *c)
 
void read_cfg_stdin (Config *c)
 
template<size_t AN, size_t QN>
GhsState< AN, QN > initialize_ghs (Config &cfg, Comms &c)
 Helper function to build edges from configuration information.
 
int do_test_and_die (Comms &comms, Config &config)
 Run a quick little_iperf() round to check connectivity.
 

Variables

const char * argp_program_bug_address = "Joshua Vander Hook <hook@jpl.nasa.gov>"
 for argp
 

Detailed Description

The demo:: namespace contains all the classes and structures for the ghs-demo executable

Typedef Documentation

◆ Destination

typedef uint16_t demo::Destination

A two-byte header field that determines where the message is destined This is different than agent_t (or maybe it is not – your call!).

◆ OptMask

typedef uint64_t demo::OptMask

Reserved and not implemented yet. Any value is OK.

◆ SequenceCounter

typedef size_t demo::SequenceCounter

All outgoing messages have a sequence, since the network layer abstractions guarantee eventual delivery, but not unique delivery, and GhsState is sensitive to duplicated messages.

Enumeration Type Documentation

◆ Errno

return codes for the Comms object

Enumerator
OK 

No error.

ERR_BAD_PAYLOAD_SZ 

Incorrect or no payload size.

ERR_NO_PAYLOAD_TYPE 

Payload type not specified.

ERR_UNRECOGNIZED_PAYLOAD_TYPE 

Payload type unrecognized.

ERR_NULL_SRC 

Bad from field or not set.

ERR_DEST_UNSET 

Bad or unspecified Destination.

ERR_HANGUP 

Connection was lost.

ERR_NNG 

NNG returned an error code, please see logging output.

◆ PayloadType

the payload type

Enumerator
PAYLOAD_TYPE_NOT_SET 

Not set (produces error)

PAYLOAD_TYPE_CONTROL 

Control message are for resetting internal state or commanding.

PAYLOAD_TYPE_METRICS 

Metrics messages are for exchanging data about links.

PAYLOAD_TYPE_PING 

Ping messages are used to benchmark links to gather metrics.

PAYLOAD_TYPE_GHS 

message was intended for GHS, don't process, just send it

Function Documentation

◆ cfg_is_ok()

bool demo::cfg_is_ok ( Config  config)

Checks to make sure the values populated in the config are sane

Returns
true if it is ok
false if not

Validate the config file, and return 'false' if the config is misread (some variable unset) or has semantic errors. For example if my_id is >= num_agents, or is <0.

◆ read_cfg_cli()

void demo::read_cfg_cli ( int  argc,
char **  argv,
Config c 
)

Populates config variables based on command line switches. Uses arpg.h. See ghs-demo-clireader.cpp

◆ read_cfg_file()

void demo::read_cfg_file ( const char *  fname,
Config c 
)

Reads the config from an ini-formatted file (if you compiled in ghs-demo-inireader.cpp, but you are free to implement this function however you see fit if not

◆ read_cfg_stdin()

void demo::read_cfg_stdin ( Config c)

Reads the config from an ini-formatted file that is piped over stdin (if you compiled in ghs-demo-inireader.cpp, but you are free to implement this function however you see fit if not)

Like this:

< some_cfg.ini ghs-demo [other switches / args]