src/wifi/model/capability-information.h
author Tom Henderson <tomh@tomh.org>
Sat, 16 Jan 2016 08:14:40 -0800
changeset 11683 9142266fbb25
parent 11450 9f4ae69f12b7
permissions -rw-r--r--
add figures to main documentation build

/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2006 INRIA
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation;
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
 */

#ifndef CAPABILITY_INFORMATION_H
#define CAPABILITY_INFORMATION_H

#include <stdint.h>
#include "ns3/buffer.h"

namespace ns3 {

/**
 * \ingroup wifi
 *
 * Capability information
 */
class CapabilityInformation
{
public:
  CapabilityInformation ();

  /**
   * Set the Extended Service Set (ESS) bit
   * in the capability information field.
   */
  void SetEss (void);
  /**
   * Set the Independent BSS (IBSS) bit
   * in the capability information field.
   */
  void SetIbss (void);

  /**
   * Check if the Extended Service Set (ESS) bit
   * in the capability information field is set to 1.
   *
   * \return ESS bit in the capability information
   *         field is set to 1
   */
  bool IsEss (void) const;
  /**
   * Check if the Independent BSS (IBSS) bit
   * in the capability information field is set to 1.
   *
   * \return IBSS bit in the capability information
   *         field is set to 1
   */
  bool IsIbss (void) const;

  /**
   * Return the serialized size of capability
   * information.
   *
   * \return the serialized size
   */
  uint32_t GetSerializedSize (void) const;
  /**
   * Serialize capability information to the given buffer.
   *
   * \param start an iterator to a buffer
   * \return an iterator to a buffer after capability information
   *         was serialized
   */
  Buffer::Iterator Serialize (Buffer::Iterator start) const;
  /**
   * Deserialize capability information from the given buffer.
   *
   * \param start an iterator to a buffer
   * \return an iterator to a buffer after capability information
   *         was deserialized
   */
  Buffer::Iterator Deserialize (Buffer::Iterator start);


private:
  /**
   * Check if bit n is set to 1.
   *
   * \param n the bit position
   *
   * \return true if bit n is set to 1,
   *         false otherwise
   */
  bool Is (uint8_t n) const;
  /**
   * Set bit n to 1.
   *
   * \param n the bit position
   */
  void Set (uint8_t n);
  /**
   * Set bit n to 0.
   *
   * \param n the bit position
   */
  void Clear (uint8_t n);
  uint16_t m_capability;
};

} //namespace ns3

#endif /* CAPABILITY_INFORMATION_H */