libtins
4.5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
tins
pktap.h
1
/*
2
* Copyright (c) 2017, Matias Fontanini
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions are
7
* met:
8
*
9
* * Redistributions of source code must retain the above copyright
10
* notice, this list of conditions and the following disclaimer.
11
* * Redistributions in binary form must reproduce the above
12
* copyright notice, this list of conditions and the following disclaimer
13
* in the documentation and/or other materials provided with the
14
* distribution.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
*
28
*/
29
30
#ifndef TINS_PKTAP_H
31
#define TINS_PKTAP_H
32
33
#include <tins/pdu.h>
34
#include <tins/macros.h>
35
36
// This class is only available if pcap is enabled
37
#ifdef TINS_HAVE_PCAP
38
39
namespace
Tins
{
40
44
class
TINS_API PKTAP :
public
PDU
{
45
public
:
49
static
const
PDU::PDUType pdu_flag = PDU::PKTAP;
50
54
PKTAP();
55
67
PKTAP(
const
uint8_t* buffer, uint32_t total_sz);
68
73
PDUType pdu_type()
const
{
74
return
pdu_flag;
75
}
76
83
uint32_t header_size()
const
;
84
88
PKTAP* clone()
const
{
89
return
new
PKTAP(*
this
);
90
}
91
private
:
92
struct
pktap_header {
93
uint32_t length;
94
uint32_t next;
95
uint32_t dlt;
96
uint8_t pth_ifname[24];
97
uint32_t flags;
98
uint32_t protocol_family;
99
uint32_t header_length;
100
uint32_t trailer_length;
101
uint32_t pid;
102
uint8_t command[20];
103
uint32_t service_class;
104
uint16_t interface_type;
105
uint16_t interface_unit;
106
uint32_t epid;
107
uint8_t ecommand[20];
108
};
109
110
void
write_serialization(uint8_t* buffer, uint32_t total_sz);
111
112
pktap_header header_;
113
};
114
115
}
// Tins
116
117
#endif
// TINS_HAVE_PCAP
118
119
#endif
// TINS_PKTAP_H
Tins::PDU
Base class for protocol data units.
Definition
pdu.h:107
Tins
The Tins namespace.
Definition
address_range.h:38
Generated on
for libtins by
1.17.0