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