blob: 2dedc85d29997f5afb86ed412e364b0759d7e38c [file] [log] [blame]
Nan Zhou14fe6692021-06-08 16:35:44 -07001// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#pragma once
16#include "nemora_types.hpp"
17
18#include <arpa/inet.h>
19
20#include <cstddef>
21#include <cstdint>
22#include <memory>
23#include <string>
24
25using std::int32_t;
26using std::size_t;
27using std::uint64_t;
28
29class Serializer
30{
31 public:
32 static std::string Serialize(const NemoraDatagram* dgram);
33
34 private:
35 static std::string SerializeEvent(const NemoraEvent* event);
36
37 static constexpr uint64_t NEMORA_EVENT_PB_MAGIC = 0x890ebd38ec325800;
38};