public void Test_Constructor_BufferTooShortForCompleteValue()
        {
            //The following buffer contains two information elements both with a length of 5
            //but the buffer is too short to contain the complete value for the second IE
            byte[] ieBytes =
            {
                0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05,
                0x00, 0x05, 0x01, 0x02, 0x03
            };

            var byteArraySegment = new ByteArraySegment(ieBytes);

            var ieList = new InformationElementList(byteArraySegment);

            Assert.AreEqual(2, ieList.Count);

            Assert.AreEqual(InformationElement.ElementId.ServiceSetIdentity, ieList[0].Id);
            Assert.AreEqual(5, ieList[0].ValueLength);
            Assert.AreEqual(5, ieList[0].Value.Length);
            Assert.AreEqual(7, ieList[0].ElementLength);

            Assert.AreEqual(InformationElement.ElementId.ServiceSetIdentity, ieList[1].Id);
            Assert.AreEqual(3, ieList[1].ValueLength);
            Assert.AreEqual(3, ieList[1].Value.Length);
            Assert.AreEqual(5, ieList[1].ElementLength);
            Assert.AreEqual(12, ieList.Length);
        }
示例#2
0
            /// <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;
            }
示例#3
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;
            }
示例#4
0
            public void Test_Bytes_EmptySection()
            {
                ByteArraySegment       bas    = new ByteArraySegment(new Byte[0]);
                InformationElementList ieList = new InformationElementList(bas);

                Assert.AreEqual(0, ieList.Bytes.Length);
            }
        public void Test_Constructor_EmptyList()
        {
            var ieList = new InformationElementList();

            Assert.AreEqual(0, ieList.Count);
            Assert.AreEqual(0, ieList.Length);
        }
        public void Test_Constructor_MultipleInfoElementByteArray()
        {
            //create a dummy info element section for the test. The example here uses
            //two arbitrary field types (0xD3 & 0xDD). The important information for the test is the length
            //field which is the second byte on each row (0x5 & 0x4). The actual values are meaningless.
            byte[] ieBytes =
            {
                0xD3, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05,
                0xDD, 0x04, 0xFF, 0xFE, 0xFD, 0xFC
            };

            var byteArraySegment = new ByteArraySegment(ieBytes);

            var ieList = new InformationElementList(byteArraySegment);

            Assert.AreEqual(2, ieList.Count);
            Assert.AreEqual(13, ieList.Length);

            Assert.AreEqual(InformationElement.ElementId.WifiProtectedAccess, ieList[0].Id);
            Assert.AreEqual(5, ieList[0].ValueLength);
            Assert.IsTrue(ieList[0].Value.SequenceEqual(new byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 }));

            Assert.AreEqual(InformationElement.ElementId.VendorSpecific, ieList[1].Id);
            Assert.AreEqual(4, ieList[1].ValueLength);
            Assert.IsTrue(ieList[1].Value.SequenceEqual(new byte[] { 0xFF, 0xFE, 0xFD, 0xFC }));
        }
        public void Test_Bytes_EmptySection()
        {
            var byteArraySegment = new ByteArraySegment(new byte[0]);
            var ieList           = new InformationElementList(byteArraySegment);

            Assert.AreEqual(0, ieList.Bytes.Length);
        }
        public void Test_Bytes_MultipleInfoElements()
        {
            var ie1 = new InformationElement(
                InformationElement.ElementId.WifiProtectedAccess,
                new byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 });

            var ie2 = new InformationElement(
                InformationElement.ElementId.VendorSpecific,
                new byte[] { 0xFF, 0xFE, 0xFD, 0xFC });

            var ieList = new InformationElementList {
                ie1, ie2
            };

            byte[] expectedBytes = { 0xD3, 0x5, 0x1, 0x2, 0x3, 0x4, 0x5, 0xDD, 0x4, 0xFF, 0xFE, 0xFD, 0xFC };

            var b = ieList.Bytes;

            Assert.AreEqual(0xD3, b[0]);
            Assert.AreEqual(0x5, b[1]);
            Assert.AreEqual(0x1, b[2]);
            Assert.AreEqual(0x2, b[3]);
            Assert.AreEqual(0x3, b[4]);
            Assert.AreEqual(0x4, b[5]);
            Assert.AreEqual(0x5, b[6]);
            Assert.AreEqual(0xDD, b[7]);
            Assert.AreEqual(0x4, b[8]);
            Assert.AreEqual(0xFF, b[9]);
            Assert.AreEqual(0xFE, b[10]);
            Assert.AreEqual(0xFD, b[11]);
            Assert.AreEqual(0xFC, b[12]);

            Assert.IsTrue(ieList.Bytes.SequenceEqual(expectedBytes));
        }
