Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First attempt at LLRP target and rudimentary manager #1612

Draft
wants to merge 57 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
23a00bb
First attempt at LLRP header and PDU
peternewman Jan 29, 2020
d53a8ee
Merge branch 'master' into e1.33
peternewman Jan 30, 2020
8524079
Fix a Doxygen typo
peternewman Feb 3, 2020
674ea51
Update some E1.33 Vectors
peternewman Feb 3, 2020
bd619c2
Add the ability to pack UIDSets
peternewman Feb 4, 2020
a89f3db
Fix the Doxygen
peternewman Feb 4, 2020
063de3d
Fix a Doxygen typo
peternewman Feb 4, 2020
0204d59
Add the initial LLRPProbeRequestPDU
peternewman Feb 4, 2020
910e9c4
Merge branch 'e1.33' of https://github.com/peternewman/ola into e1.33
peternewman Feb 4, 2020
f1cc481
Tidy some Doxygen
peternewman Feb 4, 2020
27c1cb5
Add the ability to easily write a CID to an ostream
peternewman Feb 4, 2020
e9dd374
Add LLRP Probe Request PDU, fix the length flags bug
peternewman Feb 4, 2020
2d0ed43
Fix the lint issues
peternewman Feb 4, 2020
38d893d
Add the LLRPProbeReplyPDU
peternewman Feb 6, 2020
956c0fb
Fix the LLRP vector values
peternewman Feb 6, 2020
d72c6aa
Add the ability to force the length flag on a Root PDU
peternewman Feb 6, 2020
d972695
Allow an LLRPProbeReplyPDU to be sent
peternewman Feb 6, 2020
3eb8518
Tidying and TODO
peternewman Feb 6, 2020
f3b7511
Initial handling of LLRPProbeRequest PDUs
peternewman Feb 6, 2020
e445c32
Initial LLRP discoverable device
peternewman Feb 6, 2020
f743476
Use the correct MAC address in the responses
peternewman Feb 9, 2020
7e5f935
Fix a typo
peternewman Feb 9, 2020
4983aa9
Switch to our flags module and set the UID from the command line
peternewman Feb 9, 2020
dc06b8a
Add the ability to make a UID set from binary data
peternewman Feb 9, 2020
f2343ce
Pass all the LLRPProbeRequest info across in the callback and act on …
peternewman Feb 9, 2020
9583793
Fix a typo
peternewman Feb 10, 2020
1955638
Allow the RDMInflator to be used with both native E1.33 and LLRP RDM …
peternewman Feb 11, 2020
32ecc52
Add the ability to pack an RDMPDU
peternewman Feb 11, 2020
0469724
Initial version of an LLRP RDM responder
peternewman Feb 11, 2020
a150d7e
Add the LLRP Broadcast CID
peternewman Feb 11, 2020
b0662a0
Fix some lint issues and follow more of the standard
peternewman Feb 11, 2020
280d3f6
Ensure we work on the same host as the manager
peternewman Feb 17, 2020
324b4ec
Add a helper method to convert an RDMResponse to a NACKing RDMResponse
peternewman Feb 17, 2020
ccba9fa
Don't send back ACK_OVERFLOW or ACK_TIMER responses
peternewman Feb 17, 2020
52e8913
NACK if an invalid subdevice is targetted
peternewman Feb 17, 2020
46a08ac
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Feb 18, 2020
bc2099b
Rename the target code to a more standardised name
peternewman Feb 18, 2020
ed113e1
Update some missed docs
peternewman Feb 18, 2020
8db5131
Add the ability to inflate an LLRP Probe Reply and build a Probe Request
peternewman Feb 18, 2020
bd0a09c
Minor tweak to some logging
peternewman Feb 19, 2020
fc83330
Initial basic attempt at an LLRP manager
peternewman Feb 19, 2020
ac119e8
Support sending set commands
peternewman Feb 25, 2020
9845e37
Update some RDM comments
peternewman Feb 25, 2020
e6b8f99
Update PIDs from rdm-app repo
peternewman Feb 25, 2020
2aeaac8
Add initial negative E1.33/E1.37-7 tests. Need to add categories still
peternewman Feb 26, 2020
6870361
Add the ability to override the expected NACK for GetZeroMixin
peternewman Feb 26, 2020
f67491f
Correct the expected NACK for some endpoint number checks
peternewman Feb 26, 2020
e59b028
Support loopback and selecting an interface
peternewman Feb 26, 2020
fd26efa
Add some detail on how DMX-TRI error codes are done from its developer
peternewman Mar 4, 2023
9d60884
Improve some size calculations, only output SetWithNoData when actual…
peternewman Mar 4, 2023
966a9fa
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Mar 4, 2023
067bc03
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Mar 5, 2023
910b0b0
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Mar 11, 2023
81b8e38
Fix a minor typo
peternewman Jul 3, 2023
66e7f10
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Jul 3, 2023
7686be6
Temporarily remove the the PIDs with IPV6 type in them until we suppo…
peternewman Jul 3, 2023
c1b8a74
Merge branch 'master' of https://github.com/openlightingproject/ola i…
peternewman Feb 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ tools/e133/e133_monitor
tools/e133/e133_monitor.exe
tools/e133/e133_receiver
tools/e133/e133_receiver.exe
tools/e133/llrp_manager
tools/e133/llrp_manager.exe
tools/e133/llrp_target
tools/e133/llrp_target.exe
tools/e133/slp_locate
tools/e133/slp_locate.exe
tools/e133/slp_register
Expand Down
70 changes: 70 additions & 0 deletions include/ola/acn/ACNFlags.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* ACNFlags.h
* Flags used in ACN PDUs
* Copyright (C) 2020 Peter Newman
*/

