Sends fabricated TCP packets.
More...
#include <TCPSpoof.h>
Sends fabricated TCP packets.
unsigned long inet::tcp::TCPSpoof::chooseInitialSeqNum |
( |
| ) |
|
|
protectedvirtual |
Referenced by sendSpoofPacket().
85 return (
unsigned long)SIMTIME_DBL(fmod(simTime() * 250000.0, 1.0 + (
double)(
unsigned)0xffffffffUL)) & 0xffffffffUL;
void inet::tcp::TCPSpoof::handleMessage |
( |
cMessage * |
msg | ) |
|
|
overrideprotectedvirtual |
36 if (!msg->isSelfMessage())
37 throw cRuntimeError(
"Does not process incoming messages");
virtual void sendSpoofPacket()
Definition: TCPSpoof.cc:43
void inet::tcp::TCPSpoof::initialize |
( |
| ) |
|
|
overrideprotectedvirtual |
30 simtime_t t = par(
"t").doubleValue();
31 scheduleAt(t,
new cMessage(
"timer"));
void inet::tcp::TCPSpoof::sendSpoofPacket |
( |
| ) |
|
|
protectedvirtual |
Referenced by handleMessage().
45 TCPSegment *tcpseg =
new TCPSegment(
"spoof");
47 L3Address srcAddr = L3AddressResolver().resolve(par(
"srcAddress"));
48 L3Address destAddr = L3AddressResolver().resolve(par(
"destAddress"));
49 int srcPort = par(
"srcPort");
50 int destPort = par(
"destPort");
51 bool isSYN = par(
"isSYN");
52 unsigned long seq = par(
"seqNo").longValue() == -1 ?
chooseInitialSeqNum() : par(
"seqNo").longValue();
55 tcpseg->setSrcPort(srcPort);
56 tcpseg->setDestPort(destPort);
58 tcpseg->setSequenceNo(seq);
60 tcpseg->setSynBit(isSYN);
61 tcpseg->setWindow(16384);
virtual void sendToIP(TCPSegment *tcpseg, L3Address src, L3Address dest)
Definition: TCPSpoof.cc:66
#define TCP_HEADER_OCTETS
Definition: TCPSegment_m.h:50
virtual unsigned long chooseInitialSeqNum()
Definition: TCPSpoof.cc:82
Referenced by sendSpoofPacket().
68 EV_INFO <<
"Sending: ";
71 IL3AddressType *addressType = dest.getAddressType();
72 INetworkProtocolControlInfo *controlInfo = addressType->createNetworkProtocolControlInfo();
74 controlInfo->setSourceAddress(src);
75 controlInfo->setDestinationAddress(dest);
76 tcpseg->setControlInfo(check_and_cast<cObject *>(controlInfo));
79 send(tcpseg,
"ipOut");
static simsignal_t sentPkSignal
Definition: TCPSpoof.h:41
Definition: IPProtocolId_m.h:80
simsignal_t inet::tcp::TCPSpoof::sentPkSignal = registerSignal("sentPk") |
|
staticprotected |
The documentation for this class was generated from the following files: