/// <summary> /// Gets the <see cref="RadioTapField" /> with the specified type, or null if the /// field is not in the packet. /// </summary> /// <param name='type'> /// Radio Tap field type /// </param> public RadioTapField this[RadioTapType type] { get { RadioTapFields.TryGetValue(type, out var field); return(field); } }
/// <summary> /// Removes a field of the specified type if one is present in the packet. /// </summary> /// <param name='fieldType'> /// Field type. /// </param> public void Remove(RadioTapType fieldType) { RadioTapField field; if (RadioTapFields.TryGetValue(fieldType, out field)) { RadioTapFields.Remove(fieldType); Length -= field.Length; var presenceBit = (int)field.FieldType; var presenceField = (presenceBit / 32); Present[presenceField] &= (UInt32) ~(1 << presenceBit); } }