ensure that UDP and TCP are being sent on the correct transport
This commit is contained in:
parent
4a52f7302d
commit
54ead231ad
@ -66,11 +66,27 @@ void Component::UdpPayloadReceiver(PDU::Stream stream)
|
|||||||
* @param ip
|
* @param ip
|
||||||
*/
|
*/
|
||||||
void Component::rlpSendUdp (const uint32_t vector,
|
void Component::rlpSendUdp (const uint32_t vector,
|
||||||
const PDU::Message< PDU::pdu_data > data,
|
const PDU::Message<PDU::pdu_data> data,
|
||||||
const SDT::UDP::ipAddress& ip)
|
const SDT::UDP::ipAddress& ip)
|
||||||
{
|
{
|
||||||
RLP::UDP::transport transport(true);
|
/// Construct the RLP PDU.
|
||||||
rlpSend(transport, vector, data, ip);
|
auto rlp = std::make_shared<RLP::Pdu>();
|
||||||
|
rlp->setVector(vector);
|
||||||
|
rlp->setHeader(rlp_header_);
|
||||||
|
rlp->setData(data);
|
||||||
|
|
||||||
|
/// Use the EPI 17 tranport format.
|
||||||
|
UDP::transport transport(true);
|
||||||
|
transport.root.pdu->push_back(rlp);
|
||||||
|
|
||||||
|
/// Fill an output stream with the transported PDU
|
||||||
|
size_t length = transport.streamSize();
|
||||||
|
uint8_t buffer[length];
|
||||||
|
PDU::Stream stream(new PDU::pdu_stream(buffer, length));
|
||||||
|
*stream << transport;
|
||||||
|
|
||||||
|
/// Platform devices shall impliment the send.
|
||||||
|
sendUDP(stream, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -101,8 +117,24 @@ void Component::rlpSendTcp (const uint32_t vector,
|
|||||||
const PDU::Message<PDU::pdu_data> data,
|
const PDU::Message<PDU::pdu_data> data,
|
||||||
const SDT::UDP::ipAddress& ip)
|
const SDT::UDP::ipAddress& ip)
|
||||||
{
|
{
|
||||||
RLP::TCP::transport transport(true);
|
/// Construct the RLP PDU.
|
||||||
rlpSend(transport, vector, data, ip);
|
auto rlp = std::make_shared<RLP::Pdu>();
|
||||||
|
rlp->setVector(vector);
|
||||||
|
rlp->setHeader(rlp_header_);
|
||||||
|
rlp->setData(data);
|
||||||
|
|
||||||
|
/// Use the EPI 33 tranport format.
|
||||||
|
TCP::transport transport(true);
|
||||||
|
transport.root.pdu->push_back(rlp);
|
||||||
|
|
||||||
|
/// Fill an output stream with the transported PDU
|
||||||
|
size_t length = transport.streamSize();
|
||||||
|
uint8_t buffer[length];
|
||||||
|
PDU::Stream stream(new PDU::pdu_stream(buffer, length));
|
||||||
|
*stream << transport;
|
||||||
|
|
||||||
|
/// Platform devices shall impliment the send.
|
||||||
|
sendTCP(stream, ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -143,38 +175,6 @@ void Component::RlpRegisterVector(uint32_t vect, PDU::Handler<RLP::Pdu> handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Component::rlpSend
|
|
||||||
* @param transport
|
|
||||||
* @param vector
|
|
||||||
* @param data
|
|
||||||
* @param ip
|
|
||||||
*/
|
|
||||||
void Component::rlpSend(ACN::RLP::message_transport& transport,
|
|
||||||
const uint32_t vector,
|
|
||||||
const PDU::Message<PDU::pdu_data> data,
|
|
||||||
const SDT::UDP::ipAddress& ip)
|
|
||||||
{
|
|
||||||
// rlp pdu
|
|
||||||
auto rlp = std::make_shared<RLP::Pdu>();
|
|
||||||
rlp->setVector(vector);
|
|
||||||
rlp->setHeader(rlp_header_);
|
|
||||||
rlp->setData(data);
|
|
||||||
|
|
||||||
// root block
|
|
||||||
transport.root.pdu->push_back(rlp);
|
|
||||||
|
|
||||||
// create an output stream
|
|
||||||
size_t length = transport.streamSize();
|
|
||||||
uint8_t buffer[length];
|
|
||||||
ACN::PDU::Stream stream(new ACN::PDU::pdu_stream(buffer, length));
|
|
||||||
|
|
||||||
// write message
|
|
||||||
*stream << transport;
|
|
||||||
sendUDP(stream, ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Component::sendUDP
|
* @brief Component::sendUDP
|
||||||
* @param stream
|
* @param stream
|
||||||
|
@ -62,10 +62,6 @@ protected:
|
|||||||
void RlpReceiver(PDU::Message<RLP::Pdu>);
|
void RlpReceiver(PDU::Message<RLP::Pdu>);
|
||||||
void RlpRegisterVector(uint32_t, PDU::Handler<RLP::Pdu>);
|
void RlpRegisterVector(uint32_t, PDU::Handler<RLP::Pdu>);
|
||||||
|
|
||||||
void rlpSend(ACN::RLP::message_transport&, const uint32_t vector,
|
|
||||||
const PDU::Message<PDU::pdu_data> data,
|
|
||||||
const SDT::UDP::ipAddress&);
|
|
||||||
|
|
||||||
virtual void sendUDP(const PDU::Stream, const SDT::UDP::ipAddress&);
|
virtual void sendUDP(const PDU::Stream, const SDT::UDP::ipAddress&);
|
||||||
virtual void sendTCP(const PDU::Stream, const SDT::UDP::ipAddress&);
|
virtual void sendTCP(const PDU::Stream, const SDT::UDP::ipAddress&);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user