src/devices/wifi/qos-utils.cc
author Kirill Andreev <andreev@iitp.ru>
Fri, 10 Jul 2009 18:30:39 +0400
changeset 5115 7cdd24c28d4e
parent 4502 07d34c0d8d18
child 5143 8b5055542351
permissions -rw-r--r--
QoS in 802.11s implementation

/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
/*
 * Copyright (c) 2009 MIRKO BANCHI
 *
 * 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: Mirko Banchi <mk.banchi@gmail.com>
 */
#include "qos-utils.h"
#include "qos-tag.h"

namespace ns3 {

AccessClass
QosUtilsMapTidToAc (uint8_t tid)
{
  switch (tid) {
  case 0 :
    return AC_BE;
  case 1 :
    return AC_BK;
  case 2 :
    return AC_BK;
  case 3 :
    return AC_BE;
  case 4 :
    return AC_VI;
  case 5 :
    return AC_VI;
  case 6 :
    return AC_VO;
  case 7 : 
    return AC_VO;
  default:
    return AC_BE;
  }
}

uint8_t
QosUtilsGetTidForPacket (Ptr<const Packet> packet)
{
  QosTag qos;
  uint8_t tid = 8;
  if (packet->PeekPacketTag (qos))
    {
      if (qos.Get () < 8)
        {
          tid = qos.Get ();
        }
    }
  return tid;
}

} //namespace ns3