Skip to content

Commit

Permalink
Merge a20ce88 into e7b4039
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewman committed Mar 16, 2024
2 parents e7b4039 + a20ce88 commit 1c9893b
Show file tree
Hide file tree
Showing 34 changed files with 791 additions and 39 deletions.
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
135 changes: 125 additions & 10 deletions include/ola/acn/ACNVectors.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ namespace acn {
* @brief ACN vectors used at the root layer.
*/
enum RootVector {
VECTOR_ROOT_E131_REV2 = 3, /**< Draft E1.31, used by some old gear. */
VECTOR_ROOT_E131 = 4, /**< E1.31 (sACN) */
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) */
/** @brief Draft E1.31, used by some old gear. */
VECTOR_ROOT_E131_REV2 = 0x00000003,
VECTOR_ROOT_E131 = 0x00000004, /**< E1.31 (sACN) */
VECTOR_ROOT_RPT = 0x00000005, /**< E1.33 (RPT) */
VECTOR_ROOT_NULL = 0x00000006, /**< NULL (empty) root */
VECTOR_ROOT_BROKER = 0x00000009, /**< E1.33 (Broker) */
VECTOR_ROOT_LLRP = 0x0000000A, /**< E1.33 (LLRP) */
VECTOR_ROOT_EPT = 0x0000000B, /**< E1.33 (EPT) */
};

/**
Expand Down Expand Up @@ -94,9 +95,123 @@ enum E133ControllerVector {
* @brief Vectors used at the E1.33 LLRP layer.
*/
enum LLRPVector {
VECTOR_LLRP_PROBE_REQUEST = 1, /**< LLRP Probe Request */
VECTOR_LLRP_PROBE_REPLY = 1, /**< LLRP Probe Reply */
VECTOR_LLRP_RDM_CMD = 1, /**< LLRP RDM Command */
VECTOR_LLRP_PROBE_REQUEST = 0x00000001, /**< LLRP Probe Request */
VECTOR_LLRP_PROBE_REPLY = 0x00000002, /**< LLRP Probe Reply */
VECTOR_LLRP_RDM_CMD = 0x00000003, /**< LLRP RDM Command */
};

/**
* @brief Vectors used at the E1.33 Broker layer.
*/
enum BrokerVector {
VECTOR_BROKER_CONNECT = 0x0001, /**< Broker Client Connect */
VECTOR_BROKER_CONNECT_REPLY = 0x0002, /**< Broker Connect Reply */

/** @brief Broker Client Entry Update */
VECTOR_BROKER_CLIENT_ENTRY_UPDATE = 0x0003,

VECTOR_BROKER_REDIRECT_V4 = 0x0004, /**< Broker Client Redirect IPv4 */
VECTOR_BROKER_REDIRECT_V6 = 0x0005, /**< Broker Client Redirect IPv6 */
VECTOR_BROKER_FETCH_CLIENT_LIST = 0x0006, /**< Broker Fetch Client List */

/** @brief Broker Connected Client List */
VECTOR_BROKER_CONNECTED_CLIENT_LIST = 0x0007,

/** @brief Broker Client Incremental Addition */
VECTOR_BROKER_CLIENT_ADD = 0x0008,

/** @brief Broker Client Incremental Deletion */
VECTOR_BROKER_CLIENT_REMOVE = 0x0009,

/** @brief Broker Client Entry Change */
VECTOR_BROKER_CLIENT_ENTRY_CHANGE = 0x000A,

/** @brief Broker Request Dynamic UID Assignment */
VECTOR_BROKER_REQUEST_DYNAMIC_UIDS = 0x000B,

/** @brief Broker Dynamic UID Assignment List */
VECTOR_BROKER_ASSIGNED_DYNAMIC_UIDS = 0x000C,

/** @brief Broker Fetch Dynamic UID Assignment List */
VECTOR_BROKER_FETCH_DYNAMIC_UID_LIST = 0x000D,

VECTOR_BROKER_DISCONNECT = 0x000E, /**< Broker Client Disconnect */
VECTOR_BROKER_NULL = 0x000F, /**< Broker Client Null */
};

// Table A-8, RPT PDU Vector
/**
* @brief Vectors used at the E1.33 RPT layer.
*/
enum RPTVector {
VECTOR_RPT_REQUEST = 0x00000001, /**< RPT Request */
VECTOR_RPT_STATUS = 0x00000002, /**< RPT Status */
VECTOR_RPT_NOTIFICATION = 0x00000003, /**< RPT Notification */
};

