src/wifi/model/dcf.cc
author Junling Bu <linlinjavaer@gmail.com>
Tue, 03 Dec 2013 11:25:59 -0800
changeset 10459 f2e90c12a44f
parent 10410 4d4eb8097fa3
child 10652 dc18deba4502
permissions -rw-r--r--
base implementation of the IEEE 802.11p standard
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7385
10beb0e53130 standardize emacs c++ mode comments
Vedran Miletić <rivanvx@gmail.com>
parents: 7141
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
4722
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
4722
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#include "dcf.h"
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#include "ns3/uinteger.h"
9711
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 7385
diff changeset
    22
#include "ns3/log.h"
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 7385
diff changeset
    23
7f4c6aa52b52 Further work on cleaning up function logging of wifi module.
Edvin Močibob <edvin.mocibob@gmail.com>
parents: 7385
diff changeset
    24
NS_LOG_COMPONENT_DEFINE ("Dcf");
4722
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    25
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
namespace ns3 {
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
10410
4d4eb8097fa3 doxygen] Suppress "warning: Member NS_OBJECT_ENSURE_REGISTERED is not documented"
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9711
diff changeset
    28
NS_OBJECT_ENSURE_REGISTERED (Dcf)
4d4eb8097fa3 doxygen] Suppress "warning: Member NS_OBJECT_ENSURE_REGISTERED is not documented"
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9711
diff changeset
    29
  ;
4722
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
    31
TypeId
4722
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
Dcf::GetTypeId (void)
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
{
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
  static TypeId tid = TypeId ("ns3::Dcf")
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
    .SetParent<Object> ()
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
    .AddAttribute ("MinCw", "The minimum value of the contention window.",
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
                   UintegerValue (15),
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
                   MakeUintegerAccessor (&Dcf::SetMinCw,
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
                                         &Dcf::GetMinCw),
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
                   MakeUintegerChecker<uint32_t> ())
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
    .AddAttribute ("MaxCw", "The maximum value of the contention window.",
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
                   UintegerValue (1023),
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
                   MakeUintegerAccessor (&Dcf::SetMaxCw,
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
                                         &Dcf::GetMaxCw),
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
                   MakeUintegerChecker<uint32_t> ())
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
    .AddAttribute ("Aifsn", "The AIFSN: the default value conforms to simple DCA.",
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
                   UintegerValue (2),
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
                   MakeUintegerAccessor (&Dcf::SetAifsn,
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
                                         &Dcf::GetAifsn),
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
                   MakeUintegerChecker<uint32_t> ())
7141
072fb225b714 run check-style.py on src/wifi
Nicola Baldo <nicola@baldo.biz>
parents: 6852
diff changeset
    51
  ;
4722
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    52
  return tid;
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
}
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
aa87bed09e3f bug 641: forgot to add files.
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
} // namespace ns3