Telnet++ 4.0.0.9
A C++ library for interacting with Telnet streams
Loading...
Searching...
No Matches
subnegotiation.hpp
1#pragma once
2
3#include "telnetpp/core.hpp"
4
5#include <iosfwd>
6#include <utility>
7
8namespace telnetpp {
9
10//* =========================================================================
12//* =========================================================================
13class TELNETPP_EXPORT subnegotiation
14{
15public:
16 //* =====================================================================
18 //* =====================================================================
19 constexpr subnegotiation(option_type option, bytes content) noexcept
20 : option_(std::move(option)), content_(std::move(content))
21 {
22 }
23
24 //* =====================================================================
26 //* =====================================================================
27 [[nodiscard]] constexpr option_type option() const noexcept
28 {
29 return option_;
30 }
31
32 //* =====================================================================
34 //* =====================================================================
35 [[nodiscard]] constexpr bytes content() const noexcept
36 {
37 return content_;
38 }
39
40private:
41 option_type option_;
42 bytes content_;
43};
44
45//* =========================================================================
47//* =========================================================================
48constexpr inline bool operator==(
49 subnegotiation const &lhs, subnegotiation const &rhs) noexcept
50{
51 return lhs.option() == rhs.option()
52 && telnetpp::bytes_equal(lhs.content(), rhs.content());
53}
54
55//* =========================================================================
57//* =========================================================================
58TELNETPP_EXPORT
59std::ostream &operator<<(std::ostream &out, subnegotiation const &sub);
60
61} // namespace telnetpp
An class that encapsulates one side of a Telnet option.
Definition option.hpp:46
A class that encapsulates a Telnet subnegotiation.
Definition subnegotiation.hpp:14
constexpr subnegotiation(option_type option, bytes content) noexcept
Constructor.
Definition subnegotiation.hpp:19
constexpr bytes content() const noexcept
Returns the content for this subnegotiation.
Definition subnegotiation.hpp:35
constexpr option_type option() const noexcept
Returns the option for this subnegotiation.
Definition subnegotiation.hpp:27