libtins
4.5
Toggle main menu visibility
Loading...
Searching...
No Matches
include
tins
utils
radiotap_writer.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
#include <tins/config.h>
31
32
#if !defined(TINS_RADIOTAP_WRITER_H) && defined(TINS_HAVE_DOT11)
33
34
#define TINS_RADIOTAP_WRITER_H
35
36
#include <vector>
37
#include <stdint.h>
38
#include <tins/radiotap.h>
39
40
namespace
Tins
{
41
namespace
Utils
{
42
43
class
RadioTapParser
;
44
55
class
RadioTapWriter
{
56
public
:
63
RadioTapWriter
(std::vector<uint8_t>& buffer);
64
73
void
write_option
(
const
RadioTap::option
& option);
74
private
:
75
std::vector<uint8_t> build_padding_vector(
const
uint8_t* last_ptr,
RadioTapParser
& parser);
76
void
update_paddings(
const
std::vector<uint8_t>& paddings, uint32_t offset);
77
78
std::vector<uint8_t>& buffer_;
79
};
80
81
}
// Utils
82
}
// Tins
83
84
#endif
// TINS_RADIOTAP_WRITER_H
RadioTapWriter::RadioTapWriter
RadioTapWriter(std::vector< uint8_t > &buffer)
Constructs a RadioTapWriter object.
Definition
radiotap_writer.cpp:52
Tins::RadioTap::option
PDUOption< RadioTap::PresentFlags, RadioTap > option
Definition
radiotap.h:147
Tins::Utils::RadioTapParser
Allows parsing RadioTap options.
Definition
radiotap_parser.h:52
Tins::Utils::RadioTapWriter::RadioTapWriter
RadioTapWriter(std::vector< uint8_t > &buffer)
Constructs a RadioTapWriter object.
Definition
radiotap_writer.cpp:52
Tins::Utils::RadioTapWriter::write_option
void write_option(const RadioTap::option &option)
Writes an option, adding/removing padding as needed.
Definition
radiotap_writer.cpp:56
Tins::Utils
Network utils namespace.
Definition
utils.h:50
Tins
The Tins namespace.
Definition
address_range.h:38
Generated on
for libtins by
1.17.0