A very messy demo of a broadcast
This commit is contained in:
+33
@@ -0,0 +1,33 @@
|
||||
#define MESSAGE_LENGTH 256
|
||||
#define COMMAND_LENGTH 16
|
||||
|
||||
typedef enum {
|
||||
Message = 1,
|
||||
Login,
|
||||
Logout,
|
||||
Hearbeat,
|
||||
List_clients,
|
||||
Mute,
|
||||
Unmute,
|
||||
Signal
|
||||
} CommandType;
|
||||
|
||||
typedef enum {
|
||||
ACK_ACCEPTED = 0,
|
||||
ACK_DELIVERED,
|
||||
ERR_UNKNOWN_COMMAND,
|
||||
ERR_NOT_LOGGED_IN,
|
||||
ERR_ALREADY_LOGGED_IN,
|
||||
ERR_USER_NOT_FOUND,
|
||||
ERR_USER_MUTED,
|
||||
ERR_INVALID_FORMAT
|
||||
} Signal_t;
|
||||
|
||||
typedef struct {
|
||||
CommandType mtype;
|
||||
Signal_t stype; // Used with mtype = signal. Responses from the server - to specify errors or acks
|
||||
char sender[COMMAND_LENGTH]; // Who sent the message
|
||||
char command[COMMAND_LENGTH]; // Functions as an attribute to mtype -
|
||||
// nicknames, id to send/mute to
|
||||
char message[MESSAGE_LENGTH]; // Actual message content
|
||||
} msgbuf_t;
|
||||
Reference in New Issue
Block a user