/* LibreFront --- an OpenFront clone Copyright (C) 2025 Adrien Jaguenet Copyright (C) 2025 Emil Kosz This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see . */ #pragma once #include #include "ClientRequest.h" #include "ServerResponse.h" #define PROTOCOL_VERSION 0x1 typedef enum { RESPONSE_ERROR = 0xffffffff, } ResponseType; typedef enum { REQUEST_HELLO = 0x00000001, REQUEST_JOINGAME = 0x00000002, } RequestType; typedef struct { guint32 version; guint32 type; guint32 data_size; } MessageHeader; typedef struct { MessageHeader header; void* data; } Message; /* @param stream: input stream (from a socket ideally) * @param message: message structure that will be read into * @return -1 on error * */ int Message_read(GInputStream* stream, Message* message);