#ifndef INCLUDE_OLA_ACN_ACNFLAGS_H_
#define INCLUDE_OLA_ACN_ACNFLAGS_H_

/**
* @addtogroup acn
* @{
* @file ACNFlags.h
* @brief ACN flag values.
* @}
*/

#include <stdint.h>

namespace ola {
namespace acn {

/**
* @addtogroup acn
* @{
*/

// masks for the flag fields
/**
* @brief This indicates a 20 bit length field (default is 12 bits)
*/
static const uint8_t LFLAG_MASK = 0x80;

/**
* @brief This indicates a vector is present
*/
static const uint8_t VFLAG_MASK = 0x40;

/**
* @brief This indicates a header field is present
*/
static const uint8_t HFLAG_MASK = 0x20;

/**
* @brief This indicates a data field is present
*/
static const uint8_t DFLAG_MASK = 0x10;

/**
* @}
*/

} // namespace acn
} // namespace ola

#endif // INCLUDE_OLA_ACN_ACNFLAGS_H_
5 changes: 5 additions & 0 deletions include/ola/acn/ACNPort.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ const uint16_t ACN_PORT = 5568;
*/
const uint16_t E133_PORT = 5569;

/**
* @brief The port used for E1.33 LLRP communication.
*/
const uint16_t LLRP_PORT = 5569;

/**
* @}
*/
Expand Down
14 changes: 13 additions & 1 deletion include/ola/acn/ACNVectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,11 @@ namespace acn {
enum RootVector {
VECTOR_ROOT_E131_REV2 = 3, /**< Draft E1.31, used by some old gear. */
VECTOR_ROOT_E131 = 4, /**< E1.31 (sACN) */
VECTOR_ROOT_E133 = 5, /**< E1.33 (RDNNet) */
VECTOR_ROOT_RPT = 5, /**< E1.33 (RPT) */
VECTOR_ROOT_NULL = 6, /**< NULL (empty) root */
VECTOR_ROOT_BROKER = 9, /**< E1.33 (Broker) */
VECTOR_ROOT_LLRP = 0x0A, /**< E1.33 (LLRP) */
VECTOR_ROOT_EPT = 0x0B, /**< E1.33 (EPT) */
};

/**
Expand Down Expand Up @@ -87,6 +90,15 @@ enum E133ControllerVector {
VECTOR_CONTROLLER_EXPECT_MASTER = 5, /**< Expect master message */
};

/**
* @brief Vectors used at the E1.33 LLRP layer.
*/
enum LLRPVector {
VECTOR_LLRP_PROBE_REQUEST = 1, /**< LLRP Probe Request */
VECTOR_LLRP_PROBE_REPLY = 2, /**< LLRP Probe Reply */
VECTOR_LLRP_RDM_CMD = 3, /**< LLRP RDM Command */
};

/**
* @}
*/
Expand Down
13 changes: 13 additions & 0 deletions include/ola/acn/CID.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,15 @@ class CID {
*/
std::string ToString() const;

/**
* @brief A helper function to write a CID to an ostream.
* @param out the ostream
* @param cid the CID to write.
*/
friend std::ostream& operator<< (std::ostream &out, const CID &cid) {
return out << cid.ToString();
}

/**
* @brief Write the CID to an OutputBufferInterface
*/
Expand Down Expand Up @@ -132,6 +141,10 @@ class CID {
*/
static CID FromString(const std::string &cid);

static CID LLRPBroadcastCID() {
return FromString("FBAD822C-BD0C-4D4C-BDC8-7EABEBC85AFF");
}

private:
class CIDImpl *m_impl;

Expand Down
1 change: 1 addition & 0 deletions include/ola/acn/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ olaacninclude_HEADERS =

if INSTALL_ACN
olaacninclude_HEADERS += \
include/ola/acn/ACNFlags.h \
include/ola/acn/ACNPort.h \
include/ola/acn/ACNVectors.h \
include/ola/acn/CID.h
Expand Down
4 changes: 2 additions & 2 deletions libs/acn/BaseInflator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ bool BaseInflator::DecodeLength(const uint8_t *data,
bool BaseInflator::DecodeVector(uint8_t flags, const uint8_t *data,
unsigned int length, uint32_t *vector,
unsigned int *bytes_used) {
if (flags & PDU::VFLAG_MASK) {
if (flags & ola::acn::VFLAG_MASK) {
if ((unsigned int) m_vector_size > length) {
*vector = 0;
*bytes_used = 0;
Expand Down Expand Up @@ -223,7 +223,7 @@ bool BaseInflator::InflatePDU(HeaderSet *headers,
return false;
}

if (flags & PDU::HFLAG_MASK) {
if (flags & ola::acn::HFLAG_MASK) {
result = DecodeHeader(headers, data + data_offset,
pdu_len - data_offset,
&header_bytes_used);
Expand Down
7 changes: 5 additions & 2 deletions libs/acn/BaseInflator.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ class BaseInflator : public InflatorInterface {
unsigned int len);

// masks for the flag fields
// This indicates a 20 bit length field (default is 12 bits)
static const uint8_t LFLAG_MASK = 0x80;
/**
* @brief This indicates a 20 bit length field (default is 12 bits)
* @deprecated Use ola::acn::LFLAG_MASK instead (4 Feb 2020).
*/
static const uint8_t LFLAG_MASK = ola::acn::LFLAG_MASK;
// This masks the first 4 bits of the length field
static const uint8_t LENGTH_MASK = 0x0F;

Expand Down
18 changes: 9 additions & 9 deletions libs/acn/BaseInflatorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void BaseInflatorTest::testDecodeVector() {
uint8_t data[] = {1, 2, 3, 4, 5, 6}; // the test data
unsigned int vector = 1;
unsigned int bytes_used = 0;
uint8_t flags = PDU::VFLAG_MASK;
uint8_t flags = VFLAG_MASK;

OLA_ASSERT_FALSE(inflator.DecodeVector(flags, data, 0, &vector, &bytes_used));
OLA_ASSERT_EQ((unsigned int) 0, vector);
Expand Down Expand Up @@ -235,7 +235,7 @@ void BaseInflatorTest::testDecodeVector() {
}

// now try with a vector size of 2
flags = PDU::VFLAG_MASK;
flags = VFLAG_MASK;
TestInflator inflator2(0, PDU::TWO_BYTES);
for (unsigned int i = 0; i < 2; i++) {
OLA_ASSERT_FALSE(
Expand Down Expand Up @@ -270,7 +270,7 @@ void BaseInflatorTest::testDecodeVector() {
}

// now try with a vector size of 4
flags = PDU::VFLAG_MASK;
flags = VFLAG_MASK;
TestInflator inflator4(0, PDU::FOUR_BYTES);
for (unsigned int i = 0; i < 4; i++) {
OLA_ASSERT_FALSE(
Expand All @@ -297,7 +297,7 @@ void BaseInflatorTest::testDecodeVector() {
void BaseInflatorTest::testInflatePDU() {
TestInflator inflator; // test with a vector size of 2
HeaderSet header_set;
uint8_t flags = PDU::VFLAG_MASK;
uint8_t flags = VFLAG_MASK;
unsigned int data_size = static_cast<unsigned int>(PDU::TWO_BYTES +
sizeof(PDU_DATA));
uint8_t *data = new uint8_t[data_size];
Expand All @@ -324,7 +324,7 @@ void BaseInflatorTest::testInflatePDUBlock() {
length_size + PDU::TWO_BYTES + sizeof(PDU_DATA));
uint8_t *data = new uint8_t[data_size];
// setup the vector
data[0] = PDU::VFLAG_MASK;
data[0] = VFLAG_MASK;
data[1] = static_cast<uint8_t>(data_size);
data[2] = 0x01;
data[3] = 0x21;
Expand All @@ -337,14 +337,14 @@ void BaseInflatorTest::testInflatePDUBlock() {

// inflate a multi-pdu block
data = new uint8_t[2 * data_size];
data[0] = PDU::VFLAG_MASK;
data[0] = VFLAG_MASK;
data[1] = static_cast<uint8_t>(data_size);
data[2] = 0x01;
data[3] = 0x21;
memcpy(data + length_size + PDU::TWO_BYTES,
PDU_DATA,
sizeof(PDU_DATA));
data[data_size] = PDU::VFLAG_MASK;
data[data_size] = VFLAG_MASK;
data[data_size + 1] = static_cast<uint8_t>(data_size);
data[data_size + 2] = 0x01;
data[data_size + 3] = 0x21;
Expand All @@ -362,11 +362,11 @@ void BaseInflatorTest::testInflatePDUBlock() {
unsigned int pdu_size = data_size + length_size + PDU::TWO_BYTES;
data = new uint8_t[pdu_size];

data[0] = PDU::VFLAG_MASK;
data[0] = VFLAG_MASK;
data[1] = static_cast<uint8_t>(pdu_size);
data[2] = 0x01;
data[3] = 0x21;
data[4] = PDU::VFLAG_MASK;
data[4] = VFLAG_MASK;
data[5] = static_cast<uint8_t>(data_size);
data[6] = 0x01;
data[7] = 0x21;
Expand Down
2 changes: 1 addition & 1 deletion libs/acn/E133Inflator.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class E133Inflator: public BaseInflator {
}
~E133Inflator() {}

uint32_t Id() const { return ola::acn::VECTOR_ROOT_E133; }
uint32_t Id() const { return ola::acn::VECTOR_ROOT_RPT; }

protected:
bool DecodeHeader(HeaderSet *headers,
Expand Down
8 changes: 7 additions & 1 deletion libs/acn/HeaderSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "libs/acn/DMPHeader.h"
#include "libs/acn/E131Header.h"
#include "libs/acn/E133Header.h"
#include "libs/acn/LLRPHeader.h"
#include "libs/acn/RootHeader.h"
#include "libs/acn/TransportHeader.h"

Expand Down Expand Up @@ -56,13 +57,17 @@ class HeaderSet {
const DMPHeader &GetDMPHeader() const { return m_dmp_header; }
void SetDMPHeader(const DMPHeader &header) { m_dmp_header = header; }

const LLRPHeader &GetLLRPHeader() const { return m_llrp_header; }
void SetLLRPHeader(const LLRPHeader &header) { m_llrp_header = header; }

bool operator==(const HeaderSet &other) const {
return (
m_transport_header == other.m_transport_header &&
m_root_header == other.m_root_header &&
m_e131_header == other.m_e131_header &&
m_e133_header == other.m_e133_header &&
m_dmp_header == other.m_dmp_header);
m_dmp_header == other.m_dmp_header &&
m_llrp_header == other.m_llrp_header);
}

private:
Expand All @@ -71,6 +76,7 @@ class HeaderSet {
E131Header m_e131_header;
E133Header m_e133_header;
DMPHeader m_dmp_header;
LLRPHeader m_llrp_header;
};
} // namespace acn
} // namespace ola
Expand Down
71 changes: 71 additions & 0 deletions libs/acn/LLRPHeader.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* LLRPHeader.h
* The E1.33 LLRP Header
* Copyright (C) 2020 Peter Newman
*/

#ifndef LIBS_ACN_LLRPHEADER_H_
#define LIBS_ACN_LLRPHEADER_H_

#include <ola/acn/CID.h>
#include <ola/base/Macro.h>

#include <stdint.h>

namespace ola {
namespace acn {

// TODO(Peter): I think technically this probably shouldn't be a header and
// instead is just data at this level!
/*
* Header for the LLRP layer
*/
class LLRPHeader {
public:
LLRPHeader()
: m_transaction_number(0) {
}

LLRPHeader(const ola::acn::CID &destination_cid,
uint32_t transaction_number)
: m_destination_cid(destination_cid),
m_transaction_number(transaction_number) {
}
~LLRPHeader() {}

const ola::acn::CID DestinationCid() const { return m_destination_cid; }
uint32_t TransactionNumber() const { return m_transaction_number; }

bool operator==(const LLRPHeader &other) const {
return m_destination_cid == other.m_destination_cid &&
m_transaction_number == other.m_transaction_number;
}

PACK(
struct llrp_pdu_header_s {
uint8_t destination_cid[CID::CID_LENGTH];
uint32_t transaction_number;
});
typedef struct llrp_pdu_header_s llrp_pdu_header;

private:
ola::acn::CID m_destination_cid;
uint32_t m_transaction_number;
};
} // namespace acn
} // namespace ola
#endif // LIBS_ACN_LLRPHEADER_H_
Loading
Loading