-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIface.hpp
69 lines (50 loc) · 1.15 KB
/
Iface.hpp
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
* File: Iface.hpp
* Author: xpalam00
*
* Created on 12. únor 2012, 16:16
*/
#ifndef IFACE_HPP
#define IFACE_HPP
#include <iostream>
#include <string>
#include <pthread.h>
#include <cstdlib>
#include <pcap/pcap.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include "Frame.hpp"
using namespace std;
class Switch;
class Iface
{
public:
Iface(Switch *);
virtual ~Iface();
string getName() const;
void setName(string);
static void* _entry(void*);
void* main();
static void _gotPacket(u_char *, const struct pcap_pkthdr *, const u_char *);
unsigned int getSentB();
unsigned int getSentFrm();
unsigned int getRecvB();
unsigned int getRecvFrm();
MacAddress *macAddress;
void sendFrame(Frame *);
void sendFrame(u_char *packet, int size);
void sentFrame(unsigned int);
pcap_t *pcap_handle;
private:
string name; /** <<< Jméno zařízení vhodné pro pcap_open_live() */
void processIncomingPacket(const struct pcap_pkthdr *, u_char *);
unsigned int sentB;
unsigned int sentFrm;
unsigned int recvB;
unsigned int recvFrm;
Switch *mainSwitch;
pthread_t _id;
};
#endif /* IFACE_HPP */