-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmsg.h
More file actions
40 lines (34 loc) · 1.07 KB
/
msg.h
File metadata and controls
40 lines (34 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#ifndef _MSG_H
#define _MSG_H
#include <stdio.h> /* for printf() and fprintf() */
#include <sys/socket.h> /* for socket(), bind(), and connect() */
#include <arpa/inet.h> /* for sockaddr_in and inet_ntoa() */
#include <stdlib.h> /* for atoi() and exit() */
#include <string.h> /* for memset() */
#include <unistd.h> /* for close() */
#include <stdint.h>
struct message {
char msg[100];
uint32_t type;
};
struct queue {
int elements;
struct message m[5];
};
typedef struct {
enum {
Client_Handshake, Send, Retrieve
} request_Type; /* same size as an unsigned int */
uint32_t SenderId; /* unique client identifier */
uint32_t RecipientId; /* unique client identifier */
char message[100];
} ClientMessage; /* an unsigned int is 32 bits = 4 bytes */
typedef struct {
enum {
Server_Handshake, New, Old, No_Message
} messageType; /* same size as an unsigned int */
uint32_t SenderId; /* unique client identifier */
uint32_t RecipientId; /* unique client identifier */
char message[100];
} ServerMessage; /* an unsigned int is 32 bits = 4 bytes */
#endif //_MSG_H