-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtranHandler.cpp
More file actions
executable file
·49 lines (39 loc) · 949 Bytes
/
tranHandler.cpp
File metadata and controls
executable file
·49 lines (39 loc) · 949 Bytes
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
/*
* tranhandler class for handling packet sending and receiving
* This is just a template and you should implement your own functions using specific tech
* Last modified for release!
*/
#include "tranHandler.h"
#include "log.h"
#include "asyncBuffer.h"
extern Log* logger;
extern AsyncBuffer* globalBuf;
/* Constructor */
TranHandler::TranHandler()
{
}
/* Destructor */
TranHandler::~TranHandler()
{
}
/* processing the received packets */
void TranHandler::th_process_packet(Packet* pkt)
{
if (pkt->is_tcp())
{
logger->PrintDebug("[%s:%d] received a TCP packet\n", __FILE__, __LINE__);
globalBuf->push(pkt);
}
else if (pkt->is_icmp())
{
logger->PrintDebug("[%s:%d] received an ICMP packet\n", __FILE__, __LINE__);
pkt->print();
delete pkt;
}
else
{
logger->PrintDebug("[%s:%d] received an unknown packet\n", __FILE__, __LINE__);
pkt->print();
delete pkt;
}
}