Beispiel #1
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public AssociationRequestFrame(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;

                if (bas.Length > AssociationRequestFields.InformationElement1Position)
                {
                    //create a segment that just refers to the info element section
                    ByteArraySegment infoElementsSegment = new ByteArraySegment(bas.Bytes,
                                                                                (bas.Offset + AssociationRequestFields.InformationElement1Position),
                                                                                (bas.Length - AssociationRequestFields.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;
            }
Beispiel #3
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public CtsFrame(ByteArraySegment bas)
            {
                header = new ByteArraySegment(bas);

                FrameControl    = new FrameControlField(FrameControlBytes);
                Duration        = new DurationField(DurationBytes);
                ReceiverAddress = GetAddress(0);

                header.Length = FrameSize;
            }
Beispiel #4
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public CtsFrame (ByteArraySegment bas)
            {
                header = new ByteArraySegment (bas);

                FrameControl = new FrameControlField (FrameControlBytes);
                Duration = new DurationField (DurationBytes);
                ReceiverAddress = GetAddress(0);
				
				header.Length = FrameSize;
            }
Beispiel #5
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;
            }
Beispiel #6
0
            /// <summary>
            /// Initializes a new instance of the <see cref="Kavprot.Packets.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;
            }
Beispiel #7
0
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public BlockAcknowledgmentRequestFrame(ByteArraySegment bas)
            {
                header = new ByteArraySegment(bas);

                FrameControl                    = new FrameControlField(FrameControlBytes);
                Duration                        = new DurationField(DurationBytes);
                ReceiverAddress                 = GetAddress(0);
                TransmitterAddress              = GetAddress(1);
                BlockAcknowledgmentControl      = new BlockAcknowledgmentControlField(BlockAckRequestControlBytes);
                BlockAckStartingSequenceControl = BlockAckStartingSequenceControlBytes;

                header.Length = FrameSize;
            }
Beispiel #8
0
            /// <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;
            }
Beispiel #9
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);
				}
            }
Beispiel #10
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);
                }
            }
Beispiel #11
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);
                }
            }
Beispiel #12
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);
				}
            }
        void ReleaseDesignerOutlets()
        {
            if (BillableButton != null)
            {
                BillableButton.Dispose();
                BillableButton = null;
            }

            if (BillableButtonWidthConstraint != null)
            {
                BillableButtonWidthConstraint.Dispose();
                BillableButtonWidthConstraint = null;
            }

            if (BottomDistanceConstraint != null)
            {
                BottomDistanceConstraint.Dispose();
                BottomDistanceConstraint = null;
            }

            if (BottomOptionsSheet != null)
            {
                BottomOptionsSheet.Dispose();
                BottomOptionsSheet = null;
            }

            if (CloseButton != null)
            {
                CloseButton.Dispose();
                CloseButton = null;
            }

            if (DateTimeButton != null)
            {
                DateTimeButton.Dispose();
                DateTimeButton = null;
            }

            if (DescriptionRemainingLengthLabel != null)
            {
                DescriptionRemainingLengthLabel.Dispose();
                DescriptionRemainingLengthLabel = null;
            }

            if (DescriptionTextView != null)
            {
                DescriptionTextView.Dispose();
                DescriptionTextView = null;
            }

            if (DoneButton != null)
            {
                DoneButton.Dispose();
                DoneButton = null;
            }

            if (StartDateButton != null)
            {
                StartDateButton.Dispose();
                StartDateButton = null;
            }

            if (Placeholder != null)
            {
                Placeholder.Dispose();
                Placeholder = null;
            }

            if (ProjectsButton != null)
            {
                ProjectsButton.Dispose();
                ProjectsButton = null;
            }

            if (SuggestionsTableView != null)
            {
                SuggestionsTableView.Dispose();
                SuggestionsTableView = null;
            }

            if (TagsButton != null)
            {
                TagsButton.Dispose();
                TagsButton = null;
            }

            if (TimeInput != null)
            {
                TimeInput.Dispose();
                TimeInput = null;
            }
        }
Beispiel #14
0
        private void CalcMomentary(List <Field> Fields, DateTime Now, ushort Raw)
        {
            Fields.Add(new Int32Field(this, Now, "Raw", Raw, FieldType.Momentary, FieldQoS.AutomaticReadout, typeof(Module).Namespace, 26));

            if (this.exp is null && !string.IsNullOrEmpty(this.expression))
            {
                this.exp = new Expression(this.expression);
            }

            if (this.exp != null)
            {
                Variables v = new Variables()
                {
                    { "Raw", (double)Raw }
                };

                object Value = this.exp.Evaluate(v);
                Field  F;

                if (Value is double dbl)
                {
                    F = new QuantityField(this, Now, this.fieldName, dbl, this.nrDecimals, this.unit, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is PhysicalQuantity qty)
                {
                    F = new QuantityField(this, Now, this.fieldName, qty.Magnitude, this.nrDecimals, qty.Unit.ToString(), FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is bool b)
                {
                    F = new BooleanField(this, Now, this.fieldName, b, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is DateTime DT)
                {
                    F = new DateTimeField(this, Now, this.fieldName, DT, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is Duration D)
                {
                    F = new DurationField(this, Now, this.fieldName, D, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is Enum E)
                {
                    F = new EnumField(this, Now, this.fieldName, E, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is int i32)
                {
                    if (string.IsNullOrEmpty(this.unit))
                    {
                        F = new Int32Field(this, Now, this.fieldName, i32, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                    else
                    {
                        F = new QuantityField(this, Now, this.fieldName, i32, 0, this.unit, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                }
                else if (Value is long i64)
                {
                    if (string.IsNullOrEmpty(this.unit))
                    {
                        F = new Int64Field(this, Now, this.fieldName, i64, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                    else
                    {
                        F = new QuantityField(this, Now, this.fieldName, i64, 0, this.unit, FieldType.Momentary, FieldQoS.AutomaticReadout);
                    }
                }
                else if (Value is string s)
                {
                    F = new StringField(this, Now, this.fieldName, s, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else if (Value is TimeSpan TS)
                {
                    F = new TimeField(this, Now, this.fieldName, TS, FieldType.Momentary, FieldQoS.AutomaticReadout);
                }
                else
                {
                    F = new StringField(this, Now, this.fieldName, Value.ToString(), FieldType.Momentary, FieldQoS.AutomaticReadout);
                }

                if (this.fieldName == "Value")
                {
                    F.Module        = typeof(Module).Namespace;
                    F.StringIdSteps = new LocalizationStep[] { new LocalizationStep(13) };
                }

                Fields.Add(F);
            }
        }
            /// <summary>
            /// Constructor
            /// </summary>
            /// <param name="bas">
            /// A <see cref="ByteArraySegment"/>
            /// </param>
            public BlockAcknowledgmentRequestFrame (ByteArraySegment bas)
            {
                header = new ByteArraySegment (bas);

                FrameControl = new FrameControlField (FrameControlBytes);
                Duration = new DurationField (DurationBytes);
                ReceiverAddress = GetAddress (0);
                TransmitterAddress = GetAddress (1);
                BlockAcknowledgmentControl = new BlockAcknowledgmentControlField (BlockAckRequestControlBytes);
                BlockAckStartingSequenceControl = BlockAckStartingSequenceControlBytes;
                
                header.Length = FrameSize;
            }
            /// <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;
            }
Beispiel #17
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);
                }
            }
            /// <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;
            }