src/devices/wifi/qos-utils.cc
changeset 4404 e10005ac0701
child 4502 07d34c0d8d18
equal deleted inserted replaced
4403:54141b0e8f9f 4404:e10005ac0701
       
     1 /* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
       
     2 /*
       
     3  * Copyright (c) 2009 MIRKO BANCHI
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License version 2 as 
       
     7  * published by the Free Software Foundation;
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
       
    17  *
       
    18  * Author: Mirko Banchi <mk.banchi@gmail.com>
       
    19  */
       
    20 #include "qos-utils.h"
       
    21 #include "qos-tag.h"
       
    22 
       
    23 namespace ns3 {
       
    24 
       
    25 AccessClass
       
    26 QosUtilsMapTidToAc (uint8_t tid)
       
    27 {
       
    28   switch (tid) {
       
    29   case 0 :
       
    30     return AC_BE;
       
    31     break;
       
    32   case 1 :
       
    33     return AC_BK;
       
    34     break;
       
    35   case 2 :
       
    36     return AC_BK;
       
    37     break;
       
    38   case 3 :
       
    39     return AC_BE;
       
    40     break;
       
    41   case 4 :
       
    42     return AC_VI;
       
    43     break;
       
    44   case 5 :
       
    45     return AC_VI;
       
    46     break;
       
    47   case 6 :
       
    48     return AC_VO;
       
    49     break;
       
    50   case 7 : 
       
    51     return AC_VO;
       
    52     break;
       
    53   }
       
    54   return AC_UNDEF;
       
    55 }
       
    56 
       
    57 uint8_t
       
    58 QosUtilsGetTidForPacket (Ptr<const Packet> packet)
       
    59 {
       
    60   QosTag qos;
       
    61   uint8_t tid = 8;
       
    62   if (packet->FindFirstMatchingTag (qos))
       
    63     {
       
    64       if (qos.Get () < 8)
       
    65         {
       
    66           tid = qos.Get ();
       
    67         }
       
    68     }
       
    69   return tid;
       
    70 }
       
    71 
       
    72 } //namespace ns3