Squashed 'libs/CommService/' content from commit 7ccc0fc
git-subtree-dir: libs/CommService git-subtree-split: 7ccc0fce88bbc5969df060058cf0fb57abe3bcf9
This commit is contained in:
62
include/CommService/PayLoads/Ping.hpp
Normal file
62
include/CommService/PayLoads/Ping.hpp
Normal file
@@ -0,0 +1,62 @@
|
||||
#ifndef __PAYLOADS_PING__
|
||||
#define __PAYLOADS_PING__
|
||||
/*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
* @brief main header file for the BC::Payloads::Ping payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-06
|
||||
* @copyright 2019 no yet defined
|
||||
*/
|
||||
#include <CommService/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <random>
|
||||
|
||||
namespace CommService
|
||||
{
|
||||
|
||||
namespace PayLoads
|
||||
{
|
||||
/**
|
||||
* @brief class representing the payload of a Ping message
|
||||
*
|
||||
* the Ping messages is transmitted can be published to all or individual nodes.
|
||||
* these nodes will answer with a Pong message
|
||||
*
|
||||
*/
|
||||
class Ping : public transmittable
|
||||
{
|
||||
public:
|
||||
Ping();
|
||||
/**
|
||||
* @brief constructor to recreate the HotPlugJoin payload from a a std::vector<unsigned char>
|
||||
*/
|
||||
explicit Ping(std::vector<unsigned char> v);
|
||||
|
||||
/// message id uniqly identifying one ping message
|
||||
uint64_t messageID;
|
||||
|
||||
/// the sequence number of the ping
|
||||
uint64_t sequenceNr;
|
||||
|
||||
/// the local clock ticks
|
||||
uint64_t pingTime;
|
||||
|
||||
/**
|
||||
* @brief converts the information of the class (the attributes) to a byte vector
|
||||
*
|
||||
* @param byteVector - returns a std::vector of bytes representing the class
|
||||
*/
|
||||
std::vector<unsigned char> toByteVector() const override;
|
||||
};
|
||||
}; //namespace Payloads
|
||||
}; //namespace BC
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user