From cbfafaabbd846e625796f275b2e843376385cc36 Mon Sep 17 00:00:00 2001 From: sotech117 Date: Fri, 15 Sep 2023 01:10:57 -0400 Subject: work on server handling multiple clients with a fd set --- protocol.h | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) (limited to 'protocol.h') diff --git a/protocol.h b/protocol.h index 0cdc998..b038901 100644 --- a/protocol.h +++ b/protocol.h @@ -1,16 +1,39 @@ #include // Provides uint8_t, int8_t, etc. -struct snowcast_message { - uint8_t type; - uint16_t number; +// client to server messages (commands) + +struct Command { + uint8_t commandType; + u_int16_t number; +} __attribute__((packed)); + +struct Hello { + uint8_t commandType; + uint16_t udpPort; +} __attribute__((packed)); +struct SetStation { + uint8_t commandType; + uint16_t stationNumber; } __attribute__((packed)); +// server to client message (replies) struct Welcome { uint8_t replyType; uint16_t numStations; } __attribute__((packed)); -struct Hello { - uint8_t commandType; - uint16_t udpPort; +struct Reply { + uint8_t replyType; + uint8_t stringSize; + char *string; +} __attribute__((packed)); +struct Announce { + uint8_t replyType; + uint8_t songnameSize; + char *songname; } __attribute__((packed)); +struct InvalidCommand { + uint8_t replyType; + uint8_t replyStringSize; + char *replyString; +} __attribute__((packed)); \ No newline at end of file -- cgit v1.2.3-70-g09d2