示例#9
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;
            }
        public void Test_Constructor_EmptyByteArray()
        {
            var byteArraySegment = new ByteArraySegment(new byte[0]);
            var ieList           = new InformationElementList(byteArraySegment);

            Assert.AreEqual(0, ieList.Count);
            Assert.AreEqual(0, ieList.Length);
        }
            public void Test_Constructor_EmptyByteArray ()
            {
                ByteArraySegment bas = new ByteArraySegment (new Byte[0]);
                InformationElementList ieList = new InformationElementList (bas);

                Assert.AreEqual (0, ieList.Count);
                Assert.AreEqual (0, ieList.Length);
            }
示例#12
0
            public void Test_Constructor_BufferTooShortForLengthHeader()
            {
                //This buffer contains only enough for the id field (i.e. not length or value)
                Byte[]           ieBytes = new Byte[] { 0x00 };
                ByteArraySegment bas     = new ByteArraySegment(ieBytes);

                InformationElementList ieList = new InformationElementList(bas);

                Assert.AreEqual(0, ieList.Count);
            }
        public void Test_Constructor_BufferTooShortForValue()
        {
            //This buffer contains only enough for the id field (i.e. not length or value)
            byte[] ieBytes          = { 0x00, 0x01 };
            var    byteArraySegment = new ByteArraySegment(ieBytes);

            var ieList = new InformationElementList(byteArraySegment);

            Assert.AreEqual(1, ieList.Count);
        }
示例#14
0
 /// <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)
 {
     this.FrameControl          = new FrameControlField();
     this.Duration              = new DurationField();
     this.SequenceControl       = new SequenceControlField();
     this.CapabilityInformation = new CapabilityInformationField();
     this.InformationElements   = new InformationElementList(InformationElements);
     this.FrameControl.SubType  = FrameControlField.FrameSubTypes.ManagementBeacon;
     this.SourceAddress         = SourceAddress;
     this.DestinationAddress    = PhysicalAddress.Parse("FF-FF-FF-FF-FF-FF");
     this.BssId          = BssId;
     this.BeaconInterval = 100;
 }
示例#15
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Kavprot.Packets.Ieee80211.ProbeRequestFrame"/> 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>
            /// <param name='InformationElements'>
            /// Information elements.
            /// </param>
            public ProbeRequestFrame(PhysicalAddress SourceAddress,
                                     PhysicalAddress DestinationAddress,
                                     PhysicalAddress BssId,
                                     InformationElementList InformationElements)
            {
                this.FrameControl       = new FrameControlField();
                this.Duration           = new DurationField();
                this.DestinationAddress = DestinationAddress;
                this.SourceAddress      = SourceAddress;
                this.BssId               = BssId;
                this.SequenceControl     = new SequenceControlField();
                this.InformationElements = new InformationElementList(InformationElements);

                this.FrameControl.SubType = Kavprot.Packets.Ieee80211.FrameControlField.FrameSubTypes.ManagementProbeRequest;
            }
示例#16
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Kavprot.Packets.Ieee80211.AuthenticationFrame"/> class.
            /// </summary>
            /// <param name='SourceAddress'>
            /// Source address.
            /// </param>
            /// <param name='DestinationAddress'>
            /// Destination address.
            /// </param>
            /// <param name='BssId'>
            /// Bss identifier (MAC Address of Access Point).
            /// </param>
            /// <param name='InformationElements'>
            /// Information elements.
            /// </param>
            public AuthenticationFrame(PhysicalAddress SourceAddress,
                                       PhysicalAddress DestinationAddress,
                                       PhysicalAddress BssId,
                                       InformationElementList InformationElements)
            {
                this.FrameControl       = new FrameControlField();
                this.Duration           = new DurationField();
                this.DestinationAddress = DestinationAddress;
                this.SourceAddress      = SourceAddress;
                this.BssId               = BssId;
                this.SequenceControl     = new SequenceControlField();
                this.InformationElements = new InformationElementList(InformationElements);

                this.FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementAuthentication;
            }
