/* This file is part of PacketDotNet PacketDotNet is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. PacketDotNet is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with PacketDotNet. If not, see . */ /* * Copyright 2012 Alan Rushforth */ using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace PacketDotNet { namespace Ieee80211 { /// /// Block acknowledgment control field. /// public class BlockAcknowledgmentControlField { /// /// The available block acknowledgement policies. /// public enum AcknowledgementPolicy { /// /// The acknowledgement does not have to be sent immediately after the request /// Delayed = 0, /// /// The acknowledgement must be sent immediately after the request /// Immediate = 1, } /// /// The block acknowledgement policy in use /// public AcknowledgementPolicy Policy { get { return (AcknowledgementPolicy)(Field & 0x1); } set { if (value == AcknowledgementPolicy.Immediate) { Field |= 0x1; } else { Field &= unchecked((UInt16)~(0x1)); } } } /// /// True if the acknowledgement can ack multi traffic ids /// public bool MultiTid { get { return (((Field >> 1) & 0x1) == 1) ? true : false; } set { if (value) { Field |= (1 << 0x1); } else { Field &= unchecked((UInt16)~(1 << 0x1)); } } } /// /// True if the frame is using a compressed acknowledgement bitmap. /// /// Newer standards used a compressed bitmap reducing its size /// public bool CompressedBitmap { get { return (((Field >> 2) & 0x1) == 1) ? true : false; } set { if (value) { Field |= (1 << 0x2); } else { Field &= unchecked((UInt16)~(1 << 0x2)); } } } /// /// The traffic id being ack'd /// public byte Tid { get { return (byte)(Field >> 12); } set { Field &= 0x0FFF; Field |= (UInt16)(value << 12); } } /// /// Gets or sets the field. This provides direct access to the bytes that back all the other properties in the field. /// /// /// The field. /// public UInt16 Field {get; set;} /// /// Initializes a new instance of the class. /// public BlockAcknowledgmentControlField () { } /// /// Initializes a new instance of the class. /// /// /// Field. /// public BlockAcknowledgmentControlField(UInt16 field) { Field = field; } } } }