aboutsummaryrefslogtreecommitdiff
path: root/protocol.h
diff options
context:
space:
mode:
authorsotech117 <michael_foiani@brown.edu>2023-09-15 01:10:57 -0400
committersotech117 <michael_foiani@brown.edu>2023-09-15 01:10:57 -0400
commitcbfafaabbd846e625796f275b2e843376385cc36 (patch)
tree3f3f59aa8ce02e3b11a097d0b6ef651bbb3db2b0 /protocol.h
parent003c34172ffa9c8256a3ec4db913c53c825c6c9f (diff)
work on server handling multiple clients with a fd set
Diffstat (limited to 'protocol.h')
-rw-r--r--protocol.h35
1 files changed, 29 insertions, 6 deletions
diff --git a/protocol.h b/protocol.h
index 0cdc998..b038901 100644
--- a/protocol.h
+++ b/protocol.h
@@ -1,16 +1,39 @@
#include <stdint.h> // 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