Skip to content

Commit

Permalink
Rename QUIC Transport Parameters
Browse files Browse the repository at this point in the history
ORIGINAL_CONNECTION_ID -> ORIGINAL_DESTINATION_CONNECTION_ID
MAX_PACKET_SIZE -> MAX_UDP_PAYLOAD_SIZE
  • Loading branch information
maskit committed Jul 14, 2020
1 parent 9ef2167 commit 2717ecc
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
8 changes: 4 additions & 4 deletions iocore/net/quic/QUICDebugNames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ QUICDebugNames::transport_parameter_id(QUICTransportParameterId id)
return "MAX_IDLE_TIMEOUT";
case QUICTransportParameterId::PREFERRED_ADDRESS:
return "PREFERRED_ADDRESS";
case QUICTransportParameterId::MAX_PACKET_SIZE:
return "MAX_PACKET_SIZE";
case QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE:
return "MAX_UDP_PAYLOAD_SIZE";
case QUICTransportParameterId::STATELESS_RESET_TOKEN:
return "STATELESS_RESET_TOKEN";
case QUICTransportParameterId::ACK_DELAY_EXPONENT:
Expand All @@ -205,8 +205,8 @@ QUICDebugNames::transport_parameter_id(QUICTransportParameterId id)
return "INITIAL_MAX_STREAM_DATA_UNI";
case QUICTransportParameterId::MAX_ACK_DELAY:
return "INITIAL_MAX_ACK_DELAY";
case QUICTransportParameterId::ORIGINAL_CONNECTION_ID:
return "INITIAL_ORIGINAL_CONNECTION_ID";
case QUICTransportParameterId::ORIGINAL_DESTINATION_CONNECTION_ID:
return "INITIAL_ORIGINAL_DESTINATION_CONNECTION_ID";
case QUICTransportParameterId::ACTIVE_CONNECTION_ID_LIMIT:
return "ACTIVE_CONNECTION_ID_LIMIT";
default:
Expand Down
2 changes: 1 addition & 1 deletion iocore/net/quic/QUICHandshake.cc
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ QUICHandshake::_load_local_server_transport_parameters(const QUICTPConfig &tp_co
// MUSTs
tp->set(QUICTransportParameterId::MAX_IDLE_TIMEOUT, static_cast<uint16_t>(tp_config.no_activity_timeout()));
if (this->_stateless_retry) {
tp->set(QUICTransportParameterId::ORIGINAL_CONNECTION_ID, this->_qc->first_connection_id(),
tp->set(QUICTransportParameterId::ORIGINAL_DESTINATION_CONNECTION_ID, this->_qc->first_connection_id(),
this->_qc->first_connection_id().length());
}

Expand Down
8 changes: 4 additions & 4 deletions iocore/net/quic/QUICTransportParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ QUICTransportParameters::_validate_parameters() const
if ((ite = this->_parameters.find(QUICTransportParameterId::MAX_IDLE_TIMEOUT)) != this->_parameters.end()) {
}

if ((ite = this->_parameters.find(QUICTransportParameterId::MAX_PACKET_SIZE)) != this->_parameters.end()) {
if ((ite = this->_parameters.find(QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE)) != this->_parameters.end()) {
if (QUICIntUtil::read_nbytes_as_uint(ite->second->data(), ite->second->len()) < 1200) {
return -(TP_ERROR_VALUE | QUICTransportParameterId::MAX_PACKET_SIZE);
return -(TP_ERROR_VALUE | QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE);
}
}

Expand Down Expand Up @@ -372,11 +372,11 @@ QUICTransportParametersInEncryptedExtensions::_validate_parameters() const
decltype(this->_parameters)::const_iterator ite;

// MUSTs if the server sent a Retry packet
if ((ite = this->_parameters.find(QUICTransportParameterId::ORIGINAL_CONNECTION_ID)) != this->_parameters.end()) {
if ((ite = this->_parameters.find(QUICTransportParameterId::ORIGINAL_DESTINATION_CONNECTION_ID)) != this->_parameters.end()) {
// We cannot check the length because it's not a fixed length.
} else {
// TODO Need a way that checks if we received a Retry from the server
// return -(TP_ERROR_MUST_EXIST | QUICTransportParameterId::ORIGINAL_CONNECTION_ID);
// return -(TP_ERROR_MUST_EXIST | QUICTransportParameterId::ORIGINAL_DESTINATION_CONNECTION_ID);
}

// MAYs
Expand Down
4 changes: 2 additions & 2 deletions iocore/net/quic/QUICTransportParameters.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ class QUICTransportParameterId
{
public:
enum {
ORIGINAL_CONNECTION_ID,
ORIGINAL_DESTINATION_CONNECTION_ID,
MAX_IDLE_TIMEOUT,
STATELESS_RESET_TOKEN,
MAX_PACKET_SIZE,
MAX_UDP_PAYLOAD_SIZE,
INITIAL_MAX_DATA,
INITIAL_MAX_STREAM_DATA_BIDI_LOCAL,
INITIAL_MAX_STREAM_DATA_BIDI_REMOTE,
Expand Down
10 changes: 5 additions & 5 deletions iocore/net/quic/test/test_QUICTransportParameters.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ TEST_CASE("QUICTransportParametersInClientHello_read", "[quic]")
uint16_t len = 0;
const uint8_t *data = nullptr;

data = params_in_ch.getAsBytes(QUICTransportParameterId::ORIGINAL_CONNECTION_ID, len);
data = params_in_ch.getAsBytes(QUICTransportParameterId::ORIGINAL_DESTINATION_CONNECTION_ID, len);
CHECK(len == 4);
CHECK(memcmp(data, "\x11\x22\x33\x44", 4) == 0);

Expand All @@ -62,7 +62,7 @@ TEST_CASE("QUICTransportParametersInClientHello_read", "[quic]")
CHECK(len == 2);
CHECK(memcmp(data, "\x0a\x0b", 2) == 0);

data = params_in_ch.getAsBytes(QUICTransportParameterId::MAX_PACKET_SIZE, len);
data = params_in_ch.getAsBytes(QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE, len);
CHECK(len == 2);
CHECK(memcmp(data, "\x05\x67", 2) == 0);

Expand Down Expand Up @@ -111,7 +111,7 @@ TEST_CASE("QUICTransportParametersInClientHello_write", "[quic]")
params_in_ch.set(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA_BIDI_LOCAL, max_stream_data);

uint16_t max_packet_size = 0x1bcd;
params_in_ch.set(QUICTransportParameterId::MAX_PACKET_SIZE, max_packet_size);
params_in_ch.set(QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE, max_packet_size);

uint8_t stateless_reset_token[16] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77};
Expand Down Expand Up @@ -242,7 +242,7 @@ TEST_CASE("QUICTransportParametersEncryptedExtensions_write", "[quic]")
params_in_ee.set(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA_BIDI_REMOTE, max_stream_data);

uint16_t max_packet_size = 0x1bcd;
params_in_ee.set(QUICTransportParameterId::MAX_PACKET_SIZE, max_packet_size);
params_in_ee.set(QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE, max_packet_size);

params_in_ee.add_version(0x01020304);
params_in_ee.add_version(0x05060708);
Expand Down Expand Up @@ -273,7 +273,7 @@ TEST_CASE("QUICTransportParametersEncryptedExtensions_write", "[quic]")
params_in_ee.set(QUICTransportParameterId::INITIAL_MAX_STREAM_DATA_BIDI_REMOTE, max_stream_data);

uint16_t max_packet_size = 0x1bcd;
params_in_ee.set(QUICTransportParameterId::MAX_PACKET_SIZE, max_packet_size);
params_in_ee.set(QUICTransportParameterId::MAX_UDP_PAYLOAD_SIZE, max_packet_size);
params_in_ee.set(QUICTransportParameterId::DISABLE_ACTIVE_MIGRATION, nullptr, 0);

params_in_ee.add_version(0x01020304);
Expand Down

0 comments on commit 2717ecc

Please sign in to comment.