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}
diff --git a/api/transport/stun.cc b/api/transport/stun.cc
index b083f15..7fee6ea 100644
--- a/api/transport/stun.cc
+++ b/api/transport/stun.cc
@@ -555,7 +555,7 @@
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 @@
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:
diff --git a/api/transport/stun.h b/api/transport/stun.h
index 51ca306..db37b8e 100644
--- a/api/transport/stun.h
+++ b/api/transport/stun.h
@@ -667,11 +667,16 @@
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,
};
diff --git a/p2p/base/connection.cc b/p2p/base/connection.cc
index 0863865..fe60421 100644
--- a/p2p/base/connection.cc
+++ b/p2p/base/connection.cc
@@ -187,13 +187,13 @@
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 @@
// 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 @@
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(
diff --git a/p2p/base/p2p_transport_channel.cc b/p2p/base/p2p_transport_channel.cc
index 6350df5..9bf0b23 100644
--- a/p2p/base/p2p_transport_channel.cc
+++ b/p2p/base/p2p_transport_channel.cc
@@ -1016,7 +1016,7 @@
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);
diff --git a/p2p/base/p2p_transport_channel_unittest.cc b/p2p/base/p2p_transport_channel_unittest.cc
index 84619ef..0e3a009 100644
--- a/p2p/base/p2p_transport_channel_unittest.cc
+++ b/p2p/base/p2p_transport_channel_unittest.cc
@@ -3202,7 +3202,7 @@
}
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());
diff --git a/p2p/base/port_unittest.cc b/p2p/base/port_unittest.cc
index 7703a9c..2cab407 100644
--- a/p2p/base/port_unittest.cc
+++ b/p2p/base/port_unittest.cc
@@ -2052,7 +2052,7 @@
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 @@
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);