mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Code cleanup and use same syntax on the entire project
Initial code cleanup More code cleanup Cleanup more code Cleanup Dot11 code Fix OSX build issue Cleanup examples Fix ref and pointer declaration syntax Fix braces
This commit is contained in:
@@ -56,8 +56,8 @@ public:
|
||||
* \param dst_hw_addr The destination hardware address.
|
||||
* \param src_hw_addr The source hardware address.
|
||||
*/
|
||||
Dot11Disassoc(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
Dot11Disassoc(const address_type& dst_hw_addr = address_type(),
|
||||
const address_type& src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructs a Dot11Disassoc object from a buffer and
|
||||
@@ -73,14 +73,16 @@ public:
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11Disassoc(const uint8_t *buffer, uint32_t total_sz);
|
||||
Dot11Disassoc(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Getter for the reason code field.
|
||||
*
|
||||
* \return The stored reason code.
|
||||
*/
|
||||
uint16_t reason_code() const { return Endian::le_to_host(_body.reason_code); }
|
||||
uint16_t reason_code() const {
|
||||
return Endian::le_to_host(body_.reason_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Setter for the reason code field.
|
||||
@@ -101,7 +103,9 @@ public:
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return pdu_flag; }
|
||||
PDUType pdu_type() const {
|
||||
return pdu_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check wether this PDU matches the specified flag.
|
||||
@@ -117,17 +121,17 @@ public:
|
||||
*
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
Dot11Disassoc *clone() const {
|
||||
Dot11Disassoc* clone() const {
|
||||
return new Dot11Disassoc(*this);
|
||||
}
|
||||
private:
|
||||
struct DisassocBody {
|
||||
struct dot11_disassoc_body {
|
||||
uint16_t reason_code;
|
||||
};
|
||||
|
||||
void write_fixed_parameters(Memory::OutputMemoryStream& stream);
|
||||
|
||||
DisassocBody _body;
|
||||
dot11_disassoc_body body_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -150,8 +154,8 @@ public:
|
||||
* \param dst_hw_addr The destination hardware address.
|
||||
* \param src_hw_addr The source hardware address.
|
||||
*/
|
||||
Dot11AssocRequest(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
Dot11AssocRequest(const address_type& dst_hw_addr = address_type(),
|
||||
const address_type& src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructs a Dot11AssocRequest object from a buffer
|
||||
@@ -167,7 +171,7 @@ public:
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11AssocRequest(const uint8_t *buffer, uint32_t total_sz);
|
||||
Dot11AssocRequest(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information.
|
||||
@@ -175,7 +179,9 @@ public:
|
||||
* \return A constant refereence to the stored Capabilities
|
||||
* Information field.
|
||||
*/
|
||||
const capability_information& capabilities() const { return _body.capability;}
|
||||
const capability_information& capabilities() const {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information.
|
||||
@@ -183,14 +189,18 @@ public:
|
||||
* \return A refereence to the stored Capabilities Information
|
||||
* field.
|
||||
*/
|
||||
capability_information& capabilities() { return _body.capability;}
|
||||
capability_information& capabilities() {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the listen interval field.
|
||||
*
|
||||
* \return The stored listen interval field.
|
||||
*/
|
||||
uint16_t listen_interval() const { return Endian::le_to_host(_body.listen_interval); }
|
||||
uint16_t listen_interval() const {
|
||||
return Endian::le_to_host(body_.listen_interval);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Setter for the listen interval field.
|
||||
@@ -211,7 +221,9 @@ public:
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return pdu_flag; }
|
||||
PDUType pdu_type() const {
|
||||
return pdu_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check wether this PDU matches the specified flag.
|
||||
@@ -227,18 +239,18 @@ public:
|
||||
*
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
Dot11AssocRequest *clone() const {
|
||||
Dot11AssocRequest* clone() const {
|
||||
return new Dot11AssocRequest(*this);
|
||||
}
|
||||
private:
|
||||
struct AssocReqBody {
|
||||
struct dot11_assoc_request_body {
|
||||
capability_information capability;
|
||||
uint16_t listen_interval;
|
||||
};
|
||||
|
||||
void write_fixed_parameters(Memory::OutputMemoryStream& stream);
|
||||
|
||||
AssocReqBody _body;
|
||||
dot11_assoc_request_body body_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -261,8 +273,8 @@ public:
|
||||
* \param dst_hw_addr The destination hardware address.
|
||||
* \param src_hw_addr The source hardware address.
|
||||
*/
|
||||
Dot11AssocResponse(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
Dot11AssocResponse(const address_type& dst_hw_addr = address_type(),
|
||||
const address_type& src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructor which creates a Dot11AssocResponse object
|
||||
@@ -278,7 +290,7 @@ public:
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11AssocResponse(const uint8_t *buffer, uint32_t total_sz);
|
||||
Dot11AssocResponse(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information field.
|
||||
@@ -286,7 +298,9 @@ public:
|
||||
* \return A constant reference to the stored Capabilities
|
||||
* Information field.
|
||||
*/
|
||||
const capability_information& capabilities() const { return _body.capability;}
|
||||
const capability_information& capabilities() const {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information field.
|
||||
@@ -294,21 +308,27 @@ public:
|
||||
* \return A reference to the stored Capabilities
|
||||
* Information field.
|
||||
*/
|
||||
capability_information& capabilities() { return _body.capability;}
|
||||
capability_information& capabilities() {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the status code field.
|
||||
*
|
||||
* \return The stored status code.
|
||||
*/
|
||||
uint16_t status_code() const { return Endian::le_to_host(_body.status_code); }
|
||||
uint16_t status_code() const {
|
||||
return Endian::le_to_host(body_.status_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the AID field.
|
||||
*
|
||||
* \return The stored AID field.
|
||||
*/
|
||||
uint16_t aid() const { return Endian::le_to_host(_body.aid); }
|
||||
uint16_t aid() const {
|
||||
return Endian::le_to_host(body_.aid);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Setter for the status code.
|
||||
@@ -336,7 +356,9 @@ public:
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return pdu_flag; }
|
||||
PDUType pdu_type() const {
|
||||
return pdu_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check wether this PDU matches the specified flag.
|
||||
@@ -352,11 +374,11 @@ public:
|
||||
*
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
Dot11AssocResponse *clone() const {
|
||||
Dot11AssocResponse* clone() const {
|
||||
return new Dot11AssocResponse(*this);
|
||||
}
|
||||
private:
|
||||
struct AssocRespBody {
|
||||
struct dot11_assoc_response_body {
|
||||
capability_information capability;
|
||||
uint16_t status_code;
|
||||
uint16_t aid;
|
||||
@@ -364,7 +386,7 @@ private:
|
||||
|
||||
void write_fixed_parameters(Memory::OutputMemoryStream& stream);
|
||||
|
||||
AssocRespBody _body;
|
||||
dot11_assoc_response_body body_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -387,8 +409,8 @@ public:
|
||||
* \param dst_hw_addr The destination hardware address.
|
||||
* \param src_hw_addr The source hardware address.
|
||||
*/
|
||||
Dot11ReAssocRequest(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
Dot11ReAssocRequest(const address_type& dst_hw_addr = address_type(),
|
||||
const address_type& src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructs a Dot11AssocRequest object from a buffer
|
||||
@@ -404,7 +426,7 @@ public:
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11ReAssocRequest(const uint8_t *buffer, uint32_t total_sz);
|
||||
Dot11ReAssocRequest(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information.
|
||||
@@ -412,7 +434,9 @@ public:
|
||||
* \return A constant reference to the stored Capabilities
|
||||
* Information field.
|
||||
*/
|
||||
const capability_information& capabilities() const { return _body.capability;}
|
||||
const capability_information& capabilities() const {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information.
|
||||
@@ -420,21 +444,27 @@ public:
|
||||
* \return A reference to the stored Capabilities Information
|
||||
* field.
|
||||
*/
|
||||
capability_information& capabilities() { return _body.capability;}
|
||||
capability_information& capabilities() {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the listen interval field.
|
||||
*
|
||||
* \return The stored listen interval.
|
||||
*/
|
||||
uint16_t listen_interval() const { return Endian::le_to_host(_body.listen_interval); }
|
||||
uint16_t listen_interval() const {
|
||||
return Endian::le_to_host(body_.listen_interval);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the current ap field.
|
||||
*
|
||||
* \return The current ap.
|
||||
*/
|
||||
address_type current_ap() const { return _body.current_ap; }
|
||||
address_type current_ap() const {
|
||||
return body_.current_ap;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Setter for the listen interval field.
|
||||
@@ -448,7 +478,7 @@ public:
|
||||
*
|
||||
* \param new_current_ap The address of the current ap.
|
||||
*/
|
||||
void current_ap(const address_type &new_current_ap);
|
||||
void current_ap(const address_type& new_current_ap);
|
||||
|
||||
/**
|
||||
* \brief Returns the frame's header length.
|
||||
@@ -462,7 +492,9 @@ public:
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return pdu_flag; }
|
||||
PDUType pdu_type() const {
|
||||
return pdu_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check wether this PDU matches the specified flag.
|
||||
@@ -478,11 +510,11 @@ public:
|
||||
*
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
Dot11ReAssocRequest *clone() const {
|
||||
Dot11ReAssocRequest* clone() const {
|
||||
return new Dot11ReAssocRequest(*this);
|
||||
}
|
||||
private:
|
||||
struct ReAssocReqBody {
|
||||
struct dot11_reassoc_request_body {
|
||||
capability_information capability;
|
||||
uint16_t listen_interval;
|
||||
uint8_t current_ap[address_type::address_size];
|
||||
@@ -490,7 +522,7 @@ private:
|
||||
|
||||
void write_fixed_parameters(Memory::OutputMemoryStream& stream);
|
||||
|
||||
ReAssocReqBody _body;
|
||||
dot11_reassoc_request_body body_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -513,8 +545,8 @@ public:
|
||||
* \param dst_hw_addr The destination hardware address.
|
||||
* \param src_hw_addr The source hardware address.
|
||||
*/
|
||||
Dot11ReAssocResponse(const address_type &dst_hw_addr = address_type(),
|
||||
const address_type &src_hw_addr = address_type());
|
||||
Dot11ReAssocResponse(const address_type& dst_hw_addr = address_type(),
|
||||
const address_type& src_hw_addr = address_type());
|
||||
|
||||
/**
|
||||
* \brief Constructs a Dot11ReAssocResponse object from a buffer
|
||||
@@ -530,7 +562,7 @@ public:
|
||||
* \param buffer The buffer from which this PDU will be constructed.
|
||||
* \param total_sz The total size of the buffer.
|
||||
*/
|
||||
Dot11ReAssocResponse(const uint8_t *buffer, uint32_t total_sz);
|
||||
Dot11ReAssocResponse(const uint8_t* buffer, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information.
|
||||
@@ -538,7 +570,9 @@ public:
|
||||
* \return A constant reference to the stored Capabilities
|
||||
* Information field.
|
||||
*/
|
||||
const capability_information& capabilities() const { return _body.capability;}
|
||||
const capability_information& capabilities() const {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the Capabilities Information.
|
||||
@@ -546,21 +580,27 @@ public:
|
||||
* \return A reference to the stored Capabilities Information
|
||||
* field.
|
||||
*/
|
||||
capability_information& capabilities() { return _body.capability;}
|
||||
capability_information& capabilities() {
|
||||
return body_.capability;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the status code field.
|
||||
*
|
||||
* \return The stored status code.
|
||||
*/
|
||||
uint16_t status_code() const { return Endian::le_to_host(_body.status_code); }
|
||||
uint16_t status_code() const {
|
||||
return Endian::le_to_host(body_.status_code);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Getter for the AID field.
|
||||
*
|
||||
* \return The stored AID field value.
|
||||
*/
|
||||
uint16_t aid() const { return Endian::le_to_host(_body.aid); }
|
||||
uint16_t aid() const {
|
||||
return Endian::le_to_host(body_.aid);
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Setter for the status code field.
|
||||
@@ -588,7 +628,9 @@ public:
|
||||
* \brief Getter for the PDU's type.
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return pdu_flag; }
|
||||
PDUType pdu_type() const {
|
||||
return pdu_flag;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Check wether this PDU matches the specified flag.
|
||||
@@ -604,11 +646,11 @@ public:
|
||||
*
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
Dot11ReAssocResponse *clone() const {
|
||||
Dot11ReAssocResponse* clone() const {
|
||||
return new Dot11ReAssocResponse(*this);
|
||||
}
|
||||
private:
|
||||
struct ReAssocRespBody {
|
||||
struct dot11_reassoc_response_body {
|
||||
capability_information capability;
|
||||
uint16_t status_code;
|
||||
uint16_t aid;
|
||||
@@ -616,8 +658,9 @@ private:
|
||||
|
||||
void write_fixed_parameters(Memory::OutputMemoryStream& stream);
|
||||
|
||||
ReAssocRespBody _body;
|
||||
dot11_reassoc_response_body body_;
|
||||
};
|
||||
|
||||
} // namespace Tins
|
||||
|
||||
#endif // TINS_DOT11_DOT11_ASSOC_H
|
||||
|
||||
Reference in New Issue
Block a user