Class Publisher
Defined in File publisher.hpp
Inheritance Relationships
Derived Types
public Netio3BufferedPublisher(Class Netio3BufferedPublisher)public Netio3ZerocopyPublisher(Class Netio3ZerocopyPublisher)
Class Documentation
-
class Publisher
Interface class to any publisher implemented by the network backend.
Subclassed by Netio3BufferedPublisher, Netio3ZerocopyPublisher
Public Types
-
enum Result
Values:
-
enumerator OK
-
enumerator ERROR
-
enumerator AGAIN
-
enumerator PARTIAL
-
enumerator ERROR_TOO_BIG
-
enumerator NO_SUBSCRIBERS
-
enumerator DECODING_ERROR
-
enumerator FLUSH_AGAIN
-
enumerator OK
-
using Callback = std::function<bool()>
Public Functions
-
virtual ~Publisher() = default
-
virtual Result publish(felix_id_t fid, std::span<iovec> iovs, size_t bytes, uint32_t block_addr, std::uint8_t status, std::optional<size_t> max_msg_size = std::nullopt) = 0
publish chunk.
- Parameters:
fid -- e-link universal identifier.
iovs -- vector containing iovs to send.
bytes -- total message size in bytes.
block_addr -- address of block where the chunk starts (for zero-copy mode).
status -- felix-star status byte.
max_msg_size -- maximum message size for this call. If not set, the message is bound only by the maximum message size supported by the network, which also caps any larger limit. Larger messages are truncated.
- 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:
pointer to completion table.
-
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.
-
virtual uint16_t get_port() const = 0
Get the port number assigned by the system.
- Returns:
the port number.
Protected Functions
-
inline explicit Publisher(MessageTruncator truncator)
Protected Attributes
-
const MessageTruncator m_truncator
-
enum Result