1
0
mirror of https://github.com/mfontanini/libtins synced 2026-01-28 04:34:27 +01:00

Added an overload of PacketSender::send that takes a NetworkInterface.

This commit is contained in:
Matias Fontanini
2013-03-20 23:24:43 -03:00
parent 247273e086
commit 16a99ef35b
2 changed files with 53 additions and 2 deletions

View File

@@ -59,6 +59,12 @@
#include "pdu.h"
#include "macros.h"
#include "network_interface.h"
// PDUs required by PacketSender::send(PDU&, NetworkInterface)
#include "ethernetII.h"
#include "radiotap.h"
#include "dot11.h"
#include "radiotap.h"
#include "ieee802_3.h"
namespace Tins {
@@ -213,6 +219,26 @@ void PacketSender::send(PDU &pdu) {
pdu.send(*this);
}
void PacketSender::send(PDU &pdu, const NetworkInterface &iface) {
PDU::PDUType type = pdu.pdu_type();
switch(type) {
case PDU::ETHERNET_II:
send<Tins::EthernetII>(pdu, iface);
break;
case PDU::DOT11:
send<Tins::Dot11>(pdu, iface);
break;
case PDU::RADIOTAP:
send<Tins::RadioTap>(pdu, iface);
break;
case PDU::IEEE802_3:
send<Tins::IEEE802_3>(pdu, iface);
break;
default:
send(pdu);
};
}
PDU *PacketSender::send_recv(PDU &pdu) {
try {
pdu.send(*this);