Class ActiveEndpoint

Class Documentation

class ActiveEndpoint

Represents an active endpoint for sending and receiving data using libfabric.

This class provides functionality to create an active endpoint that can connect to a remote passive endpoint or accept a connection from a local passive endpoint. It manages the creation of the endpoint, completion queue, and event queue, and provides methods to complete the connection process. The endpoint can be used for sending and receiving data over the network.

This class does not provide any functionality for sending or receiving data itself, it only handles the creation and management of the endpoint.

Public Types

enum class ConnectionMode

Mode of the connection.

This enum defines the mode of the connection for the active endpoint. It determines whether the endpoint will connect to a remote passive endpoint or accept a connection from a local passive endpoint.

Values:

enumerator Connect
enumerator Accept

Public Functions

ActiveEndpoint(EndPointAddress address, NetworkMode mode, EndpointCapabilities capabilities, fid_fabric *fabric, fid_domain *domain, FiInfoUniquePtr &&info, fid_ep *shx_ctx = nullptr, fid_av *av = nullptr)

Constructs a ActiveEndpoint object.

The constructor creates the endpoint using the provided fi_info struct.

Throws:

FailedOpenActiveEndpoint – in case of a libfabric error

Parameters:
  • address – The endpoint address

  • mode – The network mode to be used for communication (TCP or RDMA)

  • capabilities – The capabilities of the endpoint

  • fabric – The network fabric (used to create endpoint)

  • domain – The send domain (used to create endpoint)

  • info – The network info

  • shx_ctx – The shared receive context (if used)

  • av – The address vector (if used)

ActiveEndpoint(EndPointAddress address, NetworkMode mode, EndpointCapabilities capabilities, fid_fabric *fabric, fid_domain *domain, std::uint64_t info_flags, fid_ep *shx_ctx = nullptr, fid_av *av = nullptr)

Constructs a ActiveEndpoint object.

The constructor creates the endpoint constructing its own fi_info struct.

Throws:

FailedOpenActiveEndpoint – in case of a libfabric error

Parameters:
  • address – The endpoint address

  • mode – The network mode to be used for communication (TCP or RDMA)

  • capabilities – The capabilities of the endpoint

  • fabric – The network fabric (used to create endpoint)

  • domain – The send domain (used to create endpoint)

  • info_flags – The flags for the network info

  • shx_ctx – The shared receive context (if used)

  • av – The address vector (if used)

void complete_connection(ConnectionMode mode, fid_pep *pep = nullptr)

Completes the connection process.

This function completes the connection process by either connecting to a remote passive endpoint or accepting a connection from a local passive endpoint.

Throws:

FailedOpenActiveEndpoint – in case of a libfabric error

Parameters:
  • mode – The connection mode (Connect or Accept)

  • pep – Optional pointer to a passive endpoint (used in Accept mode)

void update_addresses()

Updates the addresses of the endpoint.

This function updates the local and remote addresses of the endpoint. Has to be called after the connection is established to ensure that the addresses are correct.

inline const Endpoint &get_endpoint() const

Get the endpoint object.

Returns:

A const reference for const objects, non const for non const objects

inline Endpoint &get_endpoint()
inline const EndPointAddress &get_address() const

Get the remote address of the endpoint.

Returns:

The remote address of the endpoint

inline const EndPointAddress &get_local_address() const

Get the local address of the endpoint.

Returns:

The local address of the endpoint

inline const EndpointCapabilities &get_capabilities() const

Get the capabilities of the endpoint.

Returns:

The capabilities of the endpoint

inline CqCmFds get_cq_cm_fds() const

Get the file descriptors of the completion and event queues.

Returns:

CqCmFds The file descriptors of the completion and event queues

inline void set_cq_ev_ctx(EventContext ctx)

Set the event context for the send completion queue.

Parameters:

ctx – Event context containing callback

inline void set_rcq_ev_ctx(EventContext ctx)

Set the event context for the receive completion queue.

Parameters:

ctx – Event context containing callback

inline void set_eq_ev_ctx(EventContext ctx)

Set the event context for the event queue.

Parameters:

ctx – Event context containing callback

inline const EventContext &get_eq_ev_ctx() const

Get the event context for the event queue.

Returns:

A const reference to the event context

inline const EventContext &get_cq_ev_ctx() const

Get the event context for the send completion queue.

Returns:

A const reference to the event context

inline const EventContext &get_rcq_ev_ctx() const

Get the event context for the receive completion queue.

Returns:

A const reference to the event context