class
connectionContents
- Reference
Pure virtual connection base class.
Public functions
- auto get_id() const -> size_t
- void set_id(size_t id)
- auto allocate(size_t len) -> AES70_WARN_UNUSED_RESULT uint8_t* pure virtual
- void send() pure virtual
- auto send_constant(const char* data, size_t length) -> bool virtual
- void close() pure virtual
-
auto cork_handle() -> AES70_WARN_UNUSED_RESULT aes70::
cork_handle<connection> - void cork() virtual
- void uncork() virtual
- auto is_reliable() -> bool pure virtual
- auto receive(uint8_t* src, uint8_t* src_end) -> AES70_WARN_UNUSED_RESULT bool pure virtual
- auto get_idle_time() const -> std::array<uint32_t, 2> pure virtual
- void set_poll_interval(uint32_t interval) pure virtual
- auto poll() -> bool
- void set_keepalive_interval(uint32_t interval) virtual
- auto has_subscription(const OcaEvent& id) const -> bool pure virtual
- auto add_subscription(const OcaEvent& id, const OcaMethod& method) -> bool pure virtual
- void remove_subscription(const OcaEvent& id) pure virtual
- auto allocate_response(uint32_t handle, size_t len, OcaStatus status, uint8_t parameterCount) -> uint8_t*
- auto allocate_notification(const OcaEvent& event, size_t len, uint8_t parameterCount) -> uint8_t*
-
template<typename Interval>void send_keepalive(Interval interval)
Protected functions
- auto find_subscription(const OcaEvent& id) const -> const Subscription* pure virtual
Function documentation
size_t aes70:: connection:: get_id() const
Returns the (unique) identifier of this connection.
void aes70:: connection:: set_id(size_t id)
Sets the connection identifier.
AES70_WARN_UNUSED_RESULT uint8_t* aes70:: connection:: allocate(size_t len) pure virtual
Allocate len bytes of buffer for sending. Returns a pointer to the begingin of the buffer or nullptr on allocation failure. Call send to send the data.
void aes70:: connection:: send() pure virtual
Send the buffer previously allocated using allocate.
bool aes70:: connection:: send_constant(const char* data,
size_t length) virtual
Send a constant string.
void aes70:: connection:: close() pure virtual
Close this connection.
AES70_WARN_UNUSED_RESULT aes70:: cork_handle<connection> aes70:: connection:: cork_handle()
Stop flushing data to the network. This can be used to make sure that several (small) writes are efficiently batched together. Use this, for example, when generating many events.
Corking is disabled when the return value goes out of scope.
void aes70:: connection:: cork() virtual
Start batching writes and flush all buffered data to the network. Prefer cork_
void aes70:: connection:: uncork() virtual
Stop batching writes and flush all buffered data to the network.
bool aes70:: connection:: is_reliable() pure virtual
Returns true if this connection is reliable, false otherwise. In this version of the standard only OCP.1 over UDP is unreliable, all other connection types are reliable.
AES70_WARN_UNUSED_RESULT bool aes70:: connection:: receive(uint8_t* src,
uint8_t* src_end) pure virtual
Call this for incoming data. Will return false if something went wrong, e.g. the received data was illegal or on allocation failure.
std::array<uint32_t, 2> aes70:: connection:: get_idle_time() const pure virtual
Returns the idle times of this connection in milliseconds. The first element of the returned tuple is the time since the last byte has been sent, the seconds elements is the time since the last byte has been received.
void aes70:: connection:: set_poll_interval(uint32_t interval) pure virtual
Sets the frequency of calls to poll() in milliseconds.
void aes70:: connection:: set_keepalive_interval(uint32_t interval) virtual
Set the keepalive interval in milliseconds. This will always send a keepalive packet immediately, if the keepalive interval has changed.
bool aes70:: connection:: has_subscription(const OcaEvent& id) const pure virtual
Returns true if this connection has a subscription for the given event.
bool aes70:: connection:: add_subscription(const OcaEvent& id,
const OcaMethod& method) pure virtual
Add a subscription.
void aes70:: connection:: remove_subscription(const OcaEvent& id) pure virtual
Remove a subscription.
uint8_t* aes70:: connection:: allocate_response(uint32_t handle,
size_t len,
OcaStatus status,
uint8_t parameterCount)
Allocate a response packet. Either returns a pointer to the position in the allocated buffer space where the arguments should be written to OR nullptr on allocation failure.
uint8_t* aes70:: connection:: allocate_notification(const OcaEvent& event,
size_t len,
uint8_t parameterCount)
Allocate a notification packet. Either returns a pointer to the position in the allocated buffer space where the arguments should be written to OR nullptr. If the return value is nullptr, either this connection has not subscribed the given event OR there was an allocation failure.
\fixme this makes no sense, remove the find_subscription check.
template<typename Interval>
void aes70:: connection:: send_keepalive(Interval interval)
Sends a keepalive packet. If Interval is a 32 bit integer it is interpreted as milliseconds, if it is a 16 bit integer it is interpreted as seconds.
const Subscription* aes70:: connection:: find_subscription(const OcaEvent& id) const pure virtual protected
Returns a subscription for the given OcaEvent, or nullptr if no subscription exists.