1 #ifndef TRANSPORTREQUEST_H 2 #define TRANSPORTREQUEST_H 9 std::memcpy(header, &PROTOCOL_VERS, Block::VersionProtocol);
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 {
27 std::memcpy(&roomid, __data + Block::LoginName,
sizeof(identifier_t));
31 virtual uint32_t get_length_data()
const override {
return LengthRequest;}
34 static constexpr uint32_t LengthRequest = Block::LoginName + Block::RoomId + Block::TextMessage;
35 char __data[LengthRequest];
42 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
45 TextRequest(
const std::string& login, identifier_t roomid,
const std::string& text) {
47 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
48 std::snprintf(__data, Block::LoginName,
"%s", login.data());
49 std::memcpy(__data+Block::LoginName, &roomid, Block::RoomId);
50 std::snprintf(__data+Block::LoginName+Block::RoomId, Block::TextMessage,
"%s", text.data());
54 std::memcpy(header, request->get_header(), Block::Header);
55 std::memcpy(header, &PROTOCOL_VERS, Block::VersionProtocol);
56 std::memcpy(header+Block::VersionProtocol, &type_request, Block::Command);
59 const char* get_message()
const {
60 return __data+Block::LoginName+Block::RoomId;
63 const TypeCommand type_request = TypeCommand::EchoRequest;
66 using text_request_ptr = std::shared_ptr<TextRequest>;
68 #endif // TRANSPORTREQUEST_H
Definition: transport_request.h:6
Definition: transport_request.h:38
virtual identifier_t get_roomid() const
Definition: transport_request.h:18