mirror of
https://github.com/mfontanini/libtins
synced 2026-01-23 02:35:57 +01:00
Removed deprecated methods/types.
This commit is contained in:
@@ -272,19 +272,6 @@ namespace Tins {
|
||||
* \param total_sz The size of the buffer.
|
||||
*/
|
||||
bool matches_response(uint8_t *ptr, uint32_t total_sz);
|
||||
|
||||
/**
|
||||
* \brief Clones this pdu, filling the corresponding header with data
|
||||
* extracted from a buffer.
|
||||
*
|
||||
* \deprecated This method is obsolete.
|
||||
*
|
||||
* \param ptr The pointer to the from from which the data will be extracted.
|
||||
* \param total_sz The size of the buffer.
|
||||
* \return The cloned PDU.
|
||||
* \sa PDU::clone_packet
|
||||
*/
|
||||
TINS_DEPRECATED(PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz));
|
||||
|
||||
/**
|
||||
* \sa PDU::clone
|
||||
|
||||
@@ -140,15 +140,11 @@ namespace Tins {
|
||||
END = 255
|
||||
};
|
||||
|
||||
TINS_DEPRECATED(typedef OptionTypes Options);
|
||||
|
||||
/**
|
||||
* The DHCP option type.
|
||||
*/
|
||||
typedef PDUOption<uint8_t> option;
|
||||
|
||||
TINS_DEPRECATED(typedef option dhcp_option);
|
||||
|
||||
/**
|
||||
* The type used to store the DHCP options.
|
||||
*/
|
||||
|
||||
@@ -47,8 +47,6 @@ public:
|
||||
* Represents a DHCPv6 option.
|
||||
*/
|
||||
typedef PDUOption<uint16_t> option;
|
||||
|
||||
TINS_DEPRECATED(typedef option dhcpv6_option);
|
||||
|
||||
/**
|
||||
* The message types.
|
||||
@@ -152,8 +150,6 @@ public:
|
||||
KRB_DEFAULT_REALM_NAME,
|
||||
KRB_KDC
|
||||
};
|
||||
|
||||
TINS_DEPRECATED(typedef OptionTypes Option);
|
||||
|
||||
/**
|
||||
* The type used to store the DHCPv6 options.
|
||||
|
||||
@@ -112,8 +112,6 @@ namespace Tins {
|
||||
RSN = 48,
|
||||
EXT_SUPPORTED_RATES = 50
|
||||
};
|
||||
|
||||
TINS_DEPRECATED(typedef OptionTypes TaggedOption);
|
||||
|
||||
/**
|
||||
* \brief Enum for the different subtypes of 802.11 management frames.
|
||||
@@ -173,8 +171,6 @@ namespace Tins {
|
||||
*/
|
||||
typedef PDUOption<uint8_t> option;
|
||||
|
||||
TINS_DEPRECATED(typedef option dot11_option);
|
||||
|
||||
/**
|
||||
* \brief Constructor for creating an 802.11 PDU
|
||||
*
|
||||
@@ -384,12 +380,6 @@ namespace Tins {
|
||||
*/
|
||||
void send(PacketSender &sender, const NetworkInterface &iface);
|
||||
#endif // WIN32
|
||||
|
||||
/**
|
||||
* \brief Adds a new option to this Dot11 PDU.
|
||||
* \param opt The option to be added.
|
||||
*/
|
||||
TINS_DEPRECATED(void add_tagged_option(const option &opt));
|
||||
|
||||
/**
|
||||
* \brief Adds a new option to this Dot11 PDU.
|
||||
|
||||
@@ -166,19 +166,6 @@ namespace Tins {
|
||||
*/
|
||||
PDUType pdu_type() const { return pdu_flag; }
|
||||
|
||||
/**
|
||||
* \brief Clones this pdu, filling the corresponding header with data
|
||||
* extracted from a buffer.
|
||||
*
|
||||
* \deprecated This method is obsolete.
|
||||
*
|
||||
* \param ptr The pointer to the from from which the data will be extracted.
|
||||
* \param total_sz The size of the buffer.
|
||||
* \return The cloned PDU.
|
||||
* \sa PDU::clone_packet
|
||||
*/
|
||||
TINS_DEPRECATED(PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz));
|
||||
|
||||
/**
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
|
||||
@@ -170,19 +170,6 @@ namespace Tins {
|
||||
*/
|
||||
PDUType pdu_type() const { return PDU::ETHERNET_II; }
|
||||
|
||||
/**
|
||||
* \brief Clones this pdu, filling the corresponding header with data
|
||||
* extracted from a buffer.
|
||||
*
|
||||
* \deprecated This method is obsolete.
|
||||
*
|
||||
* \param ptr The pointer to the from from which the data will be extracted.
|
||||
* \param total_sz The size of the buffer.
|
||||
* \return The cloned PDU.
|
||||
* \sa PDU::clone_packet
|
||||
*/
|
||||
TINS_DEPRECATED(PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz));
|
||||
|
||||
/**
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
|
||||
@@ -287,19 +287,6 @@ namespace Tins {
|
||||
* \sa PDU::pdu_type
|
||||
*/
|
||||
PDUType pdu_type() const { return PDU::ICMP; }
|
||||
|
||||
/**
|
||||
* \brief Clones this pdu, filling the corresponding header with data
|
||||
* extracted from a buffer.
|
||||
*
|
||||
* \deprecated This method is obsolete.
|
||||
*
|
||||
* \param ptr The pointer to the from from which the data will be extracted.
|
||||
* \param total_sz The size of the buffer.
|
||||
* \return The cloned PDU.
|
||||
* \sa PDU::clone_packet
|
||||
*/
|
||||
TINS_DEPRECATED(PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz));
|
||||
|
||||
/**
|
||||
* \sa PDU::clone
|
||||
|
||||
@@ -122,8 +122,6 @@ public:
|
||||
CARD_REPLY
|
||||
};
|
||||
|
||||
TINS_DEPRECATED(typedef OptionTypes Options);
|
||||
|
||||
/**
|
||||
* The type used to store addresses.
|
||||
*/
|
||||
@@ -139,8 +137,6 @@ public:
|
||||
*/
|
||||
typedef PDUOption<uint8_t> option;
|
||||
|
||||
TINS_DEPRECATED(typedef option icmpv6_option);
|
||||
|
||||
/**
|
||||
* The type used to store options.
|
||||
*/
|
||||
|
||||
15
include/ip.h
15
include/ip.h
@@ -170,8 +170,6 @@ namespace Tins {
|
||||
* The IP options type.
|
||||
*/
|
||||
typedef PDUOption<option_identifier> option;
|
||||
|
||||
TINS_DEPRECATED(typedef option ip_option);
|
||||
|
||||
/**
|
||||
* The type of the security option.
|
||||
@@ -597,19 +595,6 @@ namespace Tins {
|
||||
*/
|
||||
PDUType pdu_type() const { return PDU::IP; }
|
||||
|
||||
/**
|
||||
* \brief Clones this pdu, filling the corresponding header with data
|
||||
* extracted from a buffer.
|
||||
*
|
||||
* \deprecated This method is obsolete.
|
||||
*
|
||||
* \param ptr The pointer to the from from which the data will be extracted.
|
||||
* \param total_sz The size of the buffer.
|
||||
* \return The cloned PDU.
|
||||
* \sa PDU::clone_packet
|
||||
*/
|
||||
TINS_DEPRECATED(PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz));
|
||||
|
||||
/**
|
||||
* \sa PDU::clone
|
||||
*/
|
||||
|
||||
@@ -62,8 +62,6 @@ public:
|
||||
*/
|
||||
typedef PDUOption<uint8_t> ext_header;
|
||||
|
||||
TINS_DEPRECATED(typedef ext_header ipv6_ext_header);
|
||||
|
||||
/**
|
||||
* The type used to store the extension headers.
|
||||
*/
|
||||
|
||||
@@ -346,17 +346,6 @@ namespace Tins {
|
||||
* \return Returns the PDUType corresponding to the PDU.
|
||||
*/
|
||||
virtual PDUType pdu_type() const = 0;
|
||||
|
||||
/** \brief Clones this pdu, filling the corresponding header with data
|
||||
* extracted from a buffer.
|
||||
*
|
||||
* \deprecated This method is obsolete.
|
||||
*
|
||||
* \param ptr The pointer to the from from which the data will be extracted.
|
||||
* \param total_sz The size of the buffer.
|
||||
* \return The cloned PDU.
|
||||
*/
|
||||
TINS_DEPRECATED(virtual PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz));
|
||||
protected:
|
||||
/**
|
||||
* \brief Copy constructor.
|
||||
|
||||
@@ -126,13 +126,6 @@ public:
|
||||
PDUType pdu_type() const {
|
||||
return cached.pdu_type();
|
||||
}
|
||||
|
||||
/**
|
||||
* Forwards the call to the cached PDU. \sa PDU::clone_packet.
|
||||
*/
|
||||
TINS_DEPRECATED(PDU *clone_packet(const uint8_t *ptr, uint32_t total_sz)) {
|
||||
return 0;
|
||||
}
|
||||
private:
|
||||
void write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *parent) {
|
||||
if(cached_serialization.size() != total_sz) {
|
||||
|
||||
@@ -90,8 +90,6 @@ namespace Tins {
|
||||
ALTCHK = 14
|
||||
};
|
||||
|
||||
TINS_DEPRECATED(typedef OptionTypes Option);
|
||||
|
||||
/**
|
||||
* \brief Alternate checksum enum.
|
||||
*/
|
||||
@@ -105,8 +103,6 @@ namespace Tins {
|
||||
* The type used to store TCP options.
|
||||
*/
|
||||
typedef PDUOption<uint8_t> option;
|
||||
|
||||
TINS_DEPRECATED(typedef option tcp_option);
|
||||
|
||||
/**
|
||||
* The type used to store the options.
|
||||
@@ -363,18 +359,6 @@ namespace Tins {
|
||||
* \param value The new value for this flag. Must be 0 or 1.
|
||||
*/
|
||||
void set_flag(Flags tcp_flag, small_uint<1> value);
|
||||
|
||||
/**
|
||||
* \brief Adds a TCP option.
|
||||
*
|
||||
* \deprecated This function is deprecated. The overloads taking
|
||||
* a TCP::option should be used.
|
||||
*
|
||||
* \param option The option type flag to be set.
|
||||
* \param length The length of this option(optional).
|
||||
* \param data Pointer to this option's data(optional).
|
||||
*/
|
||||
TINS_DEPRECATED(void add_option(OptionTypes opt, uint8_t length = 0, const uint8_t *data = 0));
|
||||
|
||||
/**
|
||||
* \brief Adds a TCP option.
|
||||
|
||||
@@ -95,16 +95,6 @@ namespace Tins {
|
||||
*/
|
||||
IPv4Address mask;
|
||||
};
|
||||
|
||||
/**
|
||||
* \brief Resolves a domain name and returns its corresponding ip address.
|
||||
*
|
||||
* If an ip address is given, its integer representation is returned.
|
||||
* Otherwise, the domain name is resolved and its ip address is returned.
|
||||
*
|
||||
* \param to_resolve The domain name/ip address to resolve.
|
||||
*/
|
||||
IPv4Address resolve_ip(const std::string &to_resolve);
|
||||
|
||||
/**
|
||||
* \brief Resolves a domain name and returns its corresponding ip address.
|
||||
@@ -125,21 +115,6 @@ namespace Tins {
|
||||
* \param to_resolve The domain name/ip address to resolve.
|
||||
*/
|
||||
IPv6Address resolve_domain6(const std::string &to_resolve);
|
||||
|
||||
/**
|
||||
* \brief Resolves the hardware address for a given ip.
|
||||
*
|
||||
* \param iface The interface in which the packet will be sent.
|
||||
* \param ip The ip to resolve, in integer format.
|
||||
* \param buffer The buffer in which the host's hardware address will be stored.
|
||||
* \param sender The sender to use to send and receive the ARP requests.
|
||||
* \return Returns true if the hardware address was resolved successfully,
|
||||
* false otherwise.
|
||||
*/
|
||||
TINS_DEPRECATED(
|
||||
bool resolve_hwaddr(const NetworkInterface &iface, IPv4Address ip,
|
||||
HWAddress<6> *address, PacketSender &sender)
|
||||
);
|
||||
|
||||
/**
|
||||
* \brief Resolves the hardware address for a given ip.
|
||||
|
||||
@@ -119,10 +119,6 @@ bool ARP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
return arp_ptr->ar_sip == _arp.ar_tip && arp_ptr->ar_tip == _arp.ar_sip;
|
||||
}
|
||||
|
||||
PDU *ARP::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
|
||||
return new ARP(ptr, total_sz);
|
||||
}
|
||||
|
||||
EthernetII ARP::make_arp_request(ipaddress_type target, ipaddress_type sender,
|
||||
const hwaddress_type &hw_snd)
|
||||
{
|
||||
|
||||
@@ -120,11 +120,6 @@ void Dot11::add_option(const option &opt) {
|
||||
_options.push_back(opt);
|
||||
}
|
||||
|
||||
void Dot11::add_tagged_option(const option &opt) {
|
||||
internal_add_option(opt);
|
||||
_options.push_back(opt);
|
||||
}
|
||||
|
||||
const Dot11::option *Dot11::search_option(OptionTypes opt) const {
|
||||
for(std::list<option>::const_iterator it = _options.begin(); it != _options.end(); ++it)
|
||||
if(it->option() == (uint8_t)opt)
|
||||
|
||||
@@ -160,8 +160,4 @@ PDU *Dot3::recv_response(PacketSender &sender, const NetworkInterface &iface) {
|
||||
#endif
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
PDU *Dot3::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
|
||||
return new Dot3(ptr, total_sz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,8 +169,4 @@ PDU *EthernetII::recv_response(PacketSender &sender, const NetworkInterface &ifa
|
||||
#endif
|
||||
}
|
||||
#endif // WIN32
|
||||
|
||||
PDU *EthernetII::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
|
||||
return new EthernetII(ptr, total_sz);
|
||||
}
|
||||
}
|
||||
|
||||
50
src/icmp.cpp
50
src/icmp.cpp
@@ -39,13 +39,14 @@
|
||||
#include "utils.h"
|
||||
#include "exceptions.h"
|
||||
|
||||
Tins::ICMP::ICMP(Flags flag)
|
||||
namespace Tins {
|
||||
ICMP::ICMP(Flags flag)
|
||||
{
|
||||
std::memset(&_icmp, 0, sizeof(icmphdr));
|
||||
type(flag);
|
||||
}
|
||||
|
||||
Tins::ICMP::ICMP(const uint8_t *buffer, uint32_t total_sz)
|
||||
ICMP::ICMP(const uint8_t *buffer, uint32_t total_sz)
|
||||
{
|
||||
if(total_sz < sizeof(icmphdr))
|
||||
throw malformed_packet();
|
||||
@@ -55,78 +56,78 @@ Tins::ICMP::ICMP(const uint8_t *buffer, uint32_t total_sz)
|
||||
inner_pdu(new RawPDU(buffer + sizeof(icmphdr), total_sz));
|
||||
}
|
||||
|
||||
void Tins::ICMP::code(uint8_t new_code) {
|
||||
void ICMP::code(uint8_t new_code) {
|
||||
_icmp.code = new_code;
|
||||
}
|
||||
|
||||
void Tins::ICMP::type(Flags new_type) {
|
||||
void ICMP::type(Flags new_type) {
|
||||
_icmp.type = new_type;
|
||||
}
|
||||
|
||||
void Tins::ICMP::check(uint16_t new_check) {
|
||||
void ICMP::check(uint16_t new_check) {
|
||||
_icmp.check = Endian::host_to_be(new_check);
|
||||
}
|
||||
|
||||
void Tins::ICMP::id(uint16_t new_id) {
|
||||
void ICMP::id(uint16_t new_id) {
|
||||
_icmp.un.echo.id = Endian::host_to_be(new_id);
|
||||
}
|
||||
|
||||
void Tins::ICMP::sequence(uint16_t new_seq) {
|
||||
void ICMP::sequence(uint16_t new_seq) {
|
||||
_icmp.un.echo.sequence = Endian::host_to_be(new_seq);
|
||||
}
|
||||
|
||||
void Tins::ICMP::gateway(uint32_t new_gw) {
|
||||
void ICMP::gateway(uint32_t new_gw) {
|
||||
_icmp.un.gateway = Endian::host_to_be(new_gw);
|
||||
}
|
||||
|
||||
void Tins::ICMP::mtu(uint16_t new_mtu) {
|
||||
void ICMP::mtu(uint16_t new_mtu) {
|
||||
_icmp.un.frag.mtu = Endian::host_to_be(new_mtu);
|
||||
}
|
||||
|
||||
void Tins::ICMP::pointer(uint8_t new_pointer) {
|
||||
void ICMP::pointer(uint8_t new_pointer) {
|
||||
_icmp.un.pointer = new_pointer;
|
||||
}
|
||||
|
||||
uint32_t Tins::ICMP::header_size() const {
|
||||
uint32_t ICMP::header_size() const {
|
||||
return sizeof(icmphdr);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_echo_request(uint16_t id, uint16_t seq) {
|
||||
void ICMP::set_echo_request(uint16_t id, uint16_t seq) {
|
||||
type(ECHO_REQUEST);
|
||||
this->id(id);
|
||||
sequence(seq);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_echo_reply(uint16_t id, uint16_t seq) {
|
||||
void ICMP::set_echo_reply(uint16_t id, uint16_t seq) {
|
||||
type(ECHO_REPLY);
|
||||
this->id(id);
|
||||
sequence(seq);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_info_request(uint16_t id, uint16_t seq) {
|
||||
void ICMP::set_info_request(uint16_t id, uint16_t seq) {
|
||||
type(INFO_REQUEST);
|
||||
code(0);
|
||||
this->id(id);
|
||||
sequence(seq);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_info_reply(uint16_t id, uint16_t seq) {
|
||||
void ICMP::set_info_reply(uint16_t id, uint16_t seq) {
|
||||
type(INFO_REPLY);
|
||||
code(0);
|
||||
this->id(id);
|
||||
sequence(seq);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_dest_unreachable() {
|
||||
void ICMP::set_dest_unreachable() {
|
||||
type(DEST_UNREACHABLE);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_time_exceeded(bool ttl_exceeded) {
|
||||
void ICMP::set_time_exceeded(bool ttl_exceeded) {
|
||||
type(TIME_EXCEEDED);
|
||||
code((ttl_exceeded) ? 0 : 1);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_param_problem(bool set_pointer, uint8_t bad_octet) {
|
||||
void ICMP::set_param_problem(bool set_pointer, uint8_t bad_octet) {
|
||||
type(PARAM_PROBLEM);
|
||||
if(set_pointer) {
|
||||
code(0);
|
||||
@@ -136,17 +137,17 @@ void Tins::ICMP::set_param_problem(bool set_pointer, uint8_t bad_octet) {
|
||||
code(1);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_source_quench() {
|
||||
void ICMP::set_source_quench() {
|
||||
type(SOURCE_QUENCH);
|
||||
}
|
||||
|
||||
void Tins::ICMP::set_redirect(uint8_t icode, uint32_t address) {
|
||||
void ICMP::set_redirect(uint8_t icode, uint32_t address) {
|
||||
type(REDIRECT);
|
||||
code(icode);
|
||||
gateway(address);
|
||||
}
|
||||
|
||||
void Tins::ICMP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *) {
|
||||
void ICMP::write_serialization(uint8_t *buffer, uint32_t total_sz, const PDU *) {
|
||||
assert(total_sz >= sizeof(icmphdr));
|
||||
if(!_icmp.check) {
|
||||
uint32_t checksum = Utils::do_checksum(buffer + sizeof(icmphdr), buffer + total_sz) +
|
||||
@@ -159,7 +160,7 @@ void Tins::ICMP::write_serialization(uint8_t *buffer, uint32_t total_sz, const P
|
||||
_icmp.check = 0;
|
||||
}
|
||||
|
||||
bool Tins::ICMP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
bool ICMP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
if(total_sz < sizeof(icmphdr))
|
||||
return false;
|
||||
const icmphdr *icmp_ptr = (const icmphdr*)ptr;
|
||||
@@ -168,7 +169,4 @@ bool Tins::ICMP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Tins::PDU *Tins::ICMP::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
|
||||
return new ICMP(ptr, total_sz);
|
||||
}
|
||||
} // namespace Tins
|
||||
|
||||
@@ -441,8 +441,4 @@ bool IP::matches_response(uint8_t *ptr, uint32_t total_sz) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
PDU *IP::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
|
||||
return new IP(ptr, total_sz);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,8 +121,4 @@ void PDU::serialize(uint8_t *buffer, uint32_t total_sz, const PDU *parent) {
|
||||
_inner_pdu->serialize(buffer + header_size(), total_sz - sz, this);
|
||||
write_serialization(buffer, total_sz, parent);
|
||||
}
|
||||
|
||||
PDU *PDU::clone_packet(const uint8_t *ptr, uint32_t total_sz) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -269,10 +269,6 @@ void TCP::set_flag(Flags tcp_flag, small_uint<1> value) {
|
||||
};
|
||||
}
|
||||
|
||||
void TCP::add_option(OptionTypes opt, uint8_t length, const uint8_t *data) {
|
||||
add_option(option(opt, data, data + length));
|
||||
}
|
||||
|
||||
void TCP::add_option(const option &opt) {
|
||||
_options.push_back(opt);
|
||||
internal_add_option(opt);
|
||||
|
||||
@@ -88,13 +88,6 @@ namespace Tins {
|
||||
|
||||
/** \endcond */
|
||||
namespace Utils {
|
||||
|
||||
IPv4Address resolve_ip(const string &to_resolve) {
|
||||
struct hostent *data = gethostbyname(to_resolve.c_str());
|
||||
if(!data)
|
||||
throw std::runtime_error("Could not resolve IP");
|
||||
return IPv4Address(((struct in_addr**)data->h_addr_list)[0]->s_addr);
|
||||
}
|
||||
|
||||
IPv4Address resolve_domain(const std::string &to_resolve) {
|
||||
addrinfo *result = ::resolve_domain(to_resolve, AF_INET);
|
||||
@@ -110,23 +103,6 @@ IPv6Address resolve_domain6(const std::string &to_resolve) {
|
||||
return addr;
|
||||
}
|
||||
|
||||
bool resolve_hwaddr(const NetworkInterface &iface, IPv4Address ip,
|
||||
HWAddress<6> *address, PacketSender &sender)
|
||||
{
|
||||
IPv4Address my_ip;
|
||||
NetworkInterface::Info info(iface.addresses());
|
||||
EthernetII packet = ARP::make_arp_request(ip, info.ip_addr, info.hw_addr);
|
||||
Internals::smart_ptr<PDU>::type response(sender.send_recv(packet, iface));
|
||||
if(response.get()) {
|
||||
ARP *arp_resp = response->find_pdu<ARP>();
|
||||
if(arp_resp)
|
||||
*address = arp_resp->sender_hw_addr();
|
||||
return arp_resp != 0;
|
||||
}
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
HWAddress<6> resolve_hwaddr(const NetworkInterface &iface, IPv4Address ip, PacketSender &sender)
|
||||
{
|
||||
IPv4Address my_ip;
|
||||
|
||||
@@ -422,13 +422,13 @@ TEST_F(ICMPv6Test, SpoofedOptions) {
|
||||
ICMPv6 pdu;
|
||||
uint8_t a[] = { 1,2,3,4,5,6 };
|
||||
pdu.add_option(
|
||||
ICMPv6::icmpv6_option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
ICMPv6::option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
ICMPv6::icmpv6_option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
ICMPv6::option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
ICMPv6::icmpv6_option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
ICMPv6::option(ICMPv6::NAACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.options().size());
|
||||
|
||||
@@ -258,13 +258,13 @@ TEST_F(IPTest, SpoofedOptions) {
|
||||
IP pdu;
|
||||
uint8_t a[] = { 1,2,3,4,5,6 };
|
||||
pdu.add_option(
|
||||
IP::ip_option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
IP::option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
IP::ip_option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
IP::option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
IP::ip_option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
IP::option(IP::NOOP, 250, a, a + sizeof(a))
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.options().size());
|
||||
|
||||
@@ -215,13 +215,13 @@ TEST_F(TCPTest, SpoofedOptions) {
|
||||
TCP pdu;
|
||||
uint8_t a[] = { 1,2,3,4,5,6 };
|
||||
pdu.add_option(
|
||||
TCP::tcp_option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
TCP::option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
TCP::tcp_option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
TCP::option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
pdu.add_option(
|
||||
TCP::tcp_option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
TCP::option(TCP::SACK, 250, a, a + sizeof(a))
|
||||
);
|
||||
// probably we'd expect it to crash if it's not working, valgrind plx
|
||||
EXPECT_EQ(3, pdu.options().size());
|
||||
|
||||
Reference in New Issue
Block a user