Add a fragment to the reassembly buffer.
If the new fragment completes a frame, then the reassembled frame is returned (and fragments are removed from the buffer), otherwise the function returns nullptr.
32 if (!frame->getMoreFragments() && frame->getFragmentNumber() == 0)
35 if (dynamic_cast<Ieee80211ManagementFrame*>(frame))
39 key.macAddress = frame->getTransmitterAddress();
42 if (Ieee80211DataFrame *qosDataFrame = dynamic_cast<Ieee80211DataFrame *>(frame))
43 key.tid = qosDataFrame->getTid();
44 key.seqNum = frame->getSequenceNumber();
45 short fragNum = frame->getFragmentNumber();
50 uint16_t fragmentBit = 1 << fragNum;
51 value.receivedFragments |= fragmentBit;
52 if (!frame->getMoreFragments())
53 value.allFragments = (fragmentBit << 1) - 1;
55 frame->setByteLength(0);
56 value.frame = check_and_cast_nullable<Ieee80211DataOrMgmtFrame *>(frame->decapsulate());
58 MACAddress txAddress = frame->getTransmitterAddress();
62 if (value.allFragments != 0 && value.allFragments == value.receivedFragments) {
63 Ieee80211DataOrMgmtFrame *result = value.frame;
68 result->setTransmitterAddress(txAddress);
FragmentsMap fragmentsMap
Definition: BasicReassembly.h:43
Definition: Ieee80211Frame_m.h:117
const short int MAX_NUM_FRAGMENTS
Definition: Ieee80211Frame_m.h:50
void * Key
Definition: Macho.h:325