MXL : Media eXchange Layer
MXL
Loading...
Searching...
No Matches
Address.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Contributors to the Media eXchange Layer project.
2//
3// SPDX-License-Identifier: Apache-2.0
4
5#pragma once
6
7#include <cstdint>
8#include <string>
9#include <vector>
10#include <rdma/fabric.h>
11#include <rdma/fi_domain.h>
12#include "FabricAddress.hpp"
13
15{
19 class RawFabricAddress final
20 {
21 public:
26
32 [[nodiscard]]
33 static RawFabricAddress fromFid(::fid_t fid, FabricInfoView info);
34
38 [[nodiscard]]
39 std::string toBase64() const;
40
46 [[nodiscard]]
47 static RawFabricAddress fromBase64(std::string_view data, FabricAddressFormat addressFormat);
48
52 [[nodiscard]]
53 void* raw() noexcept;
54
58 [[nodiscard]]
59 void const* raw() const noexcept;
60
64 [[nodiscard]]
65 std::size_t size() const noexcept;
66
70 [[nodiscard]]
71 FabricAddressFormat format() const noexcept;
72
76 [[nodiscard]]
77 FabricAddress decode() const;
78
79 bool operator==(RawFabricAddress const& other) const noexcept;
80
81 private:
82 explicit RawFabricAddress(std::vector<std::uint8_t> addr, FabricAddressFormat addressFormat);
83
86 [[nodiscard]]
88
89 private:
90 std::vector<std::uint8_t> _inner;
92 };
93
94}
Owning, type-safe representation of a libfabric address.
Non-owning view of a FabricInfo. Returned when iterating over a FabricInfoList.
bool operator==(RawFabricAddress const &other) const noexcept
Definition Address.cpp:57
void * raw() noexcept
Pointer to the raw address data.
Definition Address.cpp:37
RawFabricAddress()
Default is an empty fabric address.
Definition Address.cpp:17
static RawFabricAddress retrieveFabricAddress(::fid_t fid, FabricInfoView info)
Retrieve the fabric address of an endpoint by using its fid.
Definition Address.cpp:77
static RawFabricAddress fromBase64(std::string_view data, FabricAddressFormat addressFormat)
Parse a fabric address from a base64 encoded string.
Definition Address.cpp:67
static RawFabricAddress fromFid(::fid_t fid, FabricInfoView info)
Retrieve the fabric address of an endpoint by passing its fid.
Definition Address.cpp:27
std::vector< std::uint8_t > _inner
Definition Address.hpp:90
std::string toBase64() const
Convert the raw fabric address into a base64 encoded string.
Definition Address.cpp:32
FabricAddress decode() const
Decode into a strongly typed FabricAddress.
Definition Address.cpp:62
std::size_t size() const noexcept
Byte-length of the raw address data.
Definition Address.cpp:47
FabricAddressFormat format() const noexcept
Return the fabric specific libfaric address format, or FI_FORMAT_UNSPEC if empty.
Definition Address.cpp:52