Squashed 'libs/CommService/' content from commit 7ccc0fc
git-subtree-dir: libs/CommService git-subtree-split: 7ccc0fce88bbc5969df060058cf0fb57abe3bcf9
This commit is contained in:
63
libs/libbattle-com/include/BC/Payloads/HotPlugJoin.hpp
Normal file
63
libs/libbattle-com/include/BC/Payloads/HotPlugJoin.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef __LIBBC_BC_PAYLOADS_HOTPLUGJOIN_HPP__
|
||||
#define __LIBBC_BC_PAYLOADS_HOTPLUGJOIN_HPP__
|
||||
/*
|
||||
* 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::HotPlugJoin payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-03
|
||||
* @copyright 2019 no yet defined
|
||||
*/
|
||||
#include <BC/BC.hpp>
|
||||
#include <BC/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace BC
|
||||
{
|
||||
namespace Payloads
|
||||
{
|
||||
/**
|
||||
* @brief class representing the payload of a HotPlugJoin message
|
||||
*
|
||||
* the HotPlugJoin messages is transmitted by every PubSub Service after connection
|
||||
* has been established to the underlying network/transport layer.
|
||||
* It provides information about the type of service, the id and the underlying
|
||||
* network/transport layer addresses.
|
||||
*
|
||||
*/
|
||||
class HotPlugJoin : public BC::transmittable
|
||||
{
|
||||
public:
|
||||
HotPlugJoin()=default;
|
||||
/**
|
||||
* @brief constructor to recreate the HotPlugJoin payload from a a std::vector<unsigned char>
|
||||
*/
|
||||
explicit HotPlugJoin(std::vector<unsigned char> v);
|
||||
|
||||
/// the address of the underlying network layer used to join the network
|
||||
unsigned char networkLayerAddress[16];
|
||||
|
||||
/// the address of the underlying transport layer used to join the network
|
||||
uint32_t transportLayerAddress;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
63
libs/libbattle-com/include/BC/Payloads/HotPlugLeave.hpp
Normal file
63
libs/libbattle-com/include/BC/Payloads/HotPlugLeave.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef __LIBBC_BC_PAYLOADS_HOTPLUGLEAVE_HPP__
|
||||
#define __LIBBC_BC_PAYLOADS_HOTPLUGLEAVE_HPP__
|
||||
/*
|
||||
* 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::HotPlugLeave payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-05
|
||||
* @copyright 2019 no yet defined
|
||||
*/
|
||||
#include <BC/BC.hpp>
|
||||
#include <BC/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace BC
|
||||
{
|
||||
namespace Payloads
|
||||
{
|
||||
/**
|
||||
* @brief class representing the payload of a HotPlugLeave message
|
||||
*
|
||||
* the HotPlugLeave messages is transmitted by every PubSub Service before disconnecting
|
||||
* from the network.
|
||||
* It provides information about the type of service, the id and the underlying
|
||||
* network/transport layer addresses.
|
||||
*
|
||||
*/
|
||||
class HotPlugLeave : public BC::transmittable
|
||||
{
|
||||
public:
|
||||
HotPlugLeave()=default;
|
||||
/**
|
||||
* @brief constructor to recreate the HotPlugJoin payload from a a std::vector<unsigned char>
|
||||
*/
|
||||
explicit HotPlugLeave(std::vector<unsigned char> v);
|
||||
|
||||
/// the address of the underlying network layer used to join the network
|
||||
unsigned char networkLayerAddress[16];
|
||||
|
||||
/// the address of the underlying transport layer used to join the network
|
||||
uint32_t transportLayerAddress;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @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
|
||||
63
libs/libbattle-com/include/BC/Payloads/Ping.hpp
Normal file
63
libs/libbattle-com/include/BC/Payloads/Ping.hpp
Normal file
@@ -0,0 +1,63 @@
|
||||
#ifndef __LIBBC_BC_PAYLOADS_PING_HPP__
|
||||
#define __LIBBC_BC_PAYLOADS_PING_HPP__
|
||||
/*
|
||||
* 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 <BC/BC.hpp>
|
||||
#include <BC/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <random>
|
||||
|
||||
namespace BC
|
||||
{
|
||||
|
||||
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 BC::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
|
||||
60
libs/libbattle-com/include/BC/Payloads/Pong.hpp
Normal file
60
libs/libbattle-com/include/BC/Payloads/Pong.hpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#ifndef __LIBBC_BC_PAYLOADS_PONG_HPP__
|
||||
#define __LIBBC_BC_PAYLOADS_PONG_HPP__
|
||||
/*
|
||||
* 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::Pong payload
|
||||
* @author Dominik Meyer <dmeyer@hsu-hh.de>
|
||||
* @date 2019-02-06
|
||||
* @copyright 2019 no yet defined
|
||||
*/
|
||||
#include <BC/BC.hpp>
|
||||
#include <BC/transmittable.hpp>
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
namespace BC
|
||||
{
|
||||
namespace Payloads
|
||||
{
|
||||
/**
|
||||
* @brief class representing the payload of a Pong message
|
||||
*
|
||||
* the Pong messages is the reply to a ping message.
|
||||
*
|
||||
*/
|
||||
class Pong : public BC::transmittable
|
||||
{
|
||||
public:
|
||||
Pong()=default;
|
||||
/**
|
||||
* @brief constructor to recreate the HotPlugJoin payload from a a std::vector<unsigned char>
|
||||
*/
|
||||
explicit Pong(std::vector<unsigned char> v);
|
||||
|
||||
/// message id uniqly identifying one ping message
|
||||
uint64_t pingMessageID;
|
||||
|
||||
/// ping transmission time
|
||||
BC::DataTypes::BCTimeType pingTransmissionTime;
|
||||
|
||||
/// the sequence number of the ping
|
||||
uint64_t sequenceNr;
|
||||
|
||||
/**
|
||||
* @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