1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-27 20:24:26 +01:00

Fixed Dot11 documentation.

This commit is contained in:
Matias Fontanini
2012-10-05 12:13:06 -03:00
parent da60d99f98
commit 676bea9035
7 changed files with 257 additions and 239 deletions

View File

@@ -85,11 +85,16 @@ void Dot11::parse_tagged_parameters(const uint8_t *buffer, uint32_t total_sz) {
}
void Dot11::add_tagged_option(TaggedOption opt, uint8_t len, const uint8_t *val) {
uint32_t opt_size = len + (sizeof(uint8_t) << 1);
uint32_t opt_size = len + sizeof(uint8_t) * 2;
_options.push_back(dot11_option((uint8_t)opt, len, val));
_options_size += opt_size;
}
void Dot11::add_tagged_option(const dot11_option &opt) {
_options.push_back(opt);
_options_size += opt.data_size() + sizeof(uint8_t) * 2;
}
const Dot11::dot11_option *Dot11::search_option(TaggedOption opt) const {
for(std::list<dot11_option>::const_iterator it = _options.begin(); it != _options.end(); ++it)
if(it->option() == (uint8_t)opt)
@@ -244,15 +249,6 @@ Dot11 *Dot11::from_bytes(const uint8_t *buffer, uint32_t total_sz) {
ret = new Dot11(buffer, total_sz);
return ret;
}
void Dot11::copy_80211_fields(const Dot11 *other) {
std::memcpy(&_header, &other->_header, sizeof(_header));
_iface = other->_iface;
_options_size = other->_options_size;
for(std::list<dot11_option>::const_iterator it = other->_options.begin(); it != other->_options.end(); ++it)
_options.push_back(dot11_option(it->option(), it->data_size(), it->data_ptr()));
}
/* Dot11ManagementFrame */
Dot11ManagementFrame::Dot11ManagementFrame(const uint8_t *buffer, uint32_t total_sz)
@@ -281,13 +277,6 @@ const address_type &src_hw_addr)
addr2(src_hw_addr);
}
void Dot11ManagementFrame::copy_ext_header(const Dot11ManagementFrame* other) {
Dot11::copy_80211_fields(other);
std::memcpy(&_ext_header, &other->_ext_header, sizeof(_ext_header));
//std::memcpy(_addr4, other->_addr4, 6);
_addr4 = other->_addr4;
}
uint32_t Dot11ManagementFrame::header_size() const {
uint32_t sz = Dot11::header_size() + sizeof(_ext_header);
if (this->from_ds() && this->to_ds())