2021-05-27 10:59:22 -04:00
|
|
|
|
/*
|
|
|
|
|
sdt.h
|
|
|
|
|
|
|
|
|
|
Copyright (c) 2020 Kevin Matz (kevin.matz@gmail.com)
|
|
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in all
|
|
|
|
|
copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
|
|
SOFTWARE.
|
|
|
|
|
*/
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include <list>
|
|
|
|
|
#include <memory>
|
|
|
|
|
#include <unordered_map>
|
|
|
|
|
#include "component.h"
|
|
|
|
|
#include "pdu.h"
|
|
|
|
|
#include "sdt-udp.h" // EPI 18
|
|
|
|
|
|
|
|
|
|
// ANSI E1.17- 2015, Architecture for Control Networks–
|
|
|
|
|
// Session Data Transport Protocol
|
|
|
|
|
namespace ACN {
|
|
|
|
|
namespace SDT {
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
/**
|
|
|
|
|
* @brief 3.1 Session Identity
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
struct SessionId {
|
|
|
|
|
UUID::uuid cid; // the component ID (CID) of the session leader
|
|
|
|
|
uint16_t number; // the session number the leader has assigned
|
|
|
|
|
uint32_t protocol; // the ID of the protocol carried by the session
|
|
|
|
|
bool operator== (const SessionId &) const;
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 3.3 Sequenced Channels
|
|
|
|
|
* Sequenced channels transport three categories of traffic:
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
enum Direction {
|
|
|
|
|
internal, // SDT internal traffic
|
|
|
|
|
downstream, // Session downstream traffic
|
|
|
|
|
upstream // Session upstream traffic
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
|
// 3.5.1.1 Member Identifiers
|
|
|
|
|
using MID = uint16_t;
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.1.2 Channel Parameter Block
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct params_t
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
uint8_t Expiry; // number of seconds without traffic before leaving
|
|
|
|
|
struct {
|
|
|
|
|
uint8_t NAK_Outbound : 1; // NAK to channel (1) or destination address (0)
|
|
|
|
|
uint8_t reserved : 7;
|
|
|
|
|
};
|
|
|
|
|
uint16_t NAKholdoff; // calculation of a standoff time for sending NAKs
|
|
|
|
|
uint16_t NAKmodulus; // calculation of a standoff time for sending NAKs
|
|
|
|
|
uint16_t NAKmaxwait; // maximum milliseconds to wait before sending a NAK.
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.1 Join
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct join_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
MID mid;
|
|
|
|
|
uint16_t number;
|
|
|
|
|
uint16_t reciprocal;
|
|
|
|
|
uint32_t sequence;
|
|
|
|
|
uint32_t reliable;
|
|
|
|
|
UDP::address_t destination;
|
|
|
|
|
params_t parameters;
|
|
|
|
|
uint8_t expiry;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 0; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override;
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.2 Join Accept
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct join_accept_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
UUID::uuid leader;
|
|
|
|
|
uint16_t number;
|
|
|
|
|
MID mid;
|
|
|
|
|
uint32_t reliable;
|
|
|
|
|
uint16_t reciprocal;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 26; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override;
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.3 Join Refuse & 4.4.4 Leaving
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct join_refuse_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
UUID::uuid leader;
|
|
|
|
|
uint16_t number;
|
|
|
|
|
MID mid;
|
|
|
|
|
uint32_t reliable;
|
|
|
|
|
uint8_t code;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 25; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override;
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.5 NAK
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct nak_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
UUID::uuid leader;
|
|
|
|
|
uint16_t number;
|
|
|
|
|
MID mid;
|
|
|
|
|
uint32_t reliable;
|
|
|
|
|
uint32_t missed_first;
|
|
|
|
|
uint32_t missed_last;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 32; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override;
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.6 Reliable Wrapper and Unreliable Wrapper
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct wrapper_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
uint16_t number;
|
|
|
|
|
uint32_t sequence;
|
|
|
|
|
uint32_t reliable;
|
|
|
|
|
uint32_t oldest;
|
|
|
|
|
MID ack_range_begin;
|
|
|
|
|
MID ack_range_end;
|
|
|
|
|
uint16_t MAK_threshold;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 20; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override;
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.7 SDT Client Block
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct client_pdu_header
|
|
|
|
|
: PDU::pdu_header
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
uint32_t protocol;
|
|
|
|
|
uint16_t association;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-08-09 15:39:35 -04:00
|
|
|
|
size_t streamSize() const override { return 6; };
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override;
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The ClientPdu class
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
class ClientPdu
|
|
|
|
|
: public PDU::Pdu
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-07-29 19:26:49 -04:00
|
|
|
|
ClientPdu();
|
|
|
|
|
void iStream(PDU::Stream) override;
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.8 Get Sessions
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct get_sessions_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
UUID::uuid cid;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 0; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override {};
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.9.1 Channel Owner Info Block
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct channel_info_block_t
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
MID mid;
|
|
|
|
|
UUID::uuid owner;
|
|
|
|
|
uint16_t number;
|
|
|
|
|
UDP::address_t destination;
|
|
|
|
|
UDP::address_t source;
|
|
|
|
|
uint16_t reciprocal;
|
|
|
|
|
uint16_t count;
|
|
|
|
|
std::list<uint32_t> protocols;
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.4.9 Sessions
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct sessions_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
std::list<channel_info_block_t> list;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 0; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override {};
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.5.1 ACK
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct ack_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
uint32_t reliable;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 4; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override {};
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.5.2 Channel Params
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct channel_params_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
params_t parameters;
|
|
|
|
|
UDP::address_t address;
|
|
|
|
|
uint8_t expiry;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 0; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override {};
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.5.3 Connect, 4.5.4 Connect Accept, & 4.5.6 Disconnect
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct connect_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
uint32_t protocol;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
size_t streamSize() const override { return 4; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override {};
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 4.5.5 Connect Refuse & 4.5.7 Disconnecting
|
|
|
|
|
*/
|
2021-08-15 23:36:29 -04:00
|
|
|
|
struct connect_refuse_data_t
|
|
|
|
|
: PDU::pdu_data
|
|
|
|
|
{
|
2021-05-27 10:59:22 -04:00
|
|
|
|
uint32_t protocol;
|
|
|
|
|
uint8_t code;
|
2021-08-15 23:36:29 -04:00
|
|
|
|
|
2021-07-29 23:40:46 -04:00
|
|
|
|
size_t streamSize() const override { return 0; }
|
2021-07-29 19:26:49 -04:00
|
|
|
|
void iStream(PDU::Stream) override {};
|
|
|
|
|
void oStream(PDU::Stream) const override {};
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
/**
|
|
|
|
|
* @brief 7.1 Protocol Code
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
static const uint32_t SDT_PROTOCOL_ID = 1; // PDU protocol value
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 7.2 PDU Vector Codes
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
enum sdt_vector_t {
|
|
|
|
|
REL_WRAP = 1,
|
|
|
|
|
UNREL_WRAP = 2,
|
|
|
|
|
CHANNEL_PARAMS = 3,
|
|
|
|
|
JOIN = 4,
|
|
|
|
|
JOIN_REFUSE = 5,
|
|
|
|
|
JOIN_ACCEPT = 6,
|
|
|
|
|
LEAVE = 7,
|
|
|
|
|
LEAVING = 8,
|
|
|
|
|
CONNECT = 9,
|
|
|
|
|
CONNECT_ACCEPT = 10,
|
|
|
|
|
CONNECT_REFUSE = 11,
|
|
|
|
|
DISCONNECT = 12,
|
|
|
|
|
DISCONNECTING = 13,
|
|
|
|
|
ACK = 14,
|
|
|
|
|
NAK = 15,
|
|
|
|
|
GET_SESSIONS = 16,
|
|
|
|
|
SESSIONS = 17,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// 7.4 Other Symbolic Parameters
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
/**
|
|
|
|
|
* @brief Table 6: Reason Codes
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
enum reason_code_t {
|
|
|
|
|
NONSPECIFIC = 1, // Non-specific, non-SDT reason.
|
|
|
|
|
ILLEGAL_PARAMETERS = 2, // Illegal channel parameters.
|
|
|
|
|
LOW_RESOURCES = 3, // Insufficient resources.
|
|
|
|
|
ALREADY_MEMBER = 4, // Multiple MIDs for single component.
|
|
|
|
|
BAD_ADDRESS_TYPE = 5, // Unrecognized transport address type.
|
|
|
|
|
NO_RECIPROCAL_CHANNEL = 6, // No upstream channel and can’t create one
|
|
|
|
|
CHANNEL_EXPIRED = 7, // Channel has expired.
|
|
|
|
|
LOST_SEQUENCE = 8, // Unrecoverable packets missed.
|
|
|
|
|
SATURATED = 9, // Can’t keep up, processor saturation.
|
|
|
|
|
TRANSPORT_ADDRESS_CHANGING = 10, // (e.g., IP number lease expired).
|
|
|
|
|
ASKED_TO_LEAVE = 11, // Asked to leave the channel.
|
|
|
|
|
NO_RECIPIENT = 12, // Component does not support protocol ID.
|
|
|
|
|
ONLY_UNICAST_SUPPORTED = 13 // Only unicast channels are supported
|
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Table 7: Address Specification Types
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
enum ip_addr_spec_t {
|
2021-07-30 09:11:32 -04:00
|
|
|
|
SDT_ADDR_NULL = 0, //!< Address is not present (0 octets).
|
|
|
|
|
SDT_ADDR_IPV4 = 1, //!< Address specified is in IP v4 format
|
|
|
|
|
SDT_ADDR_IPV6 = 2 //!< Address specified is in IP v6 format
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief The SDT::Pdu class
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
class Pdu
|
|
|
|
|
: public PDU::Pdu
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-07-29 19:26:49 -04:00
|
|
|
|
Pdu();
|
|
|
|
|
void iStream(PDU::Stream) override;
|
2021-05-27 10:59:22 -04:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
/**
|
|
|
|
|
* @brief The Channel class
|
|
|
|
|
* Sequenced channels are unidirectional communication channels (unicast or
|
|
|
|
|
* multicast) from an owner component to one or more member components.
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
class Channel {
|
|
|
|
|
public:
|
|
|
|
|
Channel(std::shared_ptr<Component>, Direction);
|
|
|
|
|
~Channel();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
std::shared_ptr<Component> owner_;
|
|
|
|
|
Direction direction_ = internal;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
|
/**
|
|
|
|
|
* @brief The Session class
|
|
|
|
|
* A session has a single leader and zero or more session members. The leader
|
|
|
|
|
* communicates to members using the downstream address. Members respond to
|
|
|
|
|
* the leader on the upstream address. A unique session identifier identifies
|
|
|
|
|
* a session.
|
|
|
|
|
*/
|
2021-05-27 10:59:22 -04:00
|
|
|
|
class Session {
|
|
|
|
|
public:
|
|
|
|
|
Session();
|
|
|
|
|
~Session();
|
|
|
|
|
|
|
|
|
|
SessionId id();
|
|
|
|
|
|
|
|
|
|
// 4.4 SDT Base Layer Messages (non ad-hoc)
|
|
|
|
|
void join_accept() {};
|
|
|
|
|
void join_refuse() {};
|
|
|
|
|
void leaving() {};
|
|
|
|
|
void nak() {};
|
|
|
|
|
void reliable_wrapper() {};
|
|
|
|
|
void unreliable_wrapper() {};
|
|
|
|
|
|
|
|
|
|
// 4.5 SDT Wrapped Messages
|
|
|
|
|
void ack();
|
|
|
|
|
void channel_params();
|
|
|
|
|
void leave();
|
|
|
|
|
void connect();
|
|
|
|
|
void connect_accept();
|
|
|
|
|
void connect_refuse();
|
|
|
|
|
void disconnect();
|
|
|
|
|
void disconnecting();
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
std::shared_ptr<ACN::Component> leader;
|
|
|
|
|
std::shared_ptr<Channel> downstream;
|
|
|
|
|
std::unordered_map<MID, std::shared_ptr<Channel>> upstream;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
uint16_t number_;
|
|
|
|
|
uint32_t protocol_;
|
|
|
|
|
MID next_id_ = 1;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // SDT
|
|
|
|
|
} // ACN
|