2021-05-27 10:59:22 -04:00
|
|
|
/*
|
2021-08-25 10:57:31 -04:00
|
|
|
rlp/component.h
|
2021-05-27 10:59:22 -04:00
|
|
|
|
|
|
|
Copyright (c) 2021 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
|
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
#include "acn/component.h"
|
|
|
|
#include "acn/pdu.h"
|
2021-05-27 10:59:22 -04:00
|
|
|
#include "rlp.h"
|
2021-08-30 10:15:39 -04:00
|
|
|
#include "sdt/udp.h"
|
2021-08-15 23:36:29 -04:00
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
#include <map>
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
namespace ACN::RLP {
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-07-30 09:11:32 -04:00
|
|
|
/**
|
2021-08-25 10:57:31 -04:00
|
|
|
* @brief The RLP::Component class
|
|
|
|
*
|
|
|
|
* The process, program or application corresponding to a single ACN endpoint.
|
|
|
|
* All messages in ACN are sent and received by a component which is identified
|
|
|
|
* by a CID.
|
2021-07-30 09:11:32 -04:00
|
|
|
*/
|
2021-08-25 10:57:31 -04:00
|
|
|
class Component
|
2021-08-25 10:33:53 -04:00
|
|
|
: public ACN::Component
|
2021-05-27 10:59:22 -04:00
|
|
|
{
|
|
|
|
public:
|
2022-11-19 15:43:02 -05:00
|
|
|
Component(UUID::uuid = UUID::uuid(), std::string fctn = "OpenLCP RLP Component");
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-07-28 10:43:43 -04:00
|
|
|
// EPI 17 - ACN RLP on UDP
|
|
|
|
virtual void UdpPayloadReceiver(PDU::Stream);
|
2021-08-30 10:15:39 -04:00
|
|
|
void rlpSendUdp(const uint32_t vector, const PDU::Message<PDU::pdu_data> data,
|
2021-09-01 12:20:35 -04:00
|
|
|
const SDT::UDP::ipAddress&);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2021-07-28 10:43:43 -04:00
|
|
|
// EPI 33 - ACN RLP Operation on TCP
|
|
|
|
virtual void TcpPacketReceiver(PDU::Stream);
|
2021-08-30 10:15:39 -04:00
|
|
|
void rlpSendTcp(const uint32_t vector, const PDU::Message<PDU::pdu_data> data,
|
2021-09-01 12:20:35 -04:00
|
|
|
const SDT::UDP::ipAddress&);
|
2021-07-28 10:43:43 -04:00
|
|
|
|
2021-08-22 12:02:19 -04:00
|
|
|
protected:
|
2021-08-25 10:33:53 -04:00
|
|
|
void RlpReceiver(PDU::Message<RLP::Pdu>);
|
2021-08-15 11:22:01 -04:00
|
|
|
void RlpRegisterVector(uint32_t, PDU::Handler<RLP::Pdu>);
|
2021-05-27 10:59:22 -04:00
|
|
|
|
2022-11-20 15:09:03 -05:00
|
|
|
virtual void sendUDP(const PDU::Stream, const SDT::UDP::ipAddress&);
|
|
|
|
virtual void sendTCP(const PDU::Stream, const SDT::UDP::ipAddress&);
|
2021-08-30 10:15:39 -04:00
|
|
|
|
2021-05-27 10:59:22 -04:00
|
|
|
private:
|
|
|
|
std::map<uint32_t, std::vector<PDU::Handler<RLP::Pdu>>> rlp_vectors_;
|
2022-11-20 15:10:53 -05:00
|
|
|
std::shared_ptr<rlp_header> rlp_header_;
|
2021-05-27 10:59:22 -04:00
|
|
|
};
|
|
|
|
|
2021-08-24 18:10:20 -04:00
|
|
|
}; // ACN::RLP
|