101 return (aHeader[0] & (Lowpan::kHcDispatchMask >> 8)) == (Lowpan::kHcDispatch >> 8);
131 const uint8_t *aBuf, uint16_t aBufLen, uint16_t aDatagramLen);
146 const uint8_t *aBuf, uint16_t aBufLength);
151 kHcDispatch = 3 << 13,
152 kHcDispatchMask = 7 << 13,
154 kHcTrafficClass = 1 << 11,
155 kHcFlowLabel = 2 << 11,
156 kHcTrafficFlow = 3 << 11,
157 kHcTrafficFlowMask = 3 << 11,
158 kHcNextHeader = 1 << 10,
159 kHcHopLimit1 = 1 << 8,
160 kHcHopLimit64 = 2 << 8,
161 kHcHopLimit255 = 3 << 8,
162 kHcHopLimitMask = 3 << 8,
163 kHcContextId = 1 << 7,
164 kHcSrcAddrContext = 1 << 6,
165 kHcSrcAddrMode0 = 0 << 4,
166 kHcSrcAddrMode1 = 1 << 4,
167 kHcSrcAddrMode2 = 2 << 4,
168 kHcSrcAddrMode3 = 3 << 4,
169 kHcSrcAddrModeMask = 3 << 4,
170 kHcMulticast = 1 << 3,
171 kHcDstAddrContext = 1 << 2,
172 kHcDstAddrMode0 = 0 << 0,
173 kHcDstAddrMode1 = 1 << 0,
174 kHcDstAddrMode2 = 2 << 0,
175 kHcDstAddrMode3 = 3 << 0,
176 kHcDstAddrModeMask = 3 << 0,
178 kExtHdrDispatch = 0xe0,
179 kExtHdrDispatchMask = 0xf0,
181 kExtHdrEidHbh = 0x00,
182 kExtHdrEidRouting = 0x02,
183 kExtHdrEidFragment = 0x04,
184 kExtHdrEidDst = 0x06,
185 kExtHdrEidMobility = 0x08,
186 kExtHdrEidIp6 = 0x0e,
187 kExtHdrEidMask = 0x0e,
189 kExtHdrNextHeader = 0x01,
192 kUdpDispatchMask = 0xf8,
193 kUdpChecksum = 1 << 2,
194 kUdpPortMask = 3 << 0,
197 int CompressExtensionHeader(
Message &aMessage, uint8_t *aBuf, uint8_t &aNextHeader);
199 uint16_t &aHcCtl, uint8_t *aBuf);
201 uint16_t &aHcCtl, uint8_t *aBuf);
202 int CompressMulticast(
const Ip6::Address &aIpAddr, uint16_t &aHcCtl, uint8_t *aBuf);
203 int CompressUdp(
Message &aMessage, uint8_t *aBuf);
205 int DecompressExtensionHeader(
Message &aMessage,
const uint8_t *aBuf, uint16_t aBufLength);
206 int DecompressUdpHeader(
Message &aMessage,
const uint8_t *aBuf, uint16_t aBufLength, uint16_t aDatagramLength);
223 kAdditionalHopsLeft = 1
236 void Init(
void) { mDispatchHopsLeft = kDispatch | kSourceShort | kDestinationShort; }
248 otError Init(
const uint8_t *aFrame, uint8_t aFrameLength);
268 bool IsMeshHeader(
void) {
return (mDispatchHopsLeft & kDispatchMask) == kDispatch; }
277 bool IsValid(
void) {
return (mDispatchHopsLeft & kSourceShort) && (mDispatchHopsLeft & kDestinationShort); }
294 uint8_t
GetHeaderLength(
void) {
return sizeof(*this) - (IsDeepHopsLeftField() ? 0 :
sizeof(mDeepHopsLeft)) ; }
302 uint8_t
GetHopsLeft(
void) {
return IsDeepHopsLeftField() ? mDeepHopsLeft : mDispatchHopsLeft & kHopsLeftMask; }
311 if (aHops < kDeepHopsLeft && !IsDeepHopsLeftField()) {
312 mDispatchHopsLeft = (mDispatchHopsLeft & ~kHopsLeftMask) | aHops;
315 mDispatchHopsLeft = (mDispatchHopsLeft & ~kHopsLeftMask) | kDeepHopsLeft;
316 mDeepHopsLeft = aHops;
326 uint16_t
GetSource(
void) {
return HostSwap16(mAddress.mSource); }
334 void SetSource(uint16_t aSource) { mAddress.mSource = HostSwap16(aSource); }
350 void SetDestination(uint16_t aDestination) { mAddress.mDestination = HostSwap16(aDestination); }
359 *aFrame++ = mDispatchHopsLeft;
361 if (IsDeepHopsLeftField()) {
362 *aFrame++ = mDeepHopsLeft;
365 memcpy(aFrame, &mAddress,
sizeof(mAddress));
372 kDispatchMask = 3 << 6,
373 kHopsLeftMask = 0x0f,
374 kSourceShort = 1 << 5,
375 kDestinationShort = 1 << 4,
379 uint8_t mDispatchHopsLeft;
380 uint8_t mDeepHopsLeft;
384 uint16_t mDestination;
400 FragmentHeader(
void) { mDispatchSize = HostSwap16(kDispatch); mTag = 0; mOffset = 0; }
406 void Init(
void) { mDispatchSize = HostSwap16(kDispatch); }
418 otError Init(
const uint8_t *aFrame, uint8_t aFrameLength);
427 bool IsFragmentHeader(
void) {
return (HostSwap16(mDispatchSize) & kDispatchMask) == kDispatch; }
435 uint8_t
GetHeaderLength(
void)
const {
return IsOffsetPresent() ?
sizeof(*this) :
sizeof(*this) -
sizeof(mOffset); }
443 bool IsOffsetPresent(
void)
const {
return (HostSwap16(mDispatchSize) & kOffset) != 0; }
451 uint16_t
GetDatagramSize(
void)
const {
return HostSwap16(mDispatchSize) & kSizeMask; }
460 mDispatchSize = HostSwap16((HostSwap16(mDispatchSize) & ~kSizeMask) | (aSize & kSizeMask));
485 uint16_t
GetDatagramOffset(
void)
const {
return IsOffsetPresent() ?
static_cast<uint16_t
>(mOffset) * 8 : 0; }
495 mDispatchSize = HostSwap16(HostSwap16(mDispatchSize) & ~kOffset);
498 mDispatchSize = HostSwap16(HostSwap16(mDispatchSize) | kOffset);
499 mOffset = (aOffset >> 3) & kOffsetMask;
508 kDispatchMask = 0xd800,
513 uint16_t mDispatchSize;
525 #endif // LOWPAN_HPP_
This type represents all the static / global variables used by OpenThread allocated in one place...
Definition: openthread-instance.h:59
This structure represents a LOWPAN_IPHC Context.
Definition: lowpan.hpp:69
This structure represents an IEEE 802.15.4 Short or Extended Address.
Definition: mac_frame.hpp:147
uint8_t mPrefixLength
The prefix length.
Definition: lowpan.hpp:72
This file includes definitions for IPv6 addresses.
This class implements an IPv6 address object.
Definition: ip6_address.hpp:60
This file includes definitions for locator class for OpenThread objects.
bool mCompressFlag
The Context compression flag.
Definition: lowpan.hpp:74
uint8_t mContextId
The Context ID.
Definition: lowpan.hpp:73
IpProto
Internet Protocol Numbers.
Definition: ip6_headers.hpp:93
This file includes definitions for generating and processing IEEE 802.15.4 MAC frames.
This class represents a message.
Definition: message.hpp:195
This file includes definitions for the message buffer pool and message buffers.
This class implements locator for otInstance object.
Definition: locator.hpp:63
const uint8_t * mPrefix
A pointer to the prefix.
Definition: lowpan.hpp:71
This file includes definitions for IPv6 packet processing.
This class implements LOWPAN_IPHC header compression.
Definition: lowpan.hpp:81
static bool IsLowpanHc(uint8_t *aHeader)
This method indicates whether or not the header is a LOWPAN_IPHC header.
Definition: lowpan.hpp:100
otError
This enumeration represents error codes used throughout OpenThread.
Definition: types.h:107
This file includes compile-time configuration constants for OpenThread.