Files
C-IPC/commands.h
T

38 lines
868 B
C

#define MESSAGE_LENGTH 256
#define COMMAND_LENGTH 16
#define HEARTBEAT_INTERVAL 3 // in seconds
#define HEARTBEAT_TIMEOUT 10
typedef enum {
Message = 1,
Login,
Logout,
Hearbeat,
List_clients,
Mute,
Unmute,
Signal,
Inbox
} 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;