// Table A-9, RPT Request PDU Vector
/**
* @brief Vectors used at the E1.33 RPT Request layer.
*/
enum RPTRequestVector {
VECTOR_REQUEST_RDM_CMD = 0x01, /**< RPT Request RDM Command */
};

// Table A-10, RPT Status PDU Vector
/**
* @brief Vectors used at the E1.33 RPT Status layer.
*/
enum RPTStatusVector {
/** @brief RPT Status Unknown RPT UID */
VECTOR_RPT_STATUS_UNKNOWN_RPT_UID = 0x0001,

VECTOR_RPT_STATUS_RDM_TIMEOUT = 0x0002, /**< RPT Status RDM Timeout */

/** @brief RPT Status RDM Invalid Response */
VECTOR_RPT_STATUS_RDM_INVALID_RESPONSE = 0x0003,

/** @brief RPT Status Unknown RDM UID */
VECTOR_RPT_STATUS_UNKNOWN_RDM_UID = 0x0004,

/** @brief RPT Status Unknown Endpoint */
VECTOR_RPT_STATUS_UNKNOWN_ENDPOINT = 0x0005,

/** @brief RPT Status Broadcast Complete */
VECTOR_RPT_STATUS_BROADCAST_COMPLETE = 0x0006,

VECTOR_RPT_STATUS_UNKNOWN_VECTOR = 0x0007, /**< RPT Status Unknown Vector */

/** @brief RPT Status Invalid Message */
VECTOR_RPT_STATUS_INVALID_MESSAGE = 0x0008,

/** @brief RPT Status Invalid Command Class */
VECTOR_RPT_STATUS_INVALID_COMMAND_CLASS = 0x0009,
};

// Table A-11, RPT Notification PDU Vector
/**
* @brief Vectors used at the E1.33 RPT Notification layer.
*/
enum RPTNotificationVector {
VECTOR_NOTIFICATION_RDM_CMD = 0x01, /**< RPT Notification RDM Command */
};

/**
* @brief Vectors used at the E1.33 RDM Command layer.
*/
enum RDMCommandVector {
VECTOR_RDM_CMD_RDM_DATA = 0xCC, /**< E1.33 RDM Command */
};

// Table A-21, Client Protocol Codes
// These aren't fully named as vectors in the standard, but are used as such so
// we put them in here
/**
* @brief Vectors used at the E1.33 Broker Client Entry layer.
*/
enum ClientProtocolCode {
CLIENT_PROTOCOL_RPT = 0x00000005, /**< Broker RPT Client Entry */
CLIENT_PROTOCOL_EPT = 0x0000000B, /**< Broker EPT Client Entry */
};

/**
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
4 changes: 2 additions & 2 deletions include/ola/e133/DeviceManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class DeviceManager {
* @returns true if the data should be acknowledged, false otherwise.
*/
typedef ola::Callback3<bool, const IPV4Address&, uint16_t,
const string&> RDMMesssageCallback;
const string&> RDMMessageCallback;

