src/devices/wifi/qos-utils.cc
author Kirill Andreev <andreev@iitp.ru>
Mon, 03 Aug 2009 19:13:46 +0400
changeset 5145 7f50ab7ce59d
parent 5143 8b5055542351
child 5774 0fad665ff307
permissions -rw-r--r--
Added path update to FLAME
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;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    31
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    32
  case 1 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    33
    return AC_BK;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    34
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    35
  case 2 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    36
    return AC_BK;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    37
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    38
  case 3 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    39
    return AC_BE;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    40
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    41
  case 4 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    42
    return AC_VI;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    43
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    44
  case 5 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    45
    return AC_VI;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    46
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    47
  case 6 :
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    48
    return AC_VO;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    49
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    50
  case 7 : 
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    51
    return AC_VO;
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    52
    break;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    53
  }
5143
8b5055542351 Removed unneded changes from wifi
Kirill Andreev <andreev@iitp.ru>
parents: 5115
diff changeset
    54
  return AC_UNDEF;
4404
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    55
}
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
uint8_t
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    58
QosUtilsGetTidForPacket (Ptr<const Packet> packet)
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    59
{
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    60
  QosTag qos;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    61
  uint8_t tid = 8;
4502
07d34c0d8d18 new tags
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 4404
diff changeset
    62
  if (packet->PeekPacketTag (qos))
4404
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
      if (qos.Get () < 8)
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    65
        {
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    66
          tid = qos.Get ();
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    67
        }
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    68
    }
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    69
  return tid;
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    70
}
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    71
e10005ac0701 shared facility for qos support
Mirko Banchi <mk.banchi@gmail.com>
parents:
diff changeset
    72
} //namespace ns3