Program Listing for File BaseSocket.hpp
↰ Return to documentation for file (BackendLibfabric/BaseSocket.hpp
)
#ifndef NETIO3BACKEND_BACKENDLIBFABRIC_BASESOCKET_HPP
#define NETIO3BACKEND_BACKENDLIBFABRIC_BASESOCKET_HPP
#include <rdma/fabric.h>
#include <rdma/fi_domain.h>
#include "Buffer.hpp"
#include "DomainManager.hpp"
#include "Helpers.hpp"
#include "netio3-backend/Netio3Backend.hpp"
namespace netio3::libfabric {
class BaseSocket
{
public:
[[nodiscard]] const Endpoint& get_endpoint() const { return m_ep; }
[[nodiscard]] Endpoint& get_endpoint() { return m_ep; }
[[nodiscard]] CqCmFds get_cq_cm_fds() const { return {m_ep.cqfd, m_ep.eqfd}; }
void set_cq_ev_ctx(EventContext ctx) { m_cq_ev_ctx = std::move(ctx); }
void set_eq_ev_ctx(EventContext ctx) { m_eq_ev_ctx = std::move(ctx); }
[[nodiscard]] const EventContext& get_eq_ev_ctx() const { return m_eq_ev_ctx; }
[[nodiscard]] const EventContext& get_cq_ev_ctx() const { return m_cq_ev_ctx; }
protected:
explicit BaseSocket(Endpoint ep) : m_ep{std::move(ep)} {};
static void open_endpoint(const EndPointAddress& address,
Endpoint& ep,
fid_fabric* fabric,
fid_domain* domain,
fi_info* info);
static void enable_endpoint(const EndPointAddress& address, Endpoint& ep);
[[nodiscard]] static fi_cq_attr prepare_cq_attr();
template<BufferConcept BufferType>
static void register_buffer(BufferType& buf, DomainContext& domain, int access_flag);
template<BufferConcept BufferType>
static void close_buffer(const BufferType& buffer);
private:
Endpoint m_ep{};
EventContext m_eq_ev_ctx{};
EventContext m_cq_ev_ctx{};
};
} // namespace netio3::libfabric
#endif // NETIO3BACKEND_BACKENDLIBFABRIC_BASESOCKET_HPP