[style] minor coding standard fixes (#2234)

This commit is contained in:
Łukasz Duda
2017-09-30 08:32:39 -07:00
committed by Jonathan Hui
parent fe1c162e42
commit 42caf024c8
8 changed files with 76 additions and 76 deletions
+3 -3
View File
@@ -141,7 +141,7 @@ public:
}
private:
void HandleReceivedFrame(Frame &frame) { mReceiveFrameHandler(*this, frame); }
void HandleReceivedFrame(Frame &aFrame) { mReceiveFrameHandler(*this, aFrame); }
void HandleDataPollTimeout(void) {
if (mPollTimeoutHandler != NULL) {
@@ -198,8 +198,8 @@ public:
}
private:
otError HandleFrameRequest(Frame &frame) { return mFrameRequestHandler(*this, frame); }
void HandleSentFrame(Frame &frame, otError error) { mSentFrameHandler(*this, frame, error); }
otError HandleFrameRequest(Frame &aFrame) { return mFrameRequestHandler(*this, aFrame); }
void HandleSentFrame(Frame &aFrame, otError aError) { mSentFrameHandler(*this, aFrame, aError); }
FrameRequestHandler mFrameRequestHandler;
SentFrameHandler mSentFrameHandler;
+2 -2
View File
@@ -209,8 +209,8 @@ public:
}
private:
void HandleReceiveMessage(Message &message, const MessageInfo &messageInfo, const IcmpHeader &icmp6Header) {
mReceiveCallback(mContext, &message, &messageInfo, &icmp6Header);
void HandleReceiveMessage(Message &aMessage, const MessageInfo &aMessageInfo, const IcmpHeader &aIcmp6Header) {
mReceiveCallback(mContext, &aMessage, &aMessageInfo, &aIcmp6Header);
}
IcmpHandler *GetNext(void) { return static_cast<IcmpHandler *>(mNext); }
+1 -1
View File
@@ -314,7 +314,7 @@
/**
* @def OPENTHREAD_CONFIG_JOINER_UDP_PORT
*
* The MPL cache entry lifetime in seconds.
* The default Joiner UDP port.
*
*/
#ifndef OPENTHREAD_CONFIG_JOINER_UDP_PORT
+39 -39
View File
@@ -594,7 +594,7 @@ exit:
return error;
}
int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMacSource, const Mac::Address &aMacDest,
int Lowpan::DecompressBaseHeader(Ip6::Header &aIp6Header, const Mac::Address &aMacSource, const Mac::Address &aMacDest,
const uint8_t *aBuf, uint16_t aBufLength)
{
NetworkData::Leader &networkData = GetNetif().GetNetworkDataLeader();
@@ -642,15 +642,15 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
networkData.GetContext(0, dstContext);
}
memset(&ip6Header, 0, sizeof(ip6Header));
ip6Header.Init();
memset(&aIp6Header, 0, sizeof(aIp6Header));
aIp6Header.Init();
// Traffic Class and Flow Label
if ((hcCtl & kHcTrafficFlowMask) != kHcTrafficFlow)
{
VerifyOrExit(remaining >= 1);
bytes = reinterpret_cast<uint8_t *>(&ip6Header);
bytes = reinterpret_cast<uint8_t *>(&aIp6Header);
bytes[1] |= (cur[0] & 0xc0) >> 2;
if ((hcCtl & kHcTrafficClass) == 0)
@@ -676,7 +676,7 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
if ((hcCtl & kHcNextHeader) == 0)
{
VerifyOrExit(remaining >= 1);
ip6Header.SetNextHeader(static_cast<Ip6::IpProto>(cur[0]));
aIp6Header.SetNextHeader(static_cast<Ip6::IpProto>(cur[0]));
cur++;
remaining--;
}
@@ -685,20 +685,20 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
switch (hcCtl & kHcHopLimitMask)
{
case kHcHopLimit1:
ip6Header.SetHopLimit(1);
aIp6Header.SetHopLimit(1);
break;
case kHcHopLimit64:
ip6Header.SetHopLimit(64);
aIp6Header.SetHopLimit(64);
break;
case kHcHopLimit255:
ip6Header.SetHopLimit(255);
aIp6Header.SetHopLimit(255);
break;
default:
VerifyOrExit(remaining >= 1);
ip6Header.SetHopLimit(cur[0]);
aIp6Header.SetHopLimit(cur[0]);
cur++;
remaining--;
break;
@@ -711,7 +711,7 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
if ((hcCtl & kHcSrcAddrContext) == 0)
{
VerifyOrExit(remaining >= sizeof(Ip6::Address));
memcpy(&ip6Header.GetSource(), cur, sizeof(ip6Header.GetSource()));
memcpy(&aIp6Header.GetSource(), cur, sizeof(aIp6Header.GetSource()));
cur += sizeof(Ip6::Address);
remaining -= sizeof(Ip6::Address);
}
@@ -720,22 +720,22 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
case kHcSrcAddrMode1:
VerifyOrExit(remaining >= Ip6::Address::kInterfaceIdentifierSize);
ip6Header.GetSource().SetIid(cur);
aIp6Header.GetSource().SetIid(cur);
cur += Ip6::Address::kInterfaceIdentifierSize;
remaining -= Ip6::Address::kInterfaceIdentifierSize;
break;
case kHcSrcAddrMode2:
VerifyOrExit(remaining >= 2);
ip6Header.GetSource().mFields.m8[11] = 0xff;
ip6Header.GetSource().mFields.m8[12] = 0xfe;
memcpy(ip6Header.GetSource().mFields.m8 + 14, cur, 2);
aIp6Header.GetSource().mFields.m8[11] = 0xff;
aIp6Header.GetSource().mFields.m8[12] = 0xfe;
memcpy(aIp6Header.GetSource().mFields.m8 + 14, cur, 2);
cur += 2;
remaining -= 2;
break;
case kHcSrcAddrMode3:
ComputeIid(aMacSource, srcContext, ip6Header.GetSource());
ComputeIid(aMacSource, srcContext, aIp6Header.GetSource());
break;
}
@@ -743,12 +743,12 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
{
if ((hcCtl & kHcSrcAddrContext) == 0)
{
ip6Header.GetSource().mFields.m16[0] = HostSwap16(0xfe80);
aIp6Header.GetSource().mFields.m16[0] = HostSwap16(0xfe80);
}
else
{
VerifyOrExit(srcContextValid);
CopyContext(srcContext, ip6Header.GetSource());
CopyContext(srcContext, aIp6Header.GetSource());
}
}
@@ -761,29 +761,29 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
case kHcDstAddrMode0:
VerifyOrExit((hcCtl & kHcDstAddrContext) == 0);
VerifyOrExit(remaining >= sizeof(Ip6::Address));
memcpy(&ip6Header.GetDestination(), cur, sizeof(ip6Header.GetDestination()));
memcpy(&aIp6Header.GetDestination(), cur, sizeof(aIp6Header.GetDestination()));
cur += sizeof(Ip6::Address);
remaining -= sizeof(Ip6::Address);
break;
case kHcDstAddrMode1:
VerifyOrExit(remaining >= Ip6::Address::kInterfaceIdentifierSize);
ip6Header.GetDestination().SetIid(cur);
aIp6Header.GetDestination().SetIid(cur);
cur += Ip6::Address::kInterfaceIdentifierSize;
remaining -= Ip6::Address::kInterfaceIdentifierSize;
break;
case kHcDstAddrMode2:
VerifyOrExit(remaining >= 2);
ip6Header.GetDestination().mFields.m8[11] = 0xff;
ip6Header.GetDestination().mFields.m8[12] = 0xfe;
memcpy(ip6Header.GetDestination().mFields.m8 + 14, cur, 2);
aIp6Header.GetDestination().mFields.m8[11] = 0xff;
aIp6Header.GetDestination().mFields.m8[12] = 0xfe;
memcpy(aIp6Header.GetDestination().mFields.m8 + 14, cur, 2);
cur += 2;
remaining -= 2;
break;
case kHcDstAddrMode3:
SuccessOrExit(ComputeIid(aMacDest, dstContext, ip6Header.GetDestination()));
SuccessOrExit(ComputeIid(aMacDest, dstContext, aIp6Header.GetDestination()));
break;
}
@@ -791,20 +791,20 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
{
if ((hcCtl & kHcDstAddrModeMask) != 0)
{
ip6Header.GetDestination().mFields.m16[0] = HostSwap16(0xfe80);
aIp6Header.GetDestination().mFields.m16[0] = HostSwap16(0xfe80);
}
}
else
{
VerifyOrExit(dstContextValid);
CopyContext(dstContext, ip6Header.GetDestination());
CopyContext(dstContext, aIp6Header.GetDestination());
}
}
else
{
// Multicast Destination Address
ip6Header.GetDestination().mFields.m8[0] = 0xff;
aIp6Header.GetDestination().mFields.m8[0] = 0xff;
if ((hcCtl & kHcDstAddrContext) == 0)
{
@@ -812,31 +812,31 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
{
case kHcDstAddrMode0:
VerifyOrExit(remaining >= sizeof(Ip6::Address));
memcpy(ip6Header.GetDestination().mFields.m8, cur, sizeof(Ip6::Address));
memcpy(aIp6Header.GetDestination().mFields.m8, cur, sizeof(Ip6::Address));
cur += sizeof(Ip6::Address);
remaining -= sizeof(Ip6::Address);
break;
case kHcDstAddrMode1:
VerifyOrExit(remaining >= 6);
ip6Header.GetDestination().mFields.m8[1] = cur[0];
memcpy(ip6Header.GetDestination().mFields.m8 + 11, cur + 1, 5);
aIp6Header.GetDestination().mFields.m8[1] = cur[0];
memcpy(aIp6Header.GetDestination().mFields.m8 + 11, cur + 1, 5);
cur += 6;
remaining -= 6;
break;
case kHcDstAddrMode2:
VerifyOrExit(remaining >= 4);
ip6Header.GetDestination().mFields.m8[1] = cur[0];
memcpy(ip6Header.GetDestination().mFields.m8 + 13, cur + 1, 3);
aIp6Header.GetDestination().mFields.m8[1] = cur[0];
memcpy(aIp6Header.GetDestination().mFields.m8 + 13, cur + 1, 3);
cur += 4;
remaining -= 4;
break;
case kHcDstAddrMode3:
VerifyOrExit(remaining >= 1);
ip6Header.GetDestination().mFields.m8[1] = 0x02;
ip6Header.GetDestination().mFields.m8[15] = cur[0];
aIp6Header.GetDestination().mFields.m8[1] = 0x02;
aIp6Header.GetDestination().mFields.m8[15] = cur[0];
cur++;
remaining--;
break;
@@ -849,11 +849,11 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
case 0:
VerifyOrExit(remaining >= 6);
VerifyOrExit(dstContextValid);
ip6Header.GetDestination().mFields.m8[1] = cur[0];
ip6Header.GetDestination().mFields.m8[2] = cur[1];
ip6Header.GetDestination().mFields.m8[3] = dstContext.mPrefixLength;
memcpy(ip6Header.GetDestination().mFields.m8 + 4, dstContext.mPrefix, 8);
memcpy(ip6Header.GetDestination().mFields.m8 + 12, cur + 2, 4);
aIp6Header.GetDestination().mFields.m8[1] = cur[0];
aIp6Header.GetDestination().mFields.m8[2] = cur[1];
aIp6Header.GetDestination().mFields.m8[3] = dstContext.mPrefixLength;
memcpy(aIp6Header.GetDestination().mFields.m8 + 4, dstContext.mPrefix, 8);
memcpy(aIp6Header.GetDestination().mFields.m8 + 12, cur + 2, 4);
cur += 6;
remaining -= 6;
break;
@@ -868,7 +868,7 @@ int Lowpan::DecompressBaseHeader(Ip6::Header &ip6Header, const Mac::Address &aMa
{
VerifyOrExit(remaining >= 1);
SuccessOrExit(DispatchToNextHeader(cur[0], nextHeader));
ip6Header.SetNextHeader(nextHeader);
aIp6Header.SetNextHeader(nextHeader);
}
error = OT_ERROR_NONE;
+10 -10
View File
@@ -192,17 +192,17 @@ private:
kUdpPortMask = 3 << 0,
};
int CompressExtensionHeader(Message &message, uint8_t *aBuf, uint8_t &nextHeader);
int CompressSourceIid(const Mac::Address &macaddr, const Ip6::Address &ipaddr, const Context &aContext,
uint16_t &hcCtl, uint8_t *aBuf);
int CompressDestinationIid(const Mac::Address &macaddr, const Ip6::Address &ipaddr, const Context &aContext,
uint16_t &hcCtl, uint8_t *aBuf);
int CompressMulticast(const Ip6::Address &ipaddr, uint16_t &hcCtl, uint8_t *aBuf);
int CompressUdp(Message &message, uint8_t *aBuf);
int CompressExtensionHeader(Message &aMessage, uint8_t *aBuf, uint8_t &aNextHeader);
int CompressSourceIid(const Mac::Address &aMacAddr, const Ip6::Address &aIpAddr, const Context &aContext,
uint16_t &aHcCtl, uint8_t *aBuf);
int CompressDestinationIid(const Mac::Address &aMacAddr, const Ip6::Address &aIpAddr, const Context &aContext,
uint16_t &aHcCtl, uint8_t *aBuf);
int CompressMulticast(const Ip6::Address &aIpAddr, uint16_t &aHcCtl, uint8_t *aBuf);
int CompressUdp(Message &aMessage, uint8_t *aBuf);
int DecompressExtensionHeader(Message &message, const uint8_t *aBuf, uint16_t aBufLength);
int DecompressUdpHeader(Message &message, const uint8_t *aBuf, uint16_t aBufLength, uint16_t datagramLength);
otError DispatchToNextHeader(uint8_t dispatch, Ip6::IpProto &nextHeader);
int DecompressExtensionHeader(Message &aMessage, const uint8_t *aBuf, uint16_t aBufLength);
int DecompressUdpHeader(Message &aMessage, const uint8_t *aBuf, uint16_t aBufLength, uint16_t aDatagramLength);
otError DispatchToNextHeader(uint8_t aDispatch, Ip6::IpProto &aNextHeader);
static otError CopyContext(const Context &aContext, Ip6::Address &aAddress);
static otError ComputeIid(const Mac::Address &aMacAddr, const Context &aContext, Ip6::Address &aIpAddress);
+18 -18
View File
@@ -1975,7 +1975,7 @@ exit:
return;
}
otError MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &challenge, bool aRoutersOnlyRequest)
otError MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &aChallenge, bool aRoutersOnlyRequest)
{
otError error = OT_ERROR_NONE;
Ip6::Address destination;
@@ -1990,7 +1990,7 @@ otError MleRouter::SendParentResponse(Child *aChild, const ChallengeTlv &challen
SuccessOrExit(error = AppendLeaderData(*message));
SuccessOrExit(error = AppendLinkFrameCounter(*message));
SuccessOrExit(error = AppendMleFrameCounter(*message));
SuccessOrExit(error = AppendResponse(*message, challenge.GetChallenge(), challenge.GetLength()));
SuccessOrExit(error = AppendResponse(*message, aChallenge.GetChallenge(), aChallenge.GetLength()));
aChild->GenerateChallenge();
@@ -3138,16 +3138,16 @@ Child *MleRouter::GetChild(const Mac::Address &aAddress)
return NULL;
}
uint8_t MleRouter::GetChildIndex(const Child &child)
uint8_t MleRouter::GetChildIndex(const Child &aChild)
{
return static_cast<uint8_t>(&child - mChildren);
return static_cast<uint8_t>(&aChild - mChildren);
}
Child *MleRouter::GetChildren(uint8_t *numChildren)
Child *MleRouter::GetChildren(uint8_t *aNumChildren)
{
if (numChildren != NULL)
if (aNumChildren != NULL)
{
*numChildren = mMaxChildrenAllowed;
*aNumChildren = mMaxChildrenAllowed;
}
return mChildren;
@@ -4514,15 +4514,15 @@ exit:
return error;
}
void MleRouter::FillRouteTlv(RouteTlv &tlv)
void MleRouter::FillRouteTlv(RouteTlv &aTlv)
{
uint8_t routeCount = 0;
uint8_t linkCost;
uint8_t cost;
tlv.SetRouterIdSequence(mRouterIdSequence);
tlv.ClearRouterIdMask();
aTlv.SetRouterIdSequence(mRouterIdSequence);
aTlv.ClearRouterIdMask();
for (uint8_t i = 0; i <= kMaxRouterId; i++)
{
@@ -4531,13 +4531,13 @@ void MleRouter::FillRouteTlv(RouteTlv &tlv)
continue;
}
tlv.SetRouterId(i);
aTlv.SetRouterId(i);
if (i == mRouterId)
{
tlv.SetLinkQualityIn(routeCount, 0);
tlv.SetLinkQualityOut(routeCount, 0);
tlv.SetRouteCost(routeCount, 1);
aTlv.SetLinkQualityIn(routeCount, 0);
aTlv.SetLinkQualityOut(routeCount, 0);
aTlv.SetRouteCost(routeCount, 1);
}
else
{
@@ -4562,15 +4562,15 @@ void MleRouter::FillRouteTlv(RouteTlv &tlv)
cost = 0;
}
tlv.SetRouteCost(routeCount, cost);
tlv.SetLinkQualityOut(routeCount, mRouters[i].GetLinkQualityOut());
tlv.SetLinkQualityIn(routeCount, mRouters[i].GetLinkInfo().GetLinkQuality());
aTlv.SetRouteCost(routeCount, cost);
aTlv.SetLinkQualityOut(routeCount, mRouters[i].GetLinkQualityOut());
aTlv.SetLinkQualityIn(routeCount, mRouters[i].GetLinkInfo().GetLinkQuality());
}
routeCount++;
}
tlv.SetRouteDataLength(routeCount);
aTlv.SetRouteDataLength(routeCount);
}
otError MleRouter::AppendRoute(Message &aMessage)
+1 -1
View File
@@ -232,7 +232,7 @@ protected:
private:
otError RemoveCommissioningData(void);
otError ExternalRouteLookup(uint8_t aDomainId, const Ip6::Address &destination,
otError ExternalRouteLookup(uint8_t aDomainId, const Ip6::Address &aDestination,
uint8_t *aPrefixMatch, uint16_t *aRloc16);
otError DefaultRouteLookup(PrefixTlv &aPrefix, uint16_t *aRloc16);
};
+2 -2
View File
@@ -164,12 +164,12 @@ otError ThreadNetif::GetLinkAddress(Ip6::LinkAddress &address) const
return OT_ERROR_NONE;
}
otError ThreadNetif::RouteLookup(const Ip6::Address &source, const Ip6::Address &destination, uint8_t *prefixMatch)
otError ThreadNetif::RouteLookup(const Ip6::Address &aSource, const Ip6::Address &aDestination, uint8_t *aPrefixMatch)
{
otError error;
uint16_t rloc;
SuccessOrExit(error = mNetworkDataLeader.RouteLookup(source, destination, prefixMatch, &rloc));
SuccessOrExit(error = mNetworkDataLeader.RouteLookup(aSource, aDestination, aPrefixMatch, &rloc));
if (rloc == mMleRouter.GetRloc16())
{