group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
ChatProtocol.hpp File Reference

Bounded text-chat packet helpers shared by client, server, and tests. More...

#include "ecs/components/ClientId.hpp"
#include <cstdint>
#include <optional>
#include <span>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for ChatProtocol.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  net::chat::ClientTextChat
struct  net::chat::ServerTextChat

Namespaces

namespace  net
namespace  net::chat

Functions

bool net::chat::isValidUtf8 (std::string_view text) noexcept
std::string net::chat::sanitizeUtf8 (std::string_view text)
std::vector< std::uint8_t > net::chat::encodeClientText (std::uint16_t clientSeq, std::string_view text)
std::vector< std::uint8_t > net::chat::encodeServerText (ClientId sender, std::uint32_t serverSeq, std::string_view text)
std::optional< ClientTextChatnet::chat::decodeClientText (std::span< const std::uint8_t > payload)
std::optional< ServerTextChatnet::chat::decodeServerText (std::span< const std::uint8_t > payload)

Variables

constexpr std::uint16_t net::chat::k_maxChatBytes = 240

Detailed Description

Bounded text-chat packet helpers shared by client, server, and tests.