/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public AssociationResponseFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); CapabilityInformation = new CapabilityInformationField(CapabilityInformationBytes); StatusCode = StatusCodeBytes; AssociationId = AssociationIdBytes; if (byteArraySegment.Length > AssociationResponseFields.InformationElement1Position) { //create a segment that just refers to the info element section var infoElementsSegment = new ByteArraySegment(byteArraySegment.Bytes, byteArraySegment.Offset + AssociationResponseFields.InformationElement1Position, byteArraySegment.Length - AssociationResponseFields.InformationElement1Position); InformationElements = new InformationElementList(infoElementsSegment); } else { InformationElements = new InformationElementList(); } //cant set length until after we have handled the information elements //as they vary in length Header.Length = FrameSize; }
/// <summary> /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.QosDataFrame"/> class. /// </summary> /// <param name='bas'> /// A <see cref="ByteArraySegment"/> /// </param> public QosDataFrame(ByteArraySegment bas) { log.Debug(""); header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); SequenceControl = new SequenceControlField(SequenceControlBytes); QosControl = QosControlBytes; ReadAddresses(); header.Length = FrameSize; var availablePayloadLength = GetAvailablePayloadLength(); if (availablePayloadLength > 0) { // if data is protected we have no visibility into it, otherwise it is a LLC packet and we // should parse it if (FrameControl.Protected) { payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes(availablePayloadLength); } else { payloadPacketOrData.ThePacket = new LogicalLinkControl(header.EncapsulatedBytes()); } } }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public BeaconFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); Timestamp = TimestampBytes; BeaconInterval = BeaconIntervalBytes; CapabilityInformation = new CapabilityInformationField(CapabilityInformationBytes); if (byteArraySegment.Length > BeaconFields.InformationElement1Position) { //create a segment that just refers to the info element section var infoElementsSegment = new ByteArraySegment(byteArraySegment.Bytes, byteArraySegment.Offset + BeaconFields.InformationElement1Position, byteArraySegment.Length - BeaconFields.InformationElement1Position); InformationElements = new InformationElementList(infoElementsSegment); } else { InformationElements = new InformationElementList(); } //cant set length until after we have handled the information elements //as they vary in length Header.Length = FrameSize; }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public AuthenticationFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); AuthenticationAlgorithmNumber = AuthenticationAlgorithmNumberBytes; AuthenticationAlgorithmTransactionSequenceNumber = AuthenticationAlgorithmTransactionSequenceNumberBytes; if (byteArraySegment.Length > AuthenticationFields.InformationElement1Position) { //create a segment that just refers to the info element section var infoElementsSegment = new ByteArraySegment(byteArraySegment.Bytes, byteArraySegment.Offset + AuthenticationFields.InformationElement1Position, byteArraySegment.Length - AuthenticationFields.InformationElement1Position); InformationElements = new InformationElementList(infoElementsSegment); } else { InformationElements = new InformationElementList(); } //cant set length until after we have handled the information elements //as they vary in length Header.Length = FrameSize; }
/// <summary> /// Constructor /// </summary> /// <param name="bas"> /// A <see cref="ByteArraySegment"/> /// </param> public ProbeRequestFrame(ByteArraySegment bas) { header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); if (bas.Length > ProbeRequestFields.InformationElement1Position) { //create a segment that just refers to the info element section ByteArraySegment infoElementsSegment = new ByteArraySegment(bas.Bytes, (bas.Offset + ProbeRequestFields.InformationElement1Position), (bas.Length - ProbeRequestFields.InformationElement1Position)); InformationElements = new InformationElementList(infoElementsSegment); } else { InformationElements = new InformationElementList(); } //cant set length until after we have handled the information elements //as they vary in length header.Length = FrameSize; }
/// <summary> /// Initializes a new instance of the <see cref="CtsFrame" /> class. /// </summary> /// <param name='receiverAddress'> /// Receiver address. /// </param> public CtsFrame(PhysicalAddress receiverAddress) { FrameControl = new FrameControlField(); Duration = new DurationField(); ReceiverAddress = receiverAddress; FrameControl.SubType = FrameControlField.FrameSubTypes.ControlCts; }
/// <summary> /// Initializes a new instance of the <see cref="AcknowledgmentFrame" /> class. /// </summary> /// <param name='receiverAddress'> /// Receiver address. /// </param> public AcknowledgmentFrame(PhysicalAddress receiverAddress) { FrameControl = new FrameControlField(); Duration = new DurationField(); ReceiverAddress = receiverAddress; FrameControl.SubType = FrameControlField.FrameSubTypes.ControlAck; }
/// <summary> /// Initializes a new instance of the <see cref="NullDataFrame" /> class. /// </summary> public NullDataFrame() { FrameControl = new FrameControlField(); Duration = new DurationField(); SequenceControl = new SequenceControlField(); AssignDefaultAddresses(); FrameControl.SubType = FrameControlField.FrameSubTypes.DataNullFunctionNoData; }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public CtsFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); ReceiverAddress = GetAddress(0); Header.Length = FrameSize; }
/// <summary> /// Constructor /// </summary> /// <param name="bas"> /// A <see cref="ByteArraySegment"/> /// </param> public AckFrame(ByteArraySegment bas) { header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); ReceiverAddress = GetAddress(0); header.Length = FrameSize; }
/// <summary> /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.NullDataFrame"/> class. /// </summary> /// <param name='bas'> /// A <see cref="ByteArraySegment"/> /// </param> public NullDataFrame(ByteArraySegment bas) { header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); SequenceControl = new SequenceControlField(SequenceControlBytes); ReadAddresses(); header.Length = FrameSize; }
/// <summary> /// Constructor /// </summary> /// <param name="bas"> /// A <see cref="ByteArraySegment" /> /// </param> public ContentionFreeEndFrame(ByteArraySegment bas) { Header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); ReceiverAddress = GetAddress(0); BssId = GetAddress(1); Header.Length = FrameSize; }
/// <summary> /// Initializes a new instance of the <see cref="ContentionFreeEndFrame" /> class. /// </summary> /// <param name='receiverAddress'> /// Receiver address. /// </param> /// <param name='bssId'> /// Bss identifier (MAC Address of the Access Point). /// </param> public ContentionFreeEndFrame ( PhysicalAddress receiverAddress, PhysicalAddress bssId) { FrameControl = new FrameControlField(); Duration = new DurationField(); ReceiverAddress = receiverAddress; BssId = bssId; FrameControl.SubType = FrameControlField.FrameSubTypes.ControlCFEnd; }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public BlockAcknowledgmentRequestFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); ReceiverAddress = GetAddress(0); TransmitterAddress = GetAddress(1); BlockAcknowledgmentControl = new BlockAcknowledgmentControlField(BlockAckRequestControlBytes); BlockAckStartingSequenceControl = BlockAckStartingSequenceControlBytes; Header.Length = FrameSize; }
/// <summary> /// Initializes a new instance of the <see cref="BlockAcknowledgmentRequestFrame" /> class. /// </summary> /// <param name='transmitterAddress'> /// Transmitter address. /// </param> /// <param name='receiverAddress'> /// Receiver address. /// </param> public BlockAcknowledgmentRequestFrame ( PhysicalAddress transmitterAddress, PhysicalAddress receiverAddress) { FrameControl = new FrameControlField(); Duration = new DurationField(); ReceiverAddress = receiverAddress; TransmitterAddress = transmitterAddress; BlockAcknowledgmentControl = new BlockAcknowledgmentControlField(); FrameControl.SubType = FrameControlField.FrameSubTypes.ControlBlockAcknowledgmentRequest; }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public DeauthenticationFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); Reason = ReasonBytes; Header.Length = FrameSize; }
/// <summary> /// Constructor /// </summary> /// <param name="bas"> /// A <see cref="ByteArraySegment"/> /// </param> public DisassociationFrame(ByteArraySegment bas) { header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); Reason = ReasonBytes; header.Length = FrameSize; }
/// <summary> /// Initializes a new instance of the <see cref="BlockAcknowledgmentFrame" /> class. /// </summary> /// <param name='transmitterAddress'> /// Transmitter address. /// </param> /// <param name='receiverAddress'> /// Receiver address. /// </param> /// <param name='blockAckBitmap'> /// The Block ack bitmap signalling the receive status of the MSDUs. /// </param> public BlockAcknowledgmentFrame ( PhysicalAddress transmitterAddress, PhysicalAddress receiverAddress, byte[] blockAckBitmap) { FrameControl = new FrameControlField(); Duration = new DurationField(); ReceiverAddress = receiverAddress; TransmitterAddress = transmitterAddress; BlockAcknowledgmentControl = new BlockAcknowledgmentControlField(); BlockAckBitmap = blockAckBitmap; FrameControl.SubType = FrameControlField.FrameSubTypes.ControlBlockAcknowledgment; }
/// <summary> /// Initializes a new instance of the <see cref="DisassociationFrame" /> class. /// </summary> /// <param name='sourceAddress'> /// Source address. /// </param> /// <param name='destinationAddress'> /// Destination address. /// </param> /// <param name='bssId'> /// Bss identifier (MAC Address of the Access Point). /// </param> public DisassociationFrame ( PhysicalAddress sourceAddress, PhysicalAddress destinationAddress, PhysicalAddress bssId) { FrameControl = new FrameControlField(); Duration = new DurationField(); DestinationAddress = destinationAddress; SourceAddress = sourceAddress; BssId = bssId; SequenceControl = new SequenceControlField(); FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementDisassociation; }
/// <summary> /// Initializes a new instance of the <see cref="DataDataFrame" /> class. /// </summary> /// <param name="byteArraySegment"> /// byteArraySegment. /// </param> public DataDataFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); SequenceControl = new SequenceControlField(SequenceControlBytes); ReadAddresses(); //must do this after reading FrameControl Header.Length = FrameSize; var availablePayloadLength = GetAvailablePayloadLength(); if (availablePayloadLength > 0) { PayloadPacketOrData.Value.ByteArraySegment = Header.NextSegment(availablePayloadLength); } }
/// <summary> /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.DataDataFrame"/> class. /// </summary> /// <param name='bas'> /// Bas. /// </param> public DataDataFrame(ByteArraySegment bas) { header = new ByteArraySegment(bas); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); SequenceControl = new SequenceControlField(SequenceControlBytes); ReadAddresses(); //must do this after reading FrameControl header.Length = FrameSize; var availablePayloadLength = GetAvailablePayloadLength(); if (availablePayloadLength > 0) { payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes(availablePayloadLength); } }
/// <summary> /// Initializes a new instance of the <see cref="BeaconFrame" /> class. /// </summary> /// <param name='sourceAddress'> /// Source address. /// </param> /// <param name='bssId'> /// Bss identifier (MAC Address of the Access Point). /// </param> /// <param name='informationElements'> /// Information elements. /// </param> public BeaconFrame ( PhysicalAddress sourceAddress, PhysicalAddress bssId, InformationElementList informationElements) { FrameControl = new FrameControlField(); Duration = new DurationField(); SequenceControl = new SequenceControlField(); CapabilityInformation = new CapabilityInformationField(); InformationElements = new InformationElementList(informationElements); FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementBeacon; SourceAddress = sourceAddress; DestinationAddress = PhysicalAddress.Parse("FF-FF-FF-FF-FF-FF"); BssId = bssId; BeaconInterval = 100; }
/// <summary> /// Constructor /// </summary> /// <param name="byteArraySegment"> /// A <see cref="ByteArraySegment" /> /// </param> public ActionFrame(ByteArraySegment byteArraySegment) { Header = new ByteArraySegment(byteArraySegment); FrameControl = new FrameControlField(FrameControlBytes); Duration = new DurationField(DurationBytes); DestinationAddress = GetAddress(0); SourceAddress = GetAddress(1); BssId = GetAddress(2); SequenceControl = new SequenceControlField(SequenceControlBytes); Header.Length = FrameSize; var availablePayloadLength = GetAvailablePayloadLength(); if (availablePayloadLength > 0) { PayloadPacketOrData.Value.ByteArraySegment = Header.NextSegment(availablePayloadLength); } }