Update STUN attributes with latest IANA registrations
https://www.iana.org/assignments/stun-parameters/stun-parameters.xhtml Bug: webrtc:0 Change-Id: Id3addf432abdfe0b5c236dc5b080e64744c18114 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/184341 Reviewed-by: Harald Alvestrand <hta@webrtc.org> Commit-Queue: Jonas Oreland <jonaso@webrtc.org> Cr-Commit-Position: refs/heads/master@{#32113}
This commit is contained in:
parent
08574aeb44
commit
fa54364cea
@ -555,7 +555,7 @@ StunAttributeValueType StunMessage::GetAttributeValueType(int type) const {
|
||||
return STUN_VALUE_BYTE_STRING;
|
||||
case STUN_ATTR_RETRANSMIT_COUNT:
|
||||
return STUN_VALUE_UINT32;
|
||||
case STUN_ATTR_LAST_ICE_CHECK_RECEIVED:
|
||||
case STUN_ATTR_GOOG_LAST_ICE_CHECK_RECEIVED:
|
||||
return STUN_VALUE_BYTE_STRING;
|
||||
case STUN_ATTR_GOOG_MISC_INFO:
|
||||
return STUN_VALUE_UINT16_LIST;
|
||||
@ -1309,7 +1309,7 @@ StunMessage* TurnMessage::CreateNew() const {
|
||||
StunAttributeValueType IceMessage::GetAttributeValueType(int type) const {
|
||||
switch (type) {
|
||||
case STUN_ATTR_PRIORITY:
|
||||
case STUN_ATTR_NETWORK_INFO:
|
||||
case STUN_ATTR_GOOG_NETWORK_INFO:
|
||||
case STUN_ATTR_NOMINATION:
|
||||
return STUN_VALUE_UINT32;
|
||||
case STUN_ATTR_USE_CANDIDATE:
|
||||
|
||||
@ -667,11 +667,16 @@ enum IceAttributeType {
|
||||
STUN_ATTR_NOMINATION = 0xC001, // UInt32
|
||||
// UInt32. The higher 16 bits are the network ID. The lower 16 bits are the
|
||||
// network cost.
|
||||
STUN_ATTR_NETWORK_INFO = 0xC057,
|
||||
STUN_ATTR_GOOG_NETWORK_INFO = 0xC057,
|
||||
// Experimental: Transaction ID of the last connectivity check received.
|
||||
STUN_ATTR_LAST_ICE_CHECK_RECEIVED = 0xC058,
|
||||
STUN_ATTR_GOOG_LAST_ICE_CHECK_RECEIVED = 0xC058,
|
||||
// Uint16List. Miscellaneous attributes for future extension.
|
||||
STUN_ATTR_GOOG_MISC_INFO = 0xC059,
|
||||
// Obsolete.
|
||||
STUN_ATTR_GOOG_OBSOLETE_1 = 0xC05A,
|
||||
STUN_ATTR_GOOG_CONNECTION_ID = 0xC05B, // Not yet implemented.
|
||||
STUN_ATTR_GOOG_DELTA = 0xC05C, // Not yet implemented.
|
||||
STUN_ATTR_GOOG_DELTA_ACK = 0xC05D, // Not yet implemented.
|
||||
// MESSAGE-INTEGRITY truncated to 32-bit.
|
||||
STUN_ATTR_GOOG_MESSAGE_INTEGRITY_32 = 0xC060,
|
||||
};
|
||||
|
||||
@ -187,13 +187,13 @@ void ConnectionRequest::Prepare(StunMessage* request) {
|
||||
uint32_t network_info = connection_->port()->Network()->id();
|
||||
network_info = (network_info << 16) | connection_->port()->network_cost();
|
||||
request->AddAttribute(std::make_unique<StunUInt32Attribute>(
|
||||
STUN_ATTR_NETWORK_INFO, network_info));
|
||||
STUN_ATTR_GOOG_NETWORK_INFO, network_info));
|
||||
|
||||
if (webrtc::field_trial::IsEnabled(
|
||||
"WebRTC-PiggybackIceCheckAcknowledgement") &&
|
||||
connection_->last_ping_id_received()) {
|
||||
request->AddAttribute(std::make_unique<StunByteStringAttribute>(
|
||||
STUN_ATTR_LAST_ICE_CHECK_RECEIVED,
|
||||
STUN_ATTR_GOOG_LAST_ICE_CHECK_RECEIVED,
|
||||
connection_->last_ping_id_received().value()));
|
||||
}
|
||||
|
||||
@ -616,7 +616,7 @@ void Connection::HandleStunBindingOrGoogPingRequest(IceMessage* msg) {
|
||||
// Note: If packets are re-ordered, we may get incorrect network cost
|
||||
// temporarily, but it should get the correct value shortly after that.
|
||||
const StunUInt32Attribute* network_attr =
|
||||
msg->GetUInt32(STUN_ATTR_NETWORK_INFO);
|
||||
msg->GetUInt32(STUN_ATTR_GOOG_NETWORK_INFO);
|
||||
if (network_attr) {
|
||||
uint32_t network_info = network_attr->value();
|
||||
uint16_t network_cost = static_cast<uint16_t>(network_info);
|
||||
@ -868,7 +868,7 @@ void Connection::HandlePiggybackCheckAcknowledgementIfAny(StunMessage* msg) {
|
||||
RTC_DCHECK(msg->type() == STUN_BINDING_REQUEST ||
|
||||
msg->type() == GOOG_PING_REQUEST);
|
||||
const StunByteStringAttribute* last_ice_check_received_attr =
|
||||
msg->GetByteString(STUN_ATTR_LAST_ICE_CHECK_RECEIVED);
|
||||
msg->GetByteString(STUN_ATTR_GOOG_LAST_ICE_CHECK_RECEIVED);
|
||||
if (last_ice_check_received_attr) {
|
||||
const std::string request_id = last_ice_check_received_attr->GetString();
|
||||
auto iter = absl::c_find_if(
|
||||
|
||||
@ -1016,7 +1016,7 @@ void P2PTransportChannel::OnUnknownAddress(PortInterface* port,
|
||||
uint16_t network_id = 0;
|
||||
uint16_t network_cost = 0;
|
||||
const StunUInt32Attribute* network_attr =
|
||||
stun_msg->GetUInt32(STUN_ATTR_NETWORK_INFO);
|
||||
stun_msg->GetUInt32(STUN_ATTR_GOOG_NETWORK_INFO);
|
||||
if (network_attr) {
|
||||
uint32_t network_info = network_attr->value();
|
||||
network_id = static_cast<uint16_t>(network_info >> 16);
|
||||
|
||||
@ -3202,7 +3202,7 @@ class P2PTransportChannelPingTest : public ::testing::Test,
|
||||
}
|
||||
if (piggyback_ping_id) {
|
||||
msg.AddAttribute(std::make_unique<StunByteStringAttribute>(
|
||||
STUN_ATTR_LAST_ICE_CHECK_RECEIVED, piggyback_ping_id.value()));
|
||||
STUN_ATTR_GOOG_LAST_ICE_CHECK_RECEIVED, piggyback_ping_id.value()));
|
||||
}
|
||||
msg.SetTransactionID(rtc::CreateRandomString(kStunTransactionIdLength));
|
||||
msg.AddMessageIntegrity(conn->local_candidate().password());
|
||||
|
||||
@ -2052,7 +2052,7 @@ TEST_F(PortTest, TestNetworkInfoAttribute) {
|
||||
ASSERT_TRUE_WAIT(lport->last_stun_msg() != NULL, kDefaultTimeout);
|
||||
IceMessage* msg = lport->last_stun_msg();
|
||||
const StunUInt32Attribute* network_info_attr =
|
||||
msg->GetUInt32(STUN_ATTR_NETWORK_INFO);
|
||||
msg->GetUInt32(STUN_ATTR_GOOG_NETWORK_INFO);
|
||||
ASSERT_TRUE(network_info_attr != NULL);
|
||||
uint32_t network_info = network_info_attr->value();
|
||||
EXPECT_EQ(lnetwork_id, network_info >> 16);
|
||||
@ -2069,7 +2069,7 @@ TEST_F(PortTest, TestNetworkInfoAttribute) {
|
||||
rconn->Ping(0);
|
||||
ASSERT_TRUE_WAIT(rport->last_stun_msg() != NULL, kDefaultTimeout);
|
||||
msg = rport->last_stun_msg();
|
||||
network_info_attr = msg->GetUInt32(STUN_ATTR_NETWORK_INFO);
|
||||
network_info_attr = msg->GetUInt32(STUN_ATTR_GOOG_NETWORK_INFO);
|
||||
ASSERT_TRUE(network_info_attr != NULL);
|
||||
network_info = network_info_attr->value();
|
||||
EXPECT_EQ(rnetwork_id, network_info >> 16);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user