diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-09-23 17:30:45 -0400 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-09-23 17:30:45 -0400 |
commit | 3b2aa8c271bf5cd5497decb6577afe5fd7339f57 (patch) | |
tree | bc1d39ad76b15f58ddf61385645fa87a59fb1157 /protocol.h | |
parent | b417bcc57b9fd49f360087c32c97293a6bc7d2be (diff) | |
parent | 1e9ac5407ef4f2cddc745f35f33a860446526cea (diff) |
merge post-warmup with main
Diffstat (limited to 'protocol.h')
-rw-r--r-- | protocol.h | 35 |
1 files changed, 30 insertions, 5 deletions
@@ -1,16 +1,41 @@ #include <stdint.h> // Provides uint8_t, int8_t, etc. -struct snowcast_message { - uint8_t type; +// client to server messages (commands) + +struct Command { + uint8_t commandType; uint16_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; +} reply_t __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)); + +int send_all(int sock, char *buf, int *len); +int recv_all(int sock, char *buf, int *len); |