35#ifndef _OPENLCB_CONVERT_HXX_
36#define _OPENLCB_CONVERT_HXX_
84 memcpy(&ret, data, 8);
115 uint16_t *mti,
string *error_message);
134 return id & 0xffffffffU;
string EMPTY_PAYLOAD
A global class / variable for empty or not-yet-initialized payloads.
void node_id_to_data(NodeID id, void *data)
Convenience function to render a 48-bit NMRAnet node ID into an existing buffer.
string node_id_to_buffer(NodeID id)
Convenience function to render a 48-bit NMRAnet node ID into a new buffer.
uint64_t data_to_eventid(const void *data)
Takes 8 bytes (big-endian) from *data, and returns the event id they represent.
NodeID data_to_node_id(const void *d)
Converts 6 bytes of big-endian data to a node ID.
uint64_t NodeID
48-bit NMRAnet Node ID type
uint16_t data_to_error(const void *data)
Parses an error code from a payload object at a given pointer.
void error_to_data(uint16_t error_code, void *data)
Writes an error code into a payload object at a given pointer.
NodeID buffer_to_node_id(const string &buf)
Converts a 6-byte-long buffer to a node ID.
unsigned node_high(NodeID id)
void append_error_to_buffer(uint16_t error_code, Payload *p)
Appends an error to the end of an existing buffer.
string Payload
Container that carries the data bytes in an NMRAnet message.
Payload eventid_to_buffer(uint64_t eventid)
Converts an Event ID to a Payload suitable to be sent as an event report.
void buffer_to_error(const Payload &payload, uint16_t *error_code, uint16_t *mti, string *error_message)
Parses the payload of an Optional Interaction Rejected or Terminate Due To Error message.
Payload error_payload(uint16_t error_code, Defs::MTI incoming_mti)
Generates the payload for an OIR or TDE message.
unsigned node_low(NodeID id)
string error_to_buffer(uint16_t error_code, uint16_t mti)
Formats a payload for response of error response messages such as OPtioanl Interaction Rejected or Te...
MTI
Known Message type indicators.