-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsers.h
40 lines (33 loc) · 878 Bytes
/
parsers.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
#ifndef _PARSERS_
#define _PARSERS_
#include <stdlib.h>
#include <poll.h>
#include <iostream>
#include <string>
#include <sstream>
#include <algorithm>
#include <iterator>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
using namespace std;
// Traffic line types
typedef enum {INVALID, DELAY, ROUTE} T_TYPES;
typedef struct {
int swiID;
int srcIP;
int dstIP;
} RoutePacket;
typedef struct {
int swiID;
clock_t delay;
} DelayPacket;
T_TYPES getTrafficFileLineType(string &line);
RoutePacket parseTrafficRouteLine(string &line);
DelayPacket parseTrafficDelayLine(string &line);
int parseAddress(const char* id, const char* servAddress, const char* portNum,
struct addrinfo *hints, struct addrinfo **res);
int parsePort(int maxSwi, const char* portNum, struct addrinfo *hints,
struct addrinfo **res);
#endif