// Run when we acquire designated controller status for a device.
typedef ola::Callback1<void, const IPV4Address&> AcquireDeviceCallback;
Expand All @@ -66,7 +66,7 @@ class DeviceManager {
~DeviceManager();

// Ownership of the callbacks is transferred.
void SetRDMMessageCallback(RDMMesssageCallback *callback);
void SetRDMMessageCallback(RDMMessageCallback *callback);
void SetAcquireDeviceCallback(AcquireDeviceCallback *callback);
void SetReleaseDeviceCallback(ReleaseDeviceCallback *callback);

Expand Down
39 changes: 39 additions & 0 deletions include/ola/e133/E133Enums.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ enum EndpointMode {
ENDPOINT_MODE_OUTPUT = 2,
};

// TODO(Peter): Check that this no longer exists
// Table A-9 E1.33 Status Codes
enum E133StatusCode {
SC_E133_ACK = 0x0000,
Expand All @@ -53,6 +54,44 @@ enum E133StatusCode {
SC_E133_BROADCAST_COMPLETE = 0x0009,
};

// Table A-19 E1.33 Connection Status Codes for Broker Connect
enum E133ConnectStatusCode {
CONNECT_OK = 0x0000,
CONNECT_SCOPE_MISMATCH = 0x0001,
CONNECT_CAPACITY_EXCEEDED = 0x0002,
CONNECT_DUPLICATE_UID = 0x0003,
CONNECT_INVALID_CLIENT_ENTRY = 0x0004,
CONNECT_INVALID_UID = 0x0005,
};

// Table A-20 E1.33 Status Codes for Dynamic UID Mapping
enum E133DynamicUIDStatusCode {
DYNAMIC_UID_STATUS_OK = 0x0000,
DYNAMIC_UID_STATUS_INVALID_REQUEST = 0x0001,
DYNAMIC_UID_STATUS_UID_NOT_FOUND = 0x0002,
DYNAMIC_UID_STATUS_DUPLICATE_RID = 0x0003,
DYNAMIC_UID_STATUS_CAPACITY_EXHAUSTED = 0x0004,
};

// Table A-22 E1.33 RPT Client Type Codes
enum E133RPTClientTypeCode {
RPT_CLIENT_TYPE_DEVICE = 0x00,
RPT_CLIENT_TYPE_CONTROLLER = 0x01,
};

// Table A-24 E1.33 Client Disconnect Reason Codes
enum E133DisconnectStatusCode {
DISCONNECT_SHUTDOWN = 0x0000,
DISCONNECT_CAPACITY_EXHAUSTED = 0x0001,
DISCONNECT_HARDWARE_FAULT = 0x0002,
DISCONNECT_SOFTWARE_FAULT = 0x0003,
DISCONNECT_SOFTWARE_RESET = 0x0004,
DISCONNECT_INCORRECT_SCOPE = 0x0005,
DISCONNECT_RPT_RECONFIGURE = 0x0006,
DISCONNECT_LLRP_RECONFIGURE = 0x0007,
DISCONNECT_USER_RECONFIGURE = 0x0008,
};

// The max size of an E1.33 Status string.
enum {
MAX_E133_STATUS_STRING_SIZE = 64
Expand Down
36 changes: 36 additions & 0 deletions include/ola/e133/E133Helper.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.
*
* E133Helper.h
* Various misc E1.33 functions.
* Copyright (C) 2024 Peter Newman
*/

#ifndef INCLUDE_OLA_E133_E133HELPER_H_
#define INCLUDE_OLA_E133_E133HELPER_H_

#include <stdint.h>
#include <ola/e133/E133Enums.h>
#include <string>

namespace ola {
namespace e133 {

bool IntToRPTClientType(uint8_t input,
ola::e133::E133RPTClientTypeCode *client_type);
std::string RPTClientTypeToString(uint8_t type);
} // namespace e133
} // namespace ola
#endif // INCLUDE_OLA_E133_E133HELPER_H_
5 changes: 5 additions & 0 deletions include/ola/e133/E133StatusHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,14 @@ namespace e133 {

using std::string;
using ola::e133::E133StatusCode;
using ola::e133::E133ConnectStatusCode;

bool IntToStatusCode(uint16_t input, E133StatusCode *status_code);
string StatusCodeToString(E133StatusCode status_code);

bool IntToConnectStatusCode(uint16_t input,
E133ConnectStatusCode *connect_status_code);
string ConnectStatusCodeToString(E133ConnectStatusCode connect_status_code);
} // namespace e133
} // namespace ola
#endif // INCLUDE_OLA_E133_E133STATUSHELPER_H_
1 change: 1 addition & 0 deletions include/ola/e133/Makefile.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ if INSTALL_E133
olae133include_HEADERS = \
include/ola/e133/DeviceManager.h \
include/ola/e133/E133Enums.h \
include/ola/e133/E133Helper.h \
include/ola/e133/E133Receiver.h \
include/ola/e133/E133StatusHelper.h \
include/ola/e133/E133URLParser.h \
Expand Down
4 changes: 3 additions & 1 deletion include/ola/network/AdvancedTCPConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ class AdvancedTCPConnector {
/**
* @brief Return the number of connections tracked by this connector.
*/
unsigned int EndpointCount() const { return m_connections.size(); }
unsigned int EndpointCount() const {
return static_cast<unsigned int>(m_connections.size());
}

/**
* @brief The state of a connection.
Expand Down
4 changes: 3 additions & 1 deletion include/ola/network/TCPConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,9 @@ class TCPConnector {
/**
* @brief Return the number of pending connections
*/
unsigned int ConnectionsPending() const { return m_connections.size(); }
unsigned int ConnectionsPending() const {
return static_cast<unsigned int>(m_connections.size());
}

/**
* @brief Called when the TCP socket connects.
Expand Down
2 changes: 2 additions & 0 deletions libs/acn/LLRPHeader.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
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
*/
Expand Down
2 changes: 0 additions & 2 deletions libs/acn/LLRPPDU.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
namespace ola {
namespace acn {

class RDMPDU;

class LLRPPDU: public PDU {
public:
LLRPPDU(unsigned int vector,
Expand Down
Loading

0 comments on commit 1c9893b

Please sign in to comment.