2023-10-08 21:22:21 +00:00
|
|
|
// =========================================
|
|
|
|
// | Spacewar-Messages.h |
|
|
|
|
// | Copyright (C) 2023, Barra Ó Catháin |
|
|
|
|
// | See end of file for copyright notice. |
|
|
|
|
// =========================================
|
|
|
|
#ifndef SPACEWAR_MESSAGES
|
|
|
|
#define SPACEWAR_MESSAGES
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
2023-10-13 13:44:24 +00:00
|
|
|
const char * messageStrings[] = {"HELLO", "GOODBYE", "PING", "PONG", "SECRET"};
|
2023-10-08 21:22:21 +00:00
|
|
|
|
2023-10-13 13:44:24 +00:00
|
|
|
typedef struct SpacewarMessage
|
2023-10-08 21:22:21 +00:00
|
|
|
{
|
|
|
|
uint8_t type;
|
2023-10-13 13:44:24 +00:00
|
|
|
uint32_t content;
|
|
|
|
} SpacewarMessage;
|
2023-10-08 21:22:21 +00:00
|
|
|
|
|
|
|
/* Message Types:
|
|
|
|
0 - HELLO: Contents sent to client indicate a given player number.
|
|
|
|
1 - GOODBYE: No contents, end the connection.
|
|
|
|
2 - PING: Contents indicate the missed amount of pongs.
|
|
|
|
3 - PONG: No contents.
|
2023-10-13 13:44:24 +00:00
|
|
|
4 - SECRET: Contents indicate the secret key that must be sent with UDP packets to the server.
|
2023-10-08 21:22:21 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#endif
|
|
|
|
// =========================================================
|
|
|
|
// | End of Spacewar-Messages.h, copyright notice follows. |
|
|
|
|
// =========================================================
|
|
|
|
|
|
|
|
// 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 <https://www.gnu.org/licenses/>.
|