1 #ifndef CONTROLREQUEST_H 2 #define CONTROLREQUEST_H 11 virtual const void* get_data()
const override {
return __data; }
12 virtual void* get_data()
override {
return __data; }
14 virtual const char* get_login()
const {
17 virtual const char* get_password()
const {
18 return __data+Block::LoginName;
21 virtual uint32_t get_length_data()
const override {
return LengthRequest;}
24 static constexpr
auto LengthRequest = Block::LoginName + Block::Password;
25 char __data[LengthRequest];
36 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
40 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
41 std::snprintf(__data, Block::LoginName,
"%s", login.data());
42 std::snprintf(__data+Block::LoginName, Block::Password,
"%s", password.data());
45 RegistrationRequest(request_ptr req_ptr,
const std::string& login,
const std::string& password) {
46 std::memcpy(header, req_ptr->get_header(), Block::Header);
48 std::snprintf(__data, Block::LoginName,
"%s", login.data());
49 std::snprintf(__data+Block::LoginName, Block::Password,
"%s", password.data());
52 std::memcpy(header, req_ptr->get_header(), Block::Header);
55 const TypeCommand type_request = TypeCommand::RegistrationRequest;
62 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
65 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
66 std::snprintf(__data, Block::LoginName,
"%s", login);
67 std::snprintf(__data+Block::LoginName, Block::Password,
"%s", password);
70 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
71 std::snprintf(__data, Block::LoginName,
"%s", login.data());
72 std::snprintf(__data+Block::LoginName, Block::Password,
"%s", password.data());
75 AutorisationRequest(request_ptr req_ptr,
const std::string& login,
const std::string& password) {
76 std::memcpy(header, req_ptr->get_header(), Block::Header);
78 std::snprintf(__data, Block::LoginName,
"%s", login.data());
79 std::snprintf(__data+Block::LoginName, Block::Password,
"%s", password.data());
82 std::memcpy(header, req_ptr->get_header(), Block::Header);
85 const TypeCommand type_request = TypeCommand::AuthorisationRequest;
92 using input_request_ptr = std::shared_ptr<InputRequest>;
93 using registr_request_ptr = std::shared_ptr<RegistrationRequest>;
94 using autor_request_ptr = std::shared_ptr<AutorisationRequest>;
99 std::ostream& operator<<(std::ostream& os,
const InputRequest& request);
100 #endif // CONTROLREQUEST_H
Definition: input_request.h:59
The RegistrationRequest class.
Definition: input_request.h:33