示例#17
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Kavprot.Packets.Ieee80211.ReassociationRequestFrame"/> class.
            /// </summary>
            /// <param name='SourceAddress'>
            /// Source address.
            /// </param>
            /// <param name='DestinationAddress'>
            /// Destination address.
            /// </param>
            /// <param name='BssId'>
            /// BssId.
            /// </param>
            /// <param name='InformationElements'>
            /// Information elements.
            /// </param>
            public ReassociationRequestFrame(PhysicalAddress SourceAddress,
                                             PhysicalAddress DestinationAddress,
                                             PhysicalAddress BssId,
                                             InformationElementList InformationElements)
            {
                this.FrameControl       = new FrameControlField();
                this.Duration           = new DurationField();
                this.DestinationAddress = DestinationAddress;
                this.SourceAddress      = SourceAddress;
                this.BssId                 = BssId;
                this.SequenceControl       = new SequenceControlField();
                this.CapabilityInformation = new CapabilityInformationField();
                this.InformationElements   = new InformationElementList(InformationElements);

                this.FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementReassociationRequest;
            }
            public void Test_Constructor_BufferTooShortForValue ()
            {
                //This buffer contains only enough for the id field (i.e. not length or value)
				Byte[] ieBytes = new Byte[] { 0x00, 0x01 };
                ByteArraySegment bas = new ByteArraySegment (ieBytes);

                InformationElementList ieList = new InformationElementList (bas);
                Assert.AreEqual (1, ieList.Count);
            }
            public void Test_Bytes_EmptySection ()
            {
                ByteArraySegment bas = new ByteArraySegment (new Byte[0]);
                InformationElementList ieList = new InformationElementList (bas);

                Assert.AreEqual (0, ieList.Bytes.Length);
            }
            public void Test_Constructor_EmptyList ()
            {             
                InformationElementList ieList = new InformationElementList ();

                Assert.AreEqual (0, ieList.Count);
                Assert.AreEqual (0, ieList.Length);
            }
            public void Test_Constructor_MultipleInfoElementByteArray ()
            {
                //create a dummy info element section for the test. The example here uses 
                //two arbitrary field types (0xD3 & 0xDD). The important information for the test is the length
                //field which is the second byte on each row (0x5 & 0x4). The actual values are meaningless.
                Byte[] ieBytes = new Byte[] { 0xD3, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05,
                                              0xDD, 0x04, 0xFF, 0xFE, 0xFD, 0xFC };
                ByteArraySegment bas = new ByteArraySegment (ieBytes);

                InformationElementList ieList = new InformationElementList (bas);
                Assert.AreEqual (2, ieList.Count);
                Assert.AreEqual (13, ieList.Length);

                Assert.AreEqual (InformationElement.ElementId.WifiProtectedAccess, ieList [0].Id);
                Assert.AreEqual (5, ieList [0].ValueLength);
                Assert.IsTrue (ieList [0].Value.SequenceEqual (new Byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 }));

                Assert.AreEqual (InformationElement.ElementId.VendorSpecific, ieList [1].Id);
                Assert.AreEqual (4, ieList [1].ValueLength);
                Assert.IsTrue (ieList [1].Value.SequenceEqual (new Byte[] { 0xFF, 0xFE, 0xFD, 0xFC }));
            }
            public void Test_Bytes_MultipleInfoElements ()
            {
                InformationElement ie1 = new InformationElement (
                    InformationElement.ElementId.WifiProtectedAccess, new Byte[] { 0x1, 0x2, 0x3, 0x4, 0x5 });

                InformationElement ie2 = new InformationElement (
                    InformationElement.ElementId.VendorSpecific, new Byte[] { 0xFF, 0xFE, 0xFD, 0xFC });
          
                InformationElementList ieList = new InformationElementList ();
                ieList.Add (ie1);
                ieList.Add (ie2);

                Byte[] expectedBytes = new Byte[] { 0xD3, 0x5, 0x1, 0x2, 0x3, 0x4, 0x5, 0xDD, 0x4, 0xFF, 0xFE, 0xFD, 0xFC };

                Byte[] b = ieList.Bytes;

                Assert.AreEqual (0xD3, b [0]);
                Assert.AreEqual (0x5, b [1]);
                Assert.AreEqual (0x1, b [2]);
                Assert.AreEqual (0x2, b [3]);
                Assert.AreEqual (0x3, b [4]);
                Assert.AreEqual (0x4, b [5]);
                Assert.AreEqual (0x5, b [6]);
                Assert.AreEqual (0xDD, b [7]);
                Assert.AreEqual (0x4, b [8]);
                Assert.AreEqual (0xFF, b [9]);
                Assert.AreEqual (0xFE, b [10]);
                Assert.AreEqual (0xFD, b [11]);
                Assert.AreEqual (0xFC, b [12]);

                Assert.IsTrue (ieList.Bytes.SequenceEqual (expectedBytes));
            }
 /// <summary>
 ///     Initializes a new instance of the <see cref="InformationElementList" /> class.
 /// </summary>
 /// <param name='list'>
 ///     The elements to be included in the list.
 /// </param>
 public InformationElementList(InformationElementList list) : base(list)
 {
 }
            /// <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;
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.ReassociationRequestFrame"/> class.
 /// </summary>
 /// <param name='SourceAddress'>
 /// Source address.
 /// </param>
 /// <param name='DestinationAddress'>
 /// Destination address.
 /// </param>
 /// <param name='BssId'>
 /// BssId.
 /// </param>
 /// <param name='InformationElements'>
 /// Information elements.
 /// </param>
 public ReassociationRequestFrame (PhysicalAddress SourceAddress,
                                   PhysicalAddress DestinationAddress,
                                   PhysicalAddress BssId,
                                   InformationElementList InformationElements)
 {
     this.FrameControl = new FrameControlField ();
     this.Duration = new DurationField ();
     this.DestinationAddress = DestinationAddress;
     this.SourceAddress = SourceAddress;
     this.BssId = BssId;
     this.SequenceControl = new SequenceControlField ();
     this.CapabilityInformation = new CapabilityInformationField ();
     this.InformationElements = new InformationElementList (InformationElements);
     
     this.FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementReassociationRequest;
 }
