-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHelper.h
53 lines (43 loc) · 980 Bytes
/
Helper.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
52
53
#ifndef HELPER_H_
#define HELPER_H_
#include <string>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/time.h>
#include <unistd.h>
#include <netdb.h>
#include <sstream>
#include <arpa/inet.h>
#include <pthread.h>
using namespace std;
extern int infinity;
extern int ttl;
extern int period;
extern int splitHorizon;
extern int portNum;
typedef string IP_Address;
typedef struct sockaddr_in HostAddr;
typedef struct AdversisementEntry{
IP_Address ipAddr;
int cost;
}AdvertisementEntry;
typedef struct nodeDetails{
IP_Address nextHop;
int cost;
}nodeDetails;
typedef struct receiverDetails{
IP_Address host;
HostAddr recvFrm;
int sockFd;
}receiverDetails;
typedef struct Advertisements{
AdvertisementEntry Adversisement[100];
}Advertisements;
void error(const char* msg);
HostAddr *getHostIp(IP_Address name);
extern Advertisements advertisement;
#endif /* HELPER_H_ */