34 #include "ieee80211abgmacheader.pb.h" 40 inline EMANEMessage::IEEE80211ABGMACHeader_MessageType convertMessageType(std::uint8_t type)
45 return EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_NONE;
48 return EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_BROADCAST_DATA;
51 return EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_UNICAST_DATA;
54 return EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_UNICAST_RTS_CTS_DATA;
57 return EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_UNICAST_CTS_CTRL;
60 return EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_NONE;
64 inline std::uint8_t convertMessageType(EMANEMessage::IEEE80211ABGMACHeader_MessageType type)
68 case EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_NONE:
71 case EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_BROADCAST_DATA:
74 case EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_UNICAST_DATA:
77 case EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_UNICAST_RTS_CTS_DATA:
80 case EMANEMessage::IEEE80211ABGMACHeader_MessageType::IEEE80211ABGMACHeader_MessageType_UNICAST_CTS_CTRL:
89 class EMANE::Models::IEEE80211ABG::MACHeaderMessage::Implementation
92 Implementation(std::uint8_t u8MessageType,
93 std::uint8_t u8NumRetries,
94 std::uint16_t u16DataRateIndex,
95 std::uint16_t u16SequenceNumber,
96 std::uint16_t u16SrcNEM,
97 std::uint16_t u16DstNEM,
99 u8MessageType_{u8MessageType},
100 u8NumRetries_{u8NumRetries},
101 u16DataRateIndex_{u16DataRateIndex},
102 u16SequenceNumber_{u16SequenceNumber},
103 u16SrcNEM_{u16SrcNEM},
104 u16DstNEM_{u16DstNEM},
105 durationMicroseconds_{durationMicroseconds}
110 return u8MessageType_;
115 return u8NumRetries_;
120 return u16DataRateIndex_;
125 return u16SequenceNumber_;
140 return durationMicroseconds_;
144 const std::uint8_t u8MessageType_;
145 const std::uint8_t u8NumRetries_;
146 const std::uint16_t u16DataRateIndex_;
147 const std::uint16_t u16SequenceNumber_;
148 const std::uint16_t u16SrcNEM_;
149 const std::uint16_t u16DstNEM_;
155 std::uint8_t u8NumRetries,
156 std::uint16_t u16DataRateIndex,
157 std::uint16_t u16SequenceNumber,
158 std::uint16_t u16SrcNEM,
159 std::uint16_t u16DstNEM,
162 pImpl_{
new Implementation{u8MessageType,
168 durationMicroseconds}}
175 EMANEMessage::IEEE80211ABGMACHeader message;
177 if(!message.ParseFromArray(p, len))
182 pImpl_.reset(
new Implementation{convertMessageType(message.messagetype()),
183 static_cast<std::uint8_t>(message.numretries()),
184 static_cast<std::uint16_t>(message.datarateindex()),
185 static_cast<std::uint16_t>(message.sequencenumber()),
186 static_cast<std::uint16_t>(message.srcnem()),
187 static_cast<std::uint16_t>(message.dstnem()),
198 return pImpl_->getMessageType();
204 return pImpl_->getNumRetries();
210 return pImpl_->getDataRateIndex();
215 return pImpl_->getSequenceNumber();
220 return pImpl_->getSrcNEM();
225 return pImpl_->getDstNEM();
230 return pImpl_->getDurationMicroseconds();
239 EMANEMessage::IEEE80211ABGMACHeader message;
241 message.set_messagetype(convertMessageType(pImpl_->getMessageType()));
243 message.set_numretries(pImpl_->getNumRetries());
245 message.set_datarateindex(pImpl_->getDataRateIndex());
247 message.set_sequencenumber(pImpl_->getSequenceNumber());
249 message.set_srcnem(pImpl_->getSrcNEM());
251 message.set_dstnem(pImpl_->getDstNEM());
253 message.set_durationmicroseconds(pImpl_->getDurationMicroseconds().count());
255 if(!message.SerializeToString(&serialization))
260 return serialization;
std::string Serialization
const std::uint8_t MSG_TYPE_UNICAST_CTS_CTRL
const std::uint8_t MSG_TYPE_NONE
SerializationException is thrown when an exception occurs during serialization or deserialization of ...
const std::uint8_t MSG_TYPE_BROADCAST_DATA
std::chrono::microseconds Microseconds
const std::uint8_t MSG_TYPE_UNICAST_DATA
const std::uint8_t MSG_TYPE_UNICAST_RTS_CTS_DATA