示例#26
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;
            }
            public void Test_Constructor_BufferTooShortForCompleteValue ()
            {
                //The following buffer contains two information elements both with a length of 5
                //but the buffer is too short to contain the complete value for the second IE
                Byte[] ieBytes = new Byte[] { 0x00, 0x05, 0x01, 0x02, 0x03, 0x04, 0x05,
                                              0x00, 0x05, 0x01, 0x02, 0x03 };
                ByteArraySegment bas = new ByteArraySegment (ieBytes);

                InformationElementList ieList = new InformationElementList (bas);
                Assert.AreEqual (2, ieList.Count);

                Assert.AreEqual (InformationElement.ElementId.ServiceSetIdentity, ieList [0].Id);
                Assert.AreEqual (5, ieList [0].ValueLength);
                Assert.AreEqual (5, ieList [0].Value.Length);
                Assert.AreEqual (7, ieList [0].ElementLength);

                Assert.AreEqual (InformationElement.ElementId.ServiceSetIdentity, ieList [1].Id);
                Assert.AreEqual (3, ieList [1].ValueLength);
                Assert.AreEqual (3, ieList [1].Value.Length);
                Assert.AreEqual (5, ieList [1].ElementLength);
                Assert.AreEqual (12, ieList.Length);
            }
示例#28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.AuthenticationFrame"/> class.
 /// </summary>
 /// <param name='SourceAddress'>
 /// Source address.
 /// </param>
 /// <param name='DestinationAddress'>
 /// Destination address.
 /// </param>
 /// <param name='BssId'>
 /// Bss identifier (MAC Address of Access Point).
 /// </param>
 /// <param name='InformationElements'>
 /// Information elements.
 /// </param>
 public AuthenticationFrame (PhysicalAddress SourceAddress,
                             PhysicalAddress DestinationAddress,
                             PhysicalAddress BssId,
                             InformationElementList InformationElements)
 {
     this.FrameControl = new FrameControlField ();
     this.Duration = new DurationField ();
     this.DestinationAddress = DestinationAddress;
     this.SourceAddress = SourceAddress;
     this.BssId = BssId;
     this.SequenceControl = new SequenceControlField ();
     this.InformationElements = new InformationElementList (InformationElements);
     
     this.FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementAuthentication;
 }
示例#29
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;
            }
示例#30
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.ProbeResponseFrame"/> 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>
 /// <param name='InformationElements'>
 /// Information elements.
 /// </param>
 public ProbeResponseFrame (PhysicalAddress SourceAddress,
                            PhysicalAddress DestinationAddress,
                            PhysicalAddress BssId,
                            InformationElementList InformationElements)
 {
     this.FrameControl = new FrameControlField ();
     this.Duration = new DurationField ();
     this.DestinationAddress = DestinationAddress;
     this.SourceAddress = SourceAddress;
     this.BssId = BssId;
     this.SequenceControl = new SequenceControlField ();
     this.CapabilityInformation = new CapabilityInformationField ();
     this.InformationElements = new InformationElementList (InformationElements);
     
     this.FrameControl.SubType = PacketDotNet.Ieee80211.FrameControlField.FrameSubTypes.ManagementProbeResponse;
 }
示例#31
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.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)
 {
     this.FrameControl = new FrameControlField ();
     this.Duration = new DurationField ();
     this.SequenceControl = new SequenceControlField ();
     this.CapabilityInformation = new CapabilityInformationField ();
     this.InformationElements = new InformationElementList (InformationElements);
     this.FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementBeacon;
     this.SourceAddress = SourceAddress;
     this.DestinationAddress = PhysicalAddress.Parse ("FF-FF-FF-FF-FF-FF");
     this.BssId = BssId;
     this.BeaconInterval = 100;
 }