-
Notifications
You must be signed in to change notification settings - Fork 0
/
datatypes.h
51 lines (40 loc) · 1.14 KB
/
datatypes.h
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
41
42
43
44
45
46
47
48
49
50
51
// John Keech, UIN:819000713, CSCE 438 - HW2
#ifndef DATATYPES_H
#define DATATYPES_H
#define DEBUG false
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <errno.h>
#include <queue>
#include <map>
#include <set>
#include <pthread.h>
#include <unistd.h>
#include"server_stub.h"
//#include "lsp_server.h"
//#include "lspmessage.pb.h"
typedef enum {
DISCONNECTED, CONNECT_SENT, CONNECTED
} Status;
typedef struct {
/*const char *host;
unsigned int port;
int fd;*/
unsigned int port;
struct sockaddr_in *addr;
Status status;
unsigned int id;
unsigned int lastSentSeq;
unsigned int lastReceivedSeq;
unsigned int lastReceivedAck;
unsigned int epochsSinceLastMessage;
std::queue<struct message*> outbox;
} Connection;
//static std::map<unsigned int,Connection*> global_clients;
//static pthread_mutex_t map_lock;
#endif