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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     1
/* -*-  Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     2
/*
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     3
 * Copyright (c) 2009 MIRKO BANCHI
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     4
 *
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as 
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     8
 *
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    12
 * GNU General Public License for more details.
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    13
 *
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    17
 *
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    18
 * Author: Mirko Banchi <mk.banchi@gmail.com>
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    19
 */
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    20
#include "qos-utils.h"
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    21
#include "qos-tag.h"
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    22
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    23
namespace ns3 {
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    24
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    25
AccessClass
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    26
QosUtilsMapTidToAc (uint8_t tid)
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    27
{
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    28
  switch (tid) {
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    29
  case 0 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    30
    return AC_BE;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    31
  case 1 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    32
    return AC_BK;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    33
  case 2 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    34
    return AC_BK;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    35
  case 3 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    36
    return AC_BE;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    37
  case 4 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    38
    return AC_VI;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    39
  case 5 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    40
    return AC_VI;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    41
  case 6 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    42
    return AC_VO;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    43
  case 7 : 
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    44
    return AC_VO;
5115
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 4502
diff changeset
    45
  default:
7cdd24c28d4e QoS in 802.11s implementation
Kirill Andreev <andreev@iitp.ru>
parents: 4502
diff changeset
    46
    return AC_BE;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    47
  }
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    48
}
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    49
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    50
uint8_t
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    51
QosUtilsGetTidForPacket (Ptr<const Packet> packet)
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    52
{
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    53
  QosTag qos;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    54
  uint8_t tid = 8;
4502
07d34c0d8d18 new tags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4404
diff changeset
    55
  if (packet->PeekPacketTag (qos))
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    56
    {
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    57
      if (qos.Get () < 8)
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    58
        {
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    59
          tid = qos.Get ();
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    60
        }
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    61
    }
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    62
  return tid;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    63
}
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    64
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    65
} //namespace ns3