- support nested VLANs + fix few clang warnings
This commit is contained in:
parent
aeedeb0626
commit
621afead4b
|
|
@ -25,10 +25,15 @@ NetworkFrame::PacketData NetworkFrame::GetUdpPayloadForEthernet(NetworkFrame::Pa
|
||||||
uint16_t proto = 0;
|
uint16_t proto = 0;
|
||||||
if (ethernet->mEtherType == 129)
|
if (ethernet->mEtherType == 129)
|
||||||
{
|
{
|
||||||
const VlanHeader* vlan = reinterpret_cast<const VlanHeader*>(packet.mData);
|
// Skip 1 or more VLAN headers
|
||||||
packet.mData += sizeof(VlanHeader);
|
do
|
||||||
packet.mLength -= sizeof(VlanHeader);
|
{
|
||||||
proto = ntohs(vlan->mData);
|
const VlanHeader* vlan = reinterpret_cast<const VlanHeader*>(packet.mData);
|
||||||
|
packet.mData += sizeof(VlanHeader);
|
||||||
|
packet.mLength -= sizeof(VlanHeader);
|
||||||
|
proto = ntohs(vlan->mData);
|
||||||
|
}
|
||||||
|
while (proto == 0x8100);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip MPLS headers
|
// Skip MPLS headers
|
||||||
|
|
|
||||||
|
|
@ -245,6 +245,17 @@ std::string MediaStreamId::getFinishDescription() const
|
||||||
return oss.str();
|
return oss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MediaStreamId& MediaStreamId::operator = (const MediaStreamId& src)
|
||||||
|
{
|
||||||
|
this->mDestination = src.mDestination;
|
||||||
|
this->mSource = src.mSource;
|
||||||
|
this->mLinkId = src.mLinkId;
|
||||||
|
this->mSSRC = src.mSSRC;
|
||||||
|
this->mSsrcIsId = src.mSsrcIsId;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
std::ostream& operator << (std::ostream& output, const MediaStreamId& id)
|
std::ostream& operator << (std::ostream& output, const MediaStreamId& id)
|
||||||
{
|
{
|
||||||
return (output << id.toString());
|
return (output << id.toString());
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ struct MediaStreamId
|
||||||
std::string toString() const;
|
std::string toString() const;
|
||||||
std::string getDetectDescription() const;
|
std::string getDetectDescription() const;
|
||||||
std::string getFinishDescription() const;
|
std::string getFinishDescription() const;
|
||||||
|
MediaStreamId& operator = (const MediaStreamId& src);
|
||||||
};
|
};
|
||||||
|
|
||||||
std::ostream& operator << (std::ostream& output, const MediaStreamId& id);
|
std::ostream& operator << (std::ostream& output, const MediaStreamId& id);
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@
|
||||||
# include <ws2tcpip.h>
|
# include <ws2tcpip.h>
|
||||||
#else
|
#else
|
||||||
# include <netinet/in.h>
|
# include <netinet/in.h>
|
||||||
|
|
||||||
# if /*defined(TARGET_LINUX) || */ defined(TARGET_ANDROID)
|
# if /*defined(TARGET_LINUX) || */ defined(TARGET_ANDROID)
|
||||||
# include <linux/in6.h>
|
# include <linux/in6.h>
|
||||||
# endif
|
# endif
|
||||||
|
|
@ -465,15 +465,15 @@ unsigned char* NetworkAddress::ipBytes() const
|
||||||
#endif
|
#endif
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
#ifdef TARGET_WIN
|
#ifdef TARGET_WIN
|
||||||
return (unsigned char*)mAddr6.sin6_addr.u.Byte;
|
return (unsigned char*)mAddr6.sin6_addr.u.Byte;
|
||||||
#elif defined(TARGET_OSX) || defined(TARGET_IOS)
|
#elif defined(TARGET_OSX) || defined(TARGET_IOS)
|
||||||
return (unsigned char*)&mAddr6.sin6_addr.__u6_addr.__u6_addr8;
|
return (unsigned char*)&mAddr6.sin6_addr.__u6_addr.__u6_addr8;
|
||||||
#elif defined(TARGET_OPENWRT) || defined(TARGET_MUSL)
|
#elif defined(TARGET_OPENWRT) || defined(TARGET_MUSL)
|
||||||
return (unsigned char*)&mAddr6.sin6_addr.__in6_union.__s6_addr;
|
return (unsigned char*)&mAddr6.sin6_addr.__in6_union.__s6_addr;
|
||||||
#elif defined(TARGET_LINUX)
|
#elif defined(TARGET_LINUX)
|
||||||
return (unsigned char*)&mAddr6.sin6_addr.__in6_u.__u6_addr8;
|
return (unsigned char*)&mAddr6.sin6_addr.__in6_u.__u6_addr8;
|
||||||
#elif defined(TARGET_ANDROID)
|
#elif defined(TARGET_ANDROID)
|
||||||
return (unsigned char*)&mAddr6.sin6_addr.in6_u.u6_addr8;
|
return (unsigned char*)&mAddr6.sin6_addr.in6_u.u6_addr8;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
assert(0);
|
assert(0);
|
||||||
|
|
@ -783,3 +783,12 @@ bool NetworkAddress::isSame(const NetworkAddress& a1, const NetworkAddress& a2)
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NetworkAddress& NetworkAddress::operator = (const NetworkAddress& src)
|
||||||
|
{
|
||||||
|
this->mInitialized = src.mInitialized;
|
||||||
|
this->mRelayed = src.mRelayed;
|
||||||
|
this->mAddr6 = src.mAddr6;
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,9 @@ namespace ice
|
||||||
static bool isSameHost(const NetworkAddress& a1, const NetworkAddress& a2);
|
static bool isSameHost(const NetworkAddress& a1, const NetworkAddress& a2);
|
||||||
|
|
||||||
static bool isSame(const NetworkAddress& a1, const NetworkAddress& a2);
|
static bool isSame(const NetworkAddress& a1, const NetworkAddress& a2);
|
||||||
|
|
||||||
|
NetworkAddress& operator = (const NetworkAddress& src);
|
||||||
|
|
||||||
bool operator == (const NetworkAddress& rhs) const;
|
bool operator == (const NetworkAddress& rhs) const;
|
||||||
bool operator != (const NetworkAddress& rhs) const;
|
bool operator != (const NetworkAddress& rhs) const;
|
||||||
bool operator < (const NetworkAddress& rhs) const;
|
bool operator < (const NetworkAddress& rhs) const;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue