7#include <rdma/fabric.h>
9#include <rdma/fi_errno.h>
72 throw std::runtime_error(
"Failed to decode base64 data into FabricAddress.");
82 std::size_t addrlen = 0;
83 auto ret = fi_getname(fid,
nullptr, &addrlen);
84 if (ret != -FI_ETOOSMALL)
90 auto addr = std::vector<std::uint8_t>(addrlen);
91 fiCall(fi_getname,
"Failed to retrieve endpoint's local address.", fid, addr.data(), &addrlen);
Owning, type-safe representation of a libfabric address.
static FabricAddress decode(FabricAddressFormat addrFormat, void const *addr, std::size_t len)
Decode a raw libfabric address buffer of the given addr_format.
An internal exception type that extends.
Non-owning view of a FabricInfo. Returned when iterating over a FabricInfoList.
bool operator==(RawFabricAddress const &other) const noexcept
void * raw() noexcept
Pointer to the raw address data.
RawFabricAddress()
Default is an empty fabric address.
static RawFabricAddress retrieveFabricAddress(::fid_t fid, FabricInfoView info)
Retrieve the fabric address of an endpoint by using its fid.
FabricAddressFormat _addressFormat
static RawFabricAddress fromBase64(std::string_view data, FabricAddressFormat addressFormat)
Parse a fabric address from a base64 encoded string.
static RawFabricAddress fromFid(::fid_t fid, FabricInfoView info)
Retrieve the fabric address of an endpoint by passing its fid.
std::vector< std::uint8_t > _inner
std::string toBase64() const
Convert the raw fabric address into a base64 encoded string.
FabricAddress decode() const
Decode into a strongly typed FabricAddress.
std::size_t size() const noexcept
Byte-length of the raw address data.
FabricAddressFormat format() const noexcept
Return the fabric specific libfaric address format, or FI_FORMAT_UNSPEC if empty.
OutputBuffer encode_into(InputIterator begin, InputIterator end)
OutputBuffer decode_into(std::string_view base64Text)
int fiCall(F &&fun, std::string_view msg, T &&... args)
Call a libfabric function and check its return code.
FabricAddressFormat mustConvertAddressFormat(std::uint32_t fiAddrFormat)
Convert from libfabric address format value to FabricAddressFormat Never returns FabricAddressFormat:...