GHS
Leader Election Based on GHS Minimum Spanning Tree
Classes | Namespaces | Macros | Typedefs | Enumerations
ghs-demo-comms.h File Reference

contains all the wire-level data structures and the Comms object to manage them. More...

#include "ghs-demo-config.h"
#include "ghs-demo-msgutils.h"
#include "ghs-demo-edgemetrics.h"
#include "seque/static_queue.h"
#include <nng/nng.h>
#include <cstring>
#include <unordered_map>
#include <vector>
#include <thread>
#include <mutex>

Go to the source code of this file.

Classes

struct  demo::Header
 a structure that defines source and destination for WireMessage objects More...
 
struct  demo::Control
 a structure that contains control information for WireMessage objects More...
 
struct  demo::WireMessage
 A wire-ready message structure that can encapsulate a variety of payloads for sending across the wire to an endpoint. More...
 
class  demo::Comms
 a message passing class that uses nng, suitable for testing GhsState More...
 

Namespaces

 demo
 

Macros

#define COMMS_DEMO_MAX_N   8
 The max number of agents to demonstrate.
 
#define PAYLOAD_MAX_SZ   1024
 The max size of the payload to send over the wire.
 
#define MESSAGE_DEST_UNSET   -1
 

Typedefs

typedef uint64_t demo::OptMask
 
typedef uint16_t demo::Destination
 
typedef size_t demo::SequenceCounter
 

Enumerations

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

Detailed Description

contains all the wire-level data structures and the Comms object to manage them.

Copyright (c) 2022 California Institute of Technology (“Caltech”). U.S. Government sponsorship acknowledged.

All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.