Class Publisher

Inheritance Relationships

Derived Types

Class Documentation

class Publisher

Interface class to any publisher implemented by the network backend.

Subclassed by NetioBufferedPublisher, NetioZerocopyPublisher

Public Types

enum Result

Values:

enumerator OK
enumerator ERROR
enumerator AGAIN
enumerator PARTIAL
enumerator ERROR_TOO_BIG
enumerator NO_SUBSCRIBERS
enumerator DECODING_ERROR
using Callback = std::function<bool()>

Public Functions

virtual ~Publisher() = default
virtual bool declare(const std::vector<Elink> &elinks) = 0

advertise served e-links

Parameters:

elinks -- to advertise.

Returns:

whether the operation was succesfull.

virtual Result publish(felix_id_t fid, iovec *iov, uint32_t iovlen, size_t bytes, uint32_t block_addr, std::uint8_t status) = 0

publish chunk.

Parameters:
  • fid -- e-link universal identifier.

  • iov -- pointer to array of I/O vector.

  • iovlen -- number of entries in I/O vector array.

  • bytes -- total message size in bytes.

  • block_addr -- address of block where the chunk starts (for zero-copy mode).

  • status -- felix-star status byte.

Returns:

publisher-specific return code.

virtual Result publish(felix_id_t fid, uint8_t *data, size_t len) = 0

publish chunk/message.

Parameters:
  • fid -- e-link universal identifier.

  • data -- pointer to the start of chunk/message to publish.

  • len -- size of message/chunk to publish.

Returns:

publisher-specific return code.

virtual Result flush(felix_id_t fid) = 0

send right away (flush) the current buffer.

Parameters:

fid -- e-link universal identifier. All buffers containing data from this e-link are flushed.

Returns:

publisher-specific return code.

virtual void set_periodic_callback(uint32_t period_us, Callback callback) = 0

configure periodic callback e.g. the function used for polling input data.

virtual void set_asynch_callback(Callback callback) = 0

configure a callback with an asynchronous signal associated.

virtual void fire_asynch_callback() = 0

fire the signal associated to the asynchronous callback.

virtual const CompletionTable *get_completion_table() = 0

zero-copy specific function to determine the DMA read pointer on the basis of outstanding network transfers.

Returns:

address in the DMA buffer.

virtual uint32_t get_resource_counter() = 0
Returns:

the number of available network buffers or similar resources.

virtual uint32_t get_subscription_number() = 0
Returns:

the number of subscriptions.

virtual uint64_t get_resource_available_calls() = 0
Returns:

the number of calls occurring when network resources become availale after exhaustion.

Protected Functions

std::uint8_t truncate_msg_if_too_large(iovec *iov, uint32_t &size, std::uint8_t status)

Truncate the message if it is too large and returns status.

Changes iov to fit into message

Parameters:
  • iov -- pointer to array of I/O vector

  • size -- number of entries in I/O vector array

  • status -- status byte

Returns:

updated status byte

Protected Attributes

size_t m_max_msg_size = {}
uint32_t m_max_iov_len = {}