1#ifndef SOURCEMETA_CORE_HTTP_TRACECONTEXT_H_
2#define SOURCEMETA_CORE_HTTP_TRACECONTEXT_H_
4#ifndef SOURCEMETA_CORE_HTTP_EXPORT
5#include <sourcemeta/core/http_export.h>
8#include <sourcemeta/core/http_syntax.h>
9#include <sourcemeta/core/text.h>
17namespace sourcemeta::core {
62 return (flags & 0x01U) != 0;
93SOURCEMETA_CORE_HTTP_EXPORT
114SOURCEMETA_CORE_HTTP_EXPORT
116 -> std::optional<HTTPTraceParent>;
146SOURCEMETA_CORE_HTTP_EXPORT
183SOURCEMETA_CORE_HTTP_EXPORT
185 -> std::optional<std::array<char, 55>>;
218SOURCEMETA_CORE_HTTP_EXPORT
243template <
typename Callback>
244 requires std::invocable<Callback, std::string_view, std::string_view>
246 Callback callback) ->
bool {
252 const auto comma{rest.find(
',')};
254 const auto equal{entry.find(
'=')};
255 if (equal != std::string_view::npos) {
256 callback(entry.substr(0, equal), entry.substr(equal + 1));
258 if (comma == std::string_view::npos) {
261 rest.remove_prefix(comma + 1);
284template <
typename Container>
285 requires requires(Container container, std::string_view entry) {
286 container.emplace_back(entry, entry);
289 Container &members) ->
bool {
292 [&members](
const std::string_view key,
const std::string_view entry)
293 ->
void { members.emplace_back(key, entry); });
std::string_view parent_id
Definition http_tracecontext.h:37
std::string_view trace_id
Definition http_tracecontext.h:34
std::uint8_t flags
An eight bit field of which one bit is currently defined.
Definition http_tracecontext.h:39
std::uint8_t version
Definition http_tracecontext.h:31
auto http_is_ows(const char character) noexcept -> bool
Definition http_syntax.h:28
SOURCEMETA_CORE_HTTP_EXPORT auto http_continue_traceparent(const std::string_view value, const bool sampled) -> std::optional< std::array< char, 55 > >
SOURCEMETA_CORE_HTTP_EXPORT auto http_parse_traceparent(const std::string_view value) noexcept -> std::optional< HTTPTraceParent >
SOURCEMETA_CORE_HTTP_EXPORT auto http_is_traceparent(const std::string_view value) noexcept -> bool
SOURCEMETA_CORE_HTTP_EXPORT auto http_is_tracestate(const std::string_view value) noexcept -> bool
auto http_parse_tracestate(const std::string_view value, Callback callback) -> bool
Definition http_tracecontext.h:245
constexpr auto http_traceparent_sampled(const std::uint8_t flags) noexcept -> bool
Definition http_tracecontext.h:60
SOURCEMETA_CORE_HTTP_EXPORT auto http_make_traceparent(const bool sampled) -> std::array< char, 55 >
SOURCEMETA_CORE_TEXT_EXPORT auto trim(const std::string_view input) noexcept -> std::string_view