LEFT | RIGHT |
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ | 1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
2 /* | 2 /* |
3 * Copyright (c) 2016 | 3 * Copyright (c) 2016 |
4 * | 4 * |
5 * This program is free software; you can redistribute it and/or modify | 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 | 6 * it under the terms of the GNU General Public License version 2 as |
7 * published by the Free Software Foundation; | 7 * published by the Free Software Foundation; |
8 * | 8 * |
9 * This program is distributed in the hope that it will be useful, | 9 * This program is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 double | 48 double |
49 WToDbm (double w) | 49 WToDbm (double w) |
50 { | 50 { |
51 return 10.0 * std::log10 (w * 1000.0); | 51 return 10.0 * std::log10 (w * 1000.0); |
52 } | 52 } |
53 | 53 |
54 double | 54 double |
55 RatioToDb (double ratio) | 55 RatioToDb (double ratio) |
56 { | 56 { |
57 return 10.0 * std::log10 (ratio); | 57 return 10.0 * std::log10 (ratio); |
| 58 } |
| 59 |
| 60 bool |
| 61 Is2_4Ghz (double frequency) |
| 62 { |
| 63 if (frequency >= 2400 && frequency <= 2500) |
| 64 { |
| 65 return true; |
| 66 } |
| 67 return false; |
| 68 } |
| 69 |
| 70 bool |
| 71 Is5Ghz (double frequency) |
| 72 { |
| 73 if (frequency >= 5000 && frequency <= 6000) |
| 74 { |
| 75 return true; |
| 76 } |
| 77 return false; |
58 } | 78 } |
59 | 79 |
60 uint16_t | 80 uint16_t |
61 ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Tim
e heGuardInterval) | 81 ConvertGuardIntervalToNanoSeconds (WifiMode mode, bool htShortGuardInterval, Tim
e heGuardInterval) |
62 { | 82 { |
63 uint16_t gi; | 83 uint16_t gi; |
64 if (mode.GetModulationClass () == WIFI_MOD_CLASS_HE) | 84 if (mode.GetModulationClass () == WIFI_MOD_CLASS_HE) |
65 { | 85 { |
66 gi = static_cast<uint16_t>(heGuardInterval.GetNanoSeconds ()); | 86 gi = static_cast<uint16_t>(heGuardInterval.GetNanoSeconds ()); |
67 } | 87 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 cts.SetType (WIFI_MAC_CTL_CTS); | 141 cts.SetType (WIFI_MAC_CTL_CTS); |
122 return cts.GetSize () + 4; | 142 return cts.GetSize () + 4; |
123 } | 143 } |
124 | 144 |
125 bool | 145 bool |
126 IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize) | 146 IsInWindow (uint16_t seq, uint16_t winstart, uint16_t winsize) |
127 { | 147 { |
128 return ((seq - winstart + 4096) % 4096) < winsize; | 148 return ((seq - winstart + 4096) % 4096) < winsize; |
129 } | 149 } |
130 | 150 |
| 151 void |
| 152 AddWifiMacTrailer (Ptr<Packet> packet) |
| 153 { |
| 154 WifiMacTrailer fcs; |
| 155 packet->AddTrailer (fcs); |
| 156 } |
| 157 |
| 158 uint32_t |
| 159 GetSize (Ptr<const Packet> packet, const WifiMacHeader *hdr, bool isAmpdu) |
| 160 { |
| 161 uint32_t size; |
| 162 WifiMacTrailer fcs; |
| 163 if (isAmpdu) |
| 164 { |
| 165 size = packet->GetSize (); |
| 166 } |
| 167 else |
| 168 { |
| 169 size = packet->GetSize () + hdr->GetSize () + fcs.GetSerializedSize (); |
| 170 } |
| 171 return size; |
| 172 } |
| 173 |
131 } //namespace ns3 | 174 } //namespace ns3 |
LEFT | RIGHT |