Exemplo n.º 1
0
            /// <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;
            }
Exemplo n.º 2
0
            /// <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);
				}
            }
Exemplo n.º 3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Kavprot.Packets.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);
                }
            }
Exemplo n.º 4
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public ActionFrame(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);

                header.Length = FrameSize;
                var availablePayloadLength = GetAvailablePayloadLength();
                if(availablePayloadLength > 0)
                {
                    payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes (availablePayloadLength);
                }
            }
Exemplo n.º 5
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public ProbeResponseFrame (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);
                Timestamp = TimestampBytes;
                BeaconInterval = BeaconIntervalBytes;
                CapabilityInformation = new CapabilityInformationField (CapabilityInformationBytes);
				
				if(bas.Length > ProbeResponseFields.InformationElement1Position)
				{
                	//create a segment that just refers to the info element section
                	ByteArraySegment infoElementsSegment = new ByteArraySegment (bas.Bytes,
                    	(bas.Offset + ProbeResponseFields.InformationElement1Position),
                    	(bas.Length - ProbeResponseFields.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;
            }
Exemplo n.º 6
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public AuthenticationFrame (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);
                AuthenticationAlgorithmNumber = AuthenticationAlgorithmNumberBytes;
                AuthenticationAlgorithmTransactionSequenceNumber = AuthenticationAlgorithmTransactionSequenceNumberBytes;
                
				if(bas.Length > AuthenticationFields.InformationElement1Position)
				{
                	//create a segment that just refers to the info element section
                	ByteArraySegment infoElementsSegment = new ByteArraySegment (bas.Bytes,
                   		(bas.Offset + AuthenticationFields.InformationElement1Position),
                    	(bas.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;
            }
Exemplo n.º 7
0
            /// <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)
            {
                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 > SNAPFields.HeaderLength)
                {
                    payloadPacketOrData.ThePacket = new SNAPPacket(header.EncapsulatedBytes(availablePayloadLength));
                }
                else
                {
                    payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes(availablePayloadLength);
                }
            }
Exemplo n.º 8
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public DeauthenticationFrame (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;
            }
 public void Test_FragmentNumberProperty()
 {
     SequenceControlField field = new SequenceControlField(0xFF);
     field.FragmentNumber = 10;
     Assert.AreEqual(10, field.FragmentNumber);
 }
 public void Test_SequenceNumberProperty()
 {
     SequenceControlField field = new SequenceControlField(0xFFFF);
     field.SequenceNumber = 2712;
     Assert.AreEqual(2712, field.SequenceNumber);
 }
 public void Test_ConstrucutorWithFragmentNumber()
 {
     SequenceControlField field = new SequenceControlField(0xA98A);
     Assert.AreEqual(10, field.FragmentNumber);
     Assert.AreEqual(2712, field.SequenceNumber);
 }
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public ReassociationRequestFrame (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);

                CapabilityInformation = new CapabilityInformationField (CapabilityInformationBytes);
                ListenInterval = ListenIntervalBytes;
                CurrentAccessPointAddress = CurrentAccessPointAddressBytes;
                
				if(bas.Length > ReassociationRequestFields.InformationElement1Position)
				{
                	//create a segment that just refers to the info element section
                	ByteArraySegment infoElementsSegment = new ByteArraySegment(bas.Bytes,
                    	(bas.Offset + ReassociationRequestFields.InformationElement1Position),
                    	(bas.Length - ReassociationRequestFields.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;
            }
Exemplo n.º 13
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public ActionFrame (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);

                header.Length = FrameSize; 
                var availablePayloadLength = GetAvailablePayloadLength();
				if(availablePayloadLength > 0)
				{
					payloadPacketOrData.TheByteArraySegment = header.EncapsulatedBytes (availablePayloadLength);
				}
            }