Example #1
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;
            }
        /// <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;
        }
Example #3
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;
        }
Example #4
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;
 }
Example #5
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;
        }