sha512sum
a98f2e8552
All checks were successful
PR Check / on-push-commit-check (push) Successful in 10m25s
59 lines
2 KiB
C++
59 lines
2 KiB
C++
#pragma once
|
|
#include <libxml++/libxml++.h>
|
|
|
|
#include <larra/utils.hpp>
|
|
#include <optional>
|
|
#include <vector>
|
|
|
|
namespace larra::xmpp {
|
|
|
|
enum class Required : bool { kNotRequired = false, kRequired = true };
|
|
|
|
struct SaslMechanisms {
|
|
std::vector<std::string> mechanisms{};
|
|
|
|
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> SaslMechanisms;
|
|
};
|
|
|
|
struct StreamFeatures {
|
|
static constexpr auto kDefaultName = "stream:features";
|
|
struct StartTlsType {
|
|
Required required;
|
|
[[nodiscard]] constexpr auto Required(Required required) const -> StartTlsType {
|
|
return {required};
|
|
};
|
|
|
|
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> StartTlsType;
|
|
};
|
|
struct BindType {
|
|
Required required;
|
|
[[nodiscard]] constexpr auto Required(Required required) const -> BindType {
|
|
return {required};
|
|
};
|
|
|
|
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> BindType;
|
|
};
|
|
std::optional<StartTlsType> startTls;
|
|
std::optional<BindType> bind;
|
|
SaslMechanisms saslMechanisms;
|
|
std::vector<const xmlpp::Node*> others;
|
|
template <typename Self>
|
|
[[nodiscard]] constexpr auto StartTls(this Self&& self, std::optional<StartTlsType> value) {
|
|
return utils::FieldSetHelper::With<"startTls">(std::forward<Self>(self), std::move(value));
|
|
}
|
|
template <typename Self>
|
|
[[nodiscard]] constexpr auto Bind(this Self&& self, std::optional<BindType> value) {
|
|
return utils::FieldSetHelper::With<"bind">(std::forward<Self>(self), std::move(value));
|
|
}
|
|
template <typename Self>
|
|
[[nodiscard]] constexpr auto SaslMechanisms(this Self&& self, SaslMechanisms value) {
|
|
return utils::FieldSetHelper::With<"saslMechanisms">(std::forward<Self>(self), std::move(value));
|
|
}
|
|
template <typename Self>
|
|
[[nodiscard]] constexpr auto Others(this Self&& self, std::vector<const xmlpp::Node*> value) {
|
|
return utils::FieldSetHelper::With<"others">(std::forward<Self>(self), std::move(value));
|
|
}
|
|
[[nodiscard]] static auto Parse(const xmlpp::Element*) -> StreamFeatures;
|
|
};
|
|
|
|
} // namespace larra::xmpp
|