示例#1
0
        /// <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="byteArraySegment">
        /// A <see cref="ByteArraySegment" />
        /// </param>
        public ReassociationRequestFrame(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);
            ListenInterval            = ListenIntervalBytes;
            CurrentAccessPointAddress = CurrentAccessPointAddressBytes;

            if (byteArraySegment.Length > ReassociationRequestFields.InformationElement1Position)
            {
                //create a segment that just refers to the info element section
                var infoElementsSegment = new ByteArraySegment(byteArraySegment.Bytes,
                                                               byteArraySegment.Offset + ReassociationRequestFields.InformationElement1Position,
                                                               byteArraySegment.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 AssociationResponseFrame(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);
                StatusCode            = StatusCodeBytes;
                AssociationId         = AssociationIdBytes;

                if (bas.Length > AssociationResponseFields.InformationElement1Position)
                {
                    //create a segment that just refers to the info element section
                    ByteArraySegment infoElementsSegment = new ByteArraySegment(bas.Bytes,
                                                                                (bas.Offset + AssociationResponseFields.InformationElement1Position),
                                                                                (bas.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;
            }
示例#4
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
                var 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;
        }
示例#5
0
            /// <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;
            }
示例#6
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;
 }
示例#7
0
            /// <summary>
            /// Initializes a new instance of the <see cref="PacketDotNet.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 = PacketDotNet.Ieee80211.FrameControlField.FrameSubTypes.ManagementProbeRequest;
            }
            /// <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;
            }
示例#9
0
            /// <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;
            }
示例#10
0
        /// <summary>
        /// Initializes a new instance of the <see cref="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)
        {
            FrameControl       = new FrameControlField();
            Duration           = new DurationField();
            DestinationAddress = destinationAddress;
            SourceAddress      = sourceAddress;
            BssId               = bssId;
            SequenceControl     = new SequenceControlField();
            InformationElements = new InformationElementList(informationElements);

            FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementAuthentication;
        }
示例#11
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)
 {
     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;
 }
示例#12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="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)
        {
            FrameControl       = new FrameControlField();
            Duration           = new DurationField();
            DestinationAddress = destinationAddress;
            SourceAddress      = sourceAddress;
            BssId                 = bssId;
            SequenceControl       = new SequenceControlField();
            CapabilityInformation = new CapabilityInformationField();
            InformationElements   = new InformationElementList(informationElements);

            FrameControl.SubType = FrameControlField.FrameSubTypes.ManagementProbeResponse;
        }
示例#13
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PacketDotNet.Ieee80211.InformationElementList"/> class.
 /// </summary>
 /// <param name='list'>
 /// The elements to be included in the list.
 /// </param>
 public InformationElementList(InformationElementList list)
     : base(list)
 {
 }