Telnet++ 4.0.0.9
A C++ library for interacting with Telnet streams
Loading...
Searching...
No Matches
server.hpp
1#pragma once
2
3#include "telnetpp/options/new_environ/protocol.hpp"
4#include "telnetpp/server_option.hpp"
5
6#include <map>
7
9
10//* =========================================================================
13//* =========================================================================
14class TELNETPP_EXPORT server final : public server_option
15{
16public:
17 //* =====================================================================
19 //* =====================================================================
20 explicit server(telnetpp::session &sess) noexcept;
21
22 //* =====================================================================
24 //* =====================================================================
25 void set_variable(telnetpp::bytes name, telnetpp::bytes value);
26
27 //* =====================================================================
29 //* =====================================================================
30 void delete_variable(telnetpp::bytes name);
31
32 //* =====================================================================
34 //* =====================================================================
35 void set_user_variable(telnetpp::bytes name, telnetpp::bytes value);
36
37 //* =====================================================================
39 //* =====================================================================
40 void delete_user_variable(telnetpp::bytes name);
41
42private:
43 using variable_storage =
44 std::map<telnetpp::byte_storage, telnetpp::byte_storage>;
45
46 variable_storage variables_;
47 variable_storage user_variables_;
48
49 //* =====================================================================
52 //* =====================================================================
53 void handle_subnegotiation(telnetpp::bytes data) override;
54
55 //* =====================================================================
57 //* =====================================================================
58 void broadcast_variable_update(
59 variable_type type, telnetpp::bytes name, telnetpp::bytes value);
60
61 //* =====================================================================
63 //* =====================================================================
64 void broadcast_variable_deletion(variable_type type, telnetpp::bytes name);
65
66 //* =====================================================================
68 //* =====================================================================
69 void append_variable(
70 telnetpp::byte_storage &storage,
71 variable_type type,
72 telnetpp::bytes name);
73
74 //* =====================================================================
76 //* =====================================================================
77 void append_variable(
78 telnetpp::byte_storage &storage,
79 variable_type type,
80 telnetpp::bytes name,
81 telnetpp::bytes value);
82};
83
84} // namespace telnetpp::options::new_environ
An implementation of the server side of the Telnet New-Environ option.
Definition server.hpp:15
A class that represents a Telnet option's server side. That is, the side that receives DO and DONT ne...
Definition server_option.hpp:35
An abstraction for a Telnet session.
Definition session.hpp:141
An implementation of the Telnet Environment option.
Definition client.hpp:6
variable_type
An enumeration of the type of variables that NEW_ENVIRON handles.
Definition protocol.hpp:13