EMANE  1.2.1
ieee80211abg/downstreamqueue.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 EMANEMODELSIEEE80211ABGDOWNSTREAMQUEUE_HEADER_
35 #define EMANEMODELSIEEE80211ABGDOWNSTREAMQUEUE_HEADER_
36 
37 #include "emane/types.h"
38 #include "emane/statisticnumeric.h"
39 
40 #include "downstreamqueueentry.h"
41 #include "accesscategory.h"
42 #include "macconfig.h"
43 
44 namespace EMANE
45 {
46  namespace Models
47  {
48  namespace IEEE80211ABG
49  {
56  {
57  public:
59 
61 
62  void setMaxCapacity(size_t);
63 
64  void setMaxCapacity(size_t, std::uint8_t u8Category);
65 
66  void setMaxEntrySize(size_t);
67 
68  void setMaxEntrySize(size_t, std::uint8_t u8Category);
69 
70  size_t getMaxCapacity();
71 
72  size_t getMaxCapacity(std::uint8_t u8Category);
73 
74  size_t getAvailableSpace();
75 
76  size_t getAvailableSpace(std::uint8_t u8Category);
77 
78  size_t getDepth();
79 
80  size_t getDepth(std::uint8_t u8Category);
81 
82  size_t getNumOverFlow(bool bClear);
83 
84  size_t getNumOverFlow(std::uint8_t u8Category, bool bClear);
85 
86  void setCategories(std::uint8_t u8Category);
87 
88  std::pair<DownstreamQueueEntry, bool> dequeue();
89 
90  std::vector<DownstreamQueueEntry> enqueue(DownstreamQueueEntry & entry);
91 
92  void registerStatistics(StatisticRegistrar & statisticRegistrar);
93 
94  private:
95  EMANE::NEMId id_;
96 
98 
99  std::uint8_t numActiveCategories_;
100 
101  StatisticNumeric<std::uint32_t> * pNumUnicastPacketsUnsupported_;
102  StatisticNumeric<std::uint32_t> * pNumUnicastBytesUnsupported_;
103  StatisticNumeric<std::uint32_t> * pNumBroadcastPacketsUnsupported_;
104  StatisticNumeric<std::uint32_t> * pNumBroadcastBytesUnsupported_;
105  };
106  }
107  }
108 }
109 #endif //EMANEMODELSIEEE80211ABGDOWNSTREAMQUEUE_HEADER_
class used to define the mac downstream packet queue
structure defines the mac downstream packet queue entry
const std::uint8_t MAX_ACCESS_CATEGORIES
Definition: macconfig.h:63
size_t getDepth()
get the number of entries for all active queues
std::pair< DownstreamQueueEntry, bool > dequeue()
blocking dequeue, returns highest priority item first
void setMaxEntrySize(size_t)
set the max entry size for all queues
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.
std::uint16_t NEMId
Definition: types.h:52
Defines an access category container.
std::vector< DownstreamQueueEntry > enqueue(DownstreamQueueEntry &entry)
enqueue, inserts items by priority, signals on success.
void setMaxCapacity(size_t)
set the max number of entries for all queues
size_t getMaxCapacity()
get the max number of entries for all queues
void setCategories(std::uint8_t u8Category)
set the number of categories (queues)
void registerStatistics(StatisticRegistrar &statisticRegistrar)
Definition: agent.h:43