Skip to content

Commit 1593985

Browse files
authored
Merge pull request #1960 from peternewman/e1.33-cherry-pick
E1.33 cherry pick vii
2 parents d72f35e + 7826970 commit 1593985

21 files changed

+169
-104
lines changed

include/ola/e133/E133StatusHelper.h

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,20 @@
3030
namespace ola {
3131
namespace e133 {
3232

33-
using std::string;
34-
using ola::acn::RPTStatusVector;
35-
using ola::e133::E133StatusCode;
36-
using ola::e133::E133ConnectStatusCode;
37-
using ola::rdm::RDMStatusCode;
33+
bool IntToStatusCode(uint16_t input, ola::e133::E133StatusCode *status_code);
34+
std::string StatusCodeToString(ola::e133::E133StatusCode status_code);
3835

39-
bool IntToStatusCode(uint16_t input, E133StatusCode *status_code);
40-
string StatusCodeToString(E133StatusCode status_code);
41-
42-
bool IntToConnectStatusCode(uint16_t input,
43-
E133ConnectStatusCode *connect_status_code);
44-
string ConnectStatusCodeToString(E133ConnectStatusCode connect_status_code);
36+
bool IntToConnectStatusCode(
37+
uint16_t input,
38+
ola::e133::E133ConnectStatusCode *connect_status_code);
39+
std::string ConnectStatusCodeToString(
40+
E133ConnectStatusCode connect_status_code);
4541

4642
bool IntToRPTStatusCode(uint16_t input,
47-
RPTStatusVector *rpt_status_code);
48-
string RPTStatusCodeToString(RPTStatusVector rpt_status_code);
49-
bool RPTStatusCodeToRDMStatusCode(RPTStatusVector rpt_status_code,
50-
RDMStatusCode *rdm_status_code);
43+
ola::acn::RPTStatusVector *rpt_status_code);
44+
std::string RPTStatusCodeToString(ola::acn::RPTStatusVector rpt_status_code);
45+
bool RPTStatusCodeToRDMStatusCode(ola::acn::RPTStatusVector rpt_status_code,
46+
ola::rdm::RDMStatusCode *rdm_status_code);
5147
} // namespace e133
5248
} // namespace ola
5349
#endif // INCLUDE_OLA_E133_E133STATUSHELPER_H_

include/ola/rdm/RDMEnums.h

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -159,28 +159,6 @@ typedef enum {
159159
PID_PRESET_MERGEMODE = 0x1043,
160160
PID_POWER_ON_SELF_TEST = 0x1044,
161161

162-
// Draft E1.33 PIDs - DO NOT USE
163-
PID_ENDPOINT_LIST = 0x7FE0,
164-
PID_ENDPOINT_TO_UNIVERSE = 0x7FE1,
165-
PID_RDM_TRAFFIC_ENABLE = 0x7FE2,
166-
PID_ENDPOINT_MODE = 0x7FE3,
167-
PID_ENDPOINT_LABEL = 0x7FE4,
168-
PID_DISCOVERY_STATE = 0x7FE5,
169-
PID_ENDPOINT_TIMING = 0x7FE6,
170-
PID_ENDPOINT_TIMING_DESCRIPTION = 0x7FE7,
171-
PID_BINDING_CONTROL_FIELDS = 0x7FE8,
172-
PID_ENDPOINT_IDENTIFY = 0x7FE9,
173-
PID_BACKGROUND_DISCOVERY = 0x7FEA,
174-
PID_ENDPOINT_DEVICE_LIST_CHANGE = 0x7FEB,
175-
PID_ENDPOINT_DEVICES = 0x7FEC,
176-
PID_TCP_COMMS_STATUS = 0x7FED,
177-
PID_ENDPOINT_LIST_CHANGE = 0x7FEE,
178-
PID_BACKGROUND_QUEUED_STATUS_POLICY = 0x7FD0,
179-
PID_BACKGROUND_QUEUED_STATUS_POLICY_DESCRIPTION = 0x7FD1,
180-
PID_BACKGROUND_STATUS_TYPE = 0x7FD2,
181-
PID_QUEUED_STATUS_ENDPOINT_COLLECTION = 0x7FD3,
182-
PID_QUEUED_STATUS_UID_COLLECTION = 0x7FD4,
183-
184162
// E1.37-2 PIDs
185163
PID_LIST_INTERFACES = 0x0700,
186164
PID_INTERFACE_LABEL = 0x0701,
@@ -196,6 +174,30 @@ typedef enum {
196174
PID_DNS_NAME_SERVER = 0x070B,
197175
PID_DNS_HOSTNAME = 0x070C,
198176
PID_DNS_DOMAIN_NAME = 0x070D,
177+
178+
// E1.33 PIDs
179+
PID_COMPONENT_SCOPE = 0x0800,
180+
PID_SEARCH_DOMAIN = 0x0801,
181+
PID_TCP_COMMS_STATUS = 0x0802,
182+
PID_BROKER_STATUS = 0x0803,
183+
184+
// E1.37-7 PIDs
185+
PID_ENDPOINT_LIST = 0x0900,
186+
PID_ENDPOINT_LIST_CHANGE = 0x0901,
187+
PID_IDENTIFY_ENDPOINT = 0x0902,
188+
PID_ENDPOINT_TO_UNIVERSE = 0x0903,
189+
PID_ENDPOINT_MODE = 0x0904,
190+
PID_ENDPOINT_LABEL = 0x0905,
191+
PID_RDM_TRAFFIC_ENABLE = 0x0906,
192+
PID_DISCOVERY_STATE = 0x0907,
193+
PID_BACKGROUND_DISCOVERY = 0x908,
194+
PID_ENDPOINT_TIMING = 0x0909,
195+
PID_ENDPOINT_TIMING_DESCRIPTION = 0x090A,
196+
PID_ENDPOINT_RESPONDERS = 0x090B,
197+
PID_ENDPOINT_RESPONDER_LIST_CHANGE = 0x090C,
198+
PID_BINDING_CONTROL_FIELDS = 0x090D,
199+
PID_BACKGROUND_QUEUED_STATUS_POLICY = 0x090E,
200+
PID_BACKGROUND_QUEUED_STATUS_POLICY_DESCRIPTION = 0x090F,
199201
} rdm_pid;
200202

201203

include/olad/PluginAdaptor.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#include <ola/ExportMap.h>
3333
#include <ola/base/Macro.h>
3434
#include <ola/io/SelectServerInterface.h>
35+
#include <ola/rdm/UID.h>
3536
#include <olad/OlaServer.h>
3637

3738
#include <string>
@@ -48,13 +49,15 @@ class PluginAdaptor: public ola::io::SelectServerInterface {
4849
* @param preferences_factory pointer to the PreferencesFactory object
4950
* @param port_broker pointer to the PortBroker object
5051
* @param instance_name the instance name of this OlaServer
52+
* @param uid the default ola::rdm::UID of this OlaServer
5153
*/
5254
PluginAdaptor(class DeviceManager *device_manager,
5355
ola::io::SelectServerInterface *select_server,
5456
ExportMap *export_map,
5557
class PreferencesFactory *preferences_factory,
5658
class PortBrokerInterface *port_broker,
57-
const std::string *instance_name);
59+
const std::string *instance_name,
60+
const ola::rdm::UID *default_uid);
5861

5962
// The following methods are part of the SelectServerInterface
6063
bool AddReadDescriptor(ola::io::ReadFileDescriptor *descriptor);
@@ -98,6 +101,12 @@ class PluginAdaptor: public ola::io::SelectServerInterface {
98101
*/
99102
const std::string InstanceName() const;
100103

104+
/**
105+
* @brief Return the default UID for the OLA server
106+
* @return an ola::rdm::UID which is the UID for the server
107+
*/
108+
const ola::rdm::UID DefaultUID() const;
109+
101110
ExportMap *GetExportMap() const {
102111
return m_export_map;
103112
}
@@ -134,6 +143,7 @@ class PluginAdaptor: public ola::io::SelectServerInterface {
134143
class PreferencesFactory *m_preferences_factory;
135144
class PortBrokerInterface *m_port_broker;
136145
const std::string *m_instance_name;
146+
const ola::rdm::UID *m_default_uid;
137147

138148
DISALLOW_COPY_AND_ASSIGN(PluginAdaptor);
139149
};

libs/acn/E133StatusHelper.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ namespace ola {
2727
namespace e133 {
2828

2929
using std::string;
30+
using ola::acn::RPTStatusVector;
31+
using ola::e133::E133StatusCode;
32+
using ola::e133::E133ConnectStatusCode;
33+
using ola::rdm::RDMStatusCode;
3034

3135
/**
3236
* Verify that the int is a valid E1.33 Status Code.

libs/acn/LLRPProbeReplyPDU.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ void LLRPProbeReplyPDU::PrependPDU(ola::io::IOStack *stack,
5757
const UID &target_uid,
5858
const MACAddress &hardware_address,
5959
const LLRPComponentType type) {
60+
if (!stack) {
61+
OLA_WARN << "LLRPProbeReplyPDU::PrependPDU: missing stack";
62+
return;
63+
}
64+
6065
llrp_probe_reply_pdu_data data;
6166
target_uid.Pack(data.target_uid, sizeof(data.target_uid));
6267
hardware_address.Pack(data.hardware_address, sizeof(data.hardware_address));

libs/acn/LLRPProbeReplyPDUTest.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,14 @@ void LLRPProbeReplyPDUTest::testPrepend() {
176176
0xff
177177
};
178178
OLA_ASSERT_DATA_EQUALS(expected_data, sizeof(expected_data), buffer, length);
179+
180+
// test null stack
181+
LLRPProbeReplyPDU::PrependPDU(
182+
NULL,
183+
target_uid,
184+
hardware_address,
185+
LLRPProbeReplyPDU::LLRP_COMPONENT_TYPE_NON_RDMNET);
186+
179187
delete[] buffer;
180188
}
181189
} // namespace acn

libs/acn/LLRPProbeRequestInflator.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,13 +103,18 @@ bool LLRPProbeRequestInflator::HandlePDUData(uint32_t vector,
103103
OLA_DEBUG << "Probe from " << UID(pdu_data.lower_uid) << " to "
104104
<< UID(pdu_data.upper_uid);
105105

106+
LLRPProbeRequest request(UID(pdu_data.lower_uid), UID(pdu_data.upper_uid));
107+
request.client_tcp_connection_inactive =
108+
(pdu_data.filter &
109+
LLRPProbeRequestPDU::FILTER_CLIENT_TCP_CONNECTION_INACTIVE);
110+
request.brokers_only = (pdu_data.filter &
111+
LLRPProbeRequestPDU::FILTER_BROKERS_ONLY);
112+
unsigned int known_uids_used_size = known_uids_size;
113+
request.known_uids = UIDSet(pdu_data.known_uids, &known_uids_used_size);
114+
106115
if (m_llrp_probe_request_handler.get()) {
107116
m_llrp_probe_request_handler->Run(&headers,
108-
UID(pdu_data.lower_uid),
109-
UID(pdu_data.upper_uid)
110-
// TODO(Peter): Should we add the filter and known UIDs to the callback too?
111-
//, UIDSet()
112-
);
117+
request);
113118
} else {
114119
OLA_WARN << "No LLRP Probe Request handler defined!";
115120
}

libs/acn/LLRPProbeRequestInflator.h

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,23 @@ class LLRPProbeRequestInflator: public BaseInflator {
3434
friend class LLRPProbeRequestInflatorTest;
3535

3636
public:
37+
struct LLRPProbeRequest {
38+
LLRPProbeRequest(const ola::rdm::UID &_lower, const ola::rdm::UID &_upper)
39+
: lower(_lower),
40+
upper(_upper) {
41+
}
42+
ola::rdm::UID lower;
43+
ola::rdm::UID upper;
44+
bool client_tcp_connection_inactive;
45+
bool brokers_only;
46+
ola::rdm::UIDSet known_uids;
47+
};
48+
49+
3750
// These are pointers so the callers don't have to pull in all the headers.
38-
typedef ola::Callback3<void,
51+
typedef ola::Callback2<void,
3952
const HeaderSet*, // the HeaderSet
40-
const ola::rdm::UID&, // lower UID
41-
const ola::rdm::UID& // upper UID
42-
// TODO(Peter): Should we add the filter and known UIDs to the callback too?
43-
//, const ola::rdm::UIDSet, // known UIDs
53+
const LLRPProbeRequest& // Probe Request Data
4454
> LLRPProbeRequestHandler;
4555

4656
LLRPProbeRequestInflator();

libs/acn/LLRPProbeRequestPDU.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ void LLRPProbeRequestPDU::PrependPDU(ola::io::IOStack *stack,
8787
bool client_tcp_connection_inactive,
8888
bool brokers_only,
8989
const ola::rdm::UIDSet &known_uids) {
90+
if (!stack) {
91+
OLA_WARN << "LLRPProbeRequestPDU::PrependPDU: missing stack";
92+
return;
93+
}
94+
9095
llrp_probe_request_pdu_data data;
9196
lower_uid.Pack(data.lower_uid, sizeof(data.lower_uid));
9297
upper_uid.Pack(data.upper_uid, sizeof(data.upper_uid));

libs/acn/LLRPProbeRequestPDUTest.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,15 @@ void LLRPProbeRequestPDUTest::testPrepend() {
191191
0x56, 0x78, 0, 0, 0, 2,
192192
};
193193
OLA_ASSERT_DATA_EQUALS(expected_data, sizeof(expected_data), buffer, length);
194+
195+
// test null stack
196+
LLRPProbeRequestPDU::PrependPDU(NULL,
197+
UID(0x0000, 0x00000000),
198+
UID(0xffff, 0xffffffff),
199+
false,
200+
false,
201+
known_uids);
202+
194203
delete[] buffer;
195204
}
196205
} // namespace acn

0 commit comments

Comments
 (0)