EMANE  1.2.1
accesscategory.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 - Adjacent Link LLC, Bridgewater, New Jersey
3  * Copyright (c) 2008 - DRS CenGen, LLC, Columbia, Maryland
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of DRS CenGen, LLC nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33 
34 #ifndef EMANE_MODELS_IEEE80211ABG_ACCESSCATEGORY_HEADER_
35 #define EMANE_MODELS_IEEE80211ABG_ACCESSCATEGORY_HEADER_
36 
37 #include "emane/types.h"
38 
39 
40 #include "macconfig.h"
41 #include "downstreamqueueentry.h"
42 
43 #include <queue>
44 #include <sstream>
45 
46 namespace EMANE
47 {
48  namespace Models
49  {
50  namespace IEEE80211ABG
51  {
52  typedef std::queue <DownstreamQueueEntry> IEEE80211abgDownstreamPacketQueue;
53 
60  {
61  std::uint8_t category_;
62 
63  std::uint8_t u8MaxQueueCapacity_;
64 
65  std::uint16_t u16MaxPacketSize_;
66 
68 
69  IEEE80211abgDownstreamPacketQueue queue_;
70 
71  /*
72  * Stat counters
73  */
74  // unicast
77 
78  // broadcast
81 
82  // queue size/depth
85 
86  /*
87  * Constructor
88  */
90  category_{},
91  u8MaxQueueCapacity_{QUEUE_SIZE_DEFAULT},
92  u16MaxPacketSize_{MAX_PACKET_SIZE},
93  numPacketOverFlow_{},
94  pNumUnicastPacketsTooLarge_{},
95  pNumUnicastBytesTooLarge_{},
96  pNumBroadcastPacketsTooLarge_{},
97  pNumBroadcastBytesTooLarge_{},
98  pNumHighWaterMark_{},
99  pNumHighWaterMax_{}
100  {}
101 
102  void registerStatistics(StatisticRegistrar & statisticRegistrar)
103  {
104  std::string sCategory{std::to_string(category_)};
105 
106  pNumUnicastPacketsTooLarge_ =
107  statisticRegistrar.registerNumeric<std::uint32_t>("numUnicastPacketsTooLarge" + sCategory,
109  pNumUnicastBytesTooLarge_ =
110  statisticRegistrar.registerNumeric<std::uint32_t>("numUnicastBytesTooLarge" + sCategory,
112 
113  pNumBroadcastPacketsTooLarge_ =
114  statisticRegistrar.registerNumeric<std::uint32_t>("numBroadcastPacketsTooLarge" + sCategory,
116  pNumBroadcastBytesTooLarge_ =
117  statisticRegistrar.registerNumeric<std::uint32_t>("numBroadcastBytesTooLarge" + sCategory,
119 
120  pNumHighWaterMark_ =
121  statisticRegistrar.registerNumeric<std::uint32_t>("numHighWaterMark" + sCategory,
123  pNumHighWaterMax_ =
124  statisticRegistrar.registerNumeric<std::uint32_t>("numHighWaterMax" + sCategory,
126  }
127  };
128  }
129  }
130 }
131 #endif //EMANE_MODELS_IEEE80211ABG_ACCESSCATEGORY_HEADER_
IEEE80211abgDownstreamPacketQueue queue_
StatisticNumeric< std::uint32_t > * pNumBroadcastBytesTooLarge_
StatisticNumeric< std::uint32_t > * pNumUnicastBytesTooLarge_
StatisticNumeric< std::uint32_t > * pNumBroadcastPacketsTooLarge_
The StatisticRegistrar allows NEM layers to register statistics and statistic tables. Statistics and Statistic tables are owned by the emulator framework and a borrowed reference is returned to the registering NEM layer.
const std::uint16_t MAX_PACKET_SIZE
Definition: macconfig.h:68
std::queue< DownstreamQueueEntry > IEEE80211abgDownstreamPacketQueue
StatisticNumeric< std::uint32_t > * pNumHighWaterMark_
StatisticNumeric< T > * registerNumeric(const std::string &sName, const StatisticProperties &properties=StatisticProperties::NONE, const std::string &sDescription="")
Defines an access category container.
void registerStatistics(StatisticRegistrar &statisticRegistrar)
const std::uint8_t QUEUE_SIZE_DEFAULT
Definition: macconfig.h:65
StatisticNumeric< std::uint32_t > * pNumUnicastPacketsTooLarge_
StatisticNumeric< std::uint32_t > * pNumHighWaterMax_
Definition: agent.h:43