aboutsummaryrefslogtreecommitdiff
path: root/include/sibs/Message.hpp
blob: b6eb85880ea0fba53bf5c910b7c0187344db7e8b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#pragma once

#include "../types.hpp"
#include <vector>

namespace sibs
{
    enum class MessageType : u8
    {
        NONE,
        DATA,
        SUBSCRIBE,
        UNSUBSCRIBE
    };

    class Message
    {
    public:
        Message(MessageType messageType);

        void append(const void *data, const usize size);

        usize getDataSize() const { return rawData.size() - 1; }
        usize getRawSize() const { return rawData.size(); }

        const u8* data() const { return rawData.data(); }
    private:
        std::vector<u8> rawData;
    };
}