-
Notifications
You must be signed in to change notification settings - Fork 51
/
Copy pathIpFragment.cpp
70 lines (55 loc) · 1.21 KB
/
IpFragment.cpp
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
70
#include <iostream>
#include "IpFragment.h"
namespace FeatureExtractor {
using namespace std;
IpFragment::IpFragment()
: Packet()
, ip_flag_mf(0), ip_frag_offset(0), ip_payload_length(0)
{
}
IpFragment::~IpFragment()
{
}
uint16_t IpFragment::get_ip_id() const
{
return ip_id;
}
void IpFragment::set_ip_id(uint16_t ip_id)
{
this->ip_id = ip_id;
}
bool IpFragment::get_ip_flag_mf() const
{
return ip_flag_mf;
}
void IpFragment::set_ip_flag_mf(bool ip_flag_mf)
{
this->ip_flag_mf = ip_flag_mf;
}
uint16_t IpFragment::get_ip_frag_offset() const
{
return ip_frag_offset;
}
void IpFragment::set_ip_frag_offset(uint16_t ip_frag_offset)
{
this->ip_frag_offset = ip_frag_offset;
}
size_t IpFragment::get_ip_payload_length() const
{
return ip_payload_length;
}
void IpFragment::set_ip_payload_length(size_t ip_payload_length)
{
this->ip_payload_length = ip_payload_length;
}
void IpFragment::print() const
{
Packet::print_human();
if (get_eth_type() == IPV4) {
cout << " ip.flag_mf=" << get_ip_flag_mf()
<< ", ip.frag_offset=" << get_ip_frag_offset()
<< ", ip.id=0x" << hex << get_ip_id() << dec
<< ", payload_length=" << get_ip_payload_length() << endl;
}
}
}