const-ify quic/http3 code (#7084)
diff --git a/iocore/net/quic/QUICAckFrameCreator.cc b/iocore/net/quic/QUICAckFrameCreator.cc
index 6b27e34..dd2e2f9 100644
--- a/iocore/net/quic/QUICAckFrameCreator.cc
+++ b/iocore/net/quic/QUICAckFrameCreator.cc
@@ -209,7 +209,7 @@
}
size_t
-QUICAckFrameManager::QUICAckFrameCreator::size()
+QUICAckFrameManager::QUICAckFrameCreator::size() const
{
return this->_packet_numbers.size();
}
@@ -227,13 +227,13 @@
}
QUICPacketNumber
-QUICAckFrameManager::QUICAckFrameCreator::largest_ack_number()
+QUICAckFrameManager::QUICAckFrameCreator::largest_ack_number() const
{
return this->_largest_ack_number;
}
ink_hrtime
-QUICAckFrameManager::QUICAckFrameCreator::largest_ack_received_time()
+QUICAckFrameManager::QUICAckFrameCreator::largest_ack_received_time() const
{
return this->_largest_ack_received_time;
}
diff --git a/iocore/net/quic/QUICAckFrameCreator.h b/iocore/net/quic/QUICAckFrameCreator.h
index 541f098..4fc89ba 100644
--- a/iocore/net/quic/QUICAckFrameCreator.h
+++ b/iocore/net/quic/QUICAckFrameCreator.h
@@ -44,7 +44,7 @@
~QUICAckFrameCreator();
void push_back(QUICPacketNumber packet_number, size_t size, bool ack_only);
- size_t size();
+ size_t size() const;
void clear();
void sort();
void forget(QUICPacketNumber largest_acknowledged);
@@ -58,8 +58,8 @@
// refresh state when frame lost
void refresh_state();
- QUICPacketNumber largest_ack_number();
- ink_hrtime largest_ack_received_time();
+ QUICPacketNumber largest_ack_number() const;
+ ink_hrtime largest_ack_received_time() const;
private:
uint64_t _calculate_delay();
diff --git a/iocore/net/quic/QUICApplication.cc b/iocore/net/quic/QUICApplication.cc
index 54ad68e..a5bfd26 100644
--- a/iocore/net/quic/QUICApplication.cc
+++ b/iocore/net/quic/QUICApplication.cc
@@ -115,7 +115,7 @@
}
bool
-QUICStreamIO::is_read_done()
+QUICStreamIO::is_read_done() const
{
return this->_read_vio->ntodo() == 0;
}
diff --git a/iocore/net/quic/QUICApplication.h b/iocore/net/quic/QUICApplication.h
index dd6d524..c4fb16f 100644
--- a/iocore/net/quic/QUICApplication.h
+++ b/iocore/net/quic/QUICApplication.h
@@ -46,7 +46,7 @@
int64_t read(uint8_t *buf, int64_t len);
int64_t peek(uint8_t *buf, int64_t len);
void consume(int64_t len);
- bool is_read_done();
+ bool is_read_done() const;
virtual void read_reenable();
int64_t write(const uint8_t *buf, int64_t len);
diff --git a/iocore/net/quic/QUICFlowController.cc b/iocore/net/quic/QUICFlowController.cc
index e5b7905..c818306 100644
--- a/iocore/net/quic/QUICFlowController.cc
+++ b/iocore/net/quic/QUICFlowController.cc
@@ -37,7 +37,7 @@
}
uint64_t
-QUICRateAnalyzer::expect_recv_bytes(ink_hrtime time)
+QUICRateAnalyzer::expect_recv_bytes(ink_hrtime time) const
{
return static_cast<uint64_t>(time * this->_rate);
}
diff --git a/iocore/net/quic/QUICFlowController.h b/iocore/net/quic/QUICFlowController.h
index 62adf9f..3ff1838 100644
--- a/iocore/net/quic/QUICFlowController.h
+++ b/iocore/net/quic/QUICFlowController.h
@@ -33,7 +33,7 @@
{
public:
void update(QUICOffset offset);
- uint64_t expect_recv_bytes(ink_hrtime time);
+ uint64_t expect_recv_bytes(ink_hrtime time) const;
private:
double _rate = 0.0;
diff --git a/iocore/net/quic/QUICFrame.cc b/iocore/net/quic/QUICFrame.cc
index 6fb5cfd..7af9a7a 100644
--- a/iocore/net/quic/QUICFrame.cc
+++ b/iocore/net/quic/QUICFrame.cc
@@ -895,7 +895,7 @@
}
void
-QUICAckFrame::AckBlockSection::add_ack_block(AckBlock block)
+QUICAckFrame::AckBlockSection::add_ack_block(const AckBlock &block)
{
this->_ack_blocks.push_back(block);
}
@@ -2960,7 +2960,8 @@
}
QUICConnectionCloseFrame *
-QUICFrameFactory::create_connection_close_frame(uint8_t *buf, QUICConnectionError &error, QUICFrameId id, QUICFrameGenerator *owner)
+QUICFrameFactory::create_connection_close_frame(uint8_t *buf, const QUICConnectionError &error, QUICFrameId id,
+ QUICFrameGenerator *owner)
{
ink_assert(error.cls == QUICErrorClass::TRANSPORT);
if (error.msg) {
diff --git a/iocore/net/quic/QUICFrame.h b/iocore/net/quic/QUICFrame.h
index 730453a..14b87d3 100644
--- a/iocore/net/quic/QUICFrame.h
+++ b/iocore/net/quic/QUICFrame.h
@@ -236,7 +236,7 @@
size_t size() const;
Ptr<IOBufferBlock> to_io_buffer_block(size_t limit) const;
uint64_t first_ack_block() const;
- void add_ack_block(const AckBlock block);
+ void add_ack_block(const AckBlock &block);
const_iterator begin() const;
const_iterator end() const;
bool has_protected() const;
@@ -802,7 +802,7 @@
const char *reason_phrase = nullptr, QUICFrameId id = 0,
QUICFrameGenerator *owner = nullptr);
- static QUICConnectionCloseFrame *create_connection_close_frame(uint8_t *buf, QUICConnectionError &error, QUICFrameId id = 0,
+ static QUICConnectionCloseFrame *create_connection_close_frame(uint8_t *buf, const QUICConnectionError &error, QUICFrameId id = 0,
QUICFrameGenerator *owner = nullptr);
/*
diff --git a/iocore/net/quic/QUICFrameRetransmitter.h b/iocore/net/quic/QUICFrameRetransmitter.h
index 9f45dd5..64f1f95 100644
--- a/iocore/net/quic/QUICFrameRetransmitter.h
+++ b/iocore/net/quic/QUICFrameRetransmitter.h
@@ -36,7 +36,7 @@
};
struct QUICFrameInformationDeleter {
- void operator()(QUICFrameInformation *p);
+ void operator()(QUICFrameInformation *p) const;
};
using QUICFrameInformationUPtr = std::unique_ptr<QUICFrameInformation, QUICFrameInformationDeleter>;
@@ -90,7 +90,7 @@
extern ClassAllocator<QUICFrameInformation> quicFrameInformationAllocator;
inline void
-QUICFrameInformationDeleter::operator()(QUICFrameInformation *p)
+QUICFrameInformationDeleter::operator()(QUICFrameInformation *p) const
{
quicFrameInformationAllocator.free(p);
}
diff --git a/iocore/net/quic/QUICHandshake.cc b/iocore/net/quic/QUICHandshake.cc
index 5137667..c1a530f 100644
--- a/iocore/net/quic/QUICHandshake.cc
+++ b/iocore/net/quic/QUICHandshake.cc
@@ -207,20 +207,20 @@
}
QUICVersion
-QUICHandshake::negotiated_version()
+QUICHandshake::negotiated_version() const
{
return this->_version_negotiator->negotiated_version();
}
// Similar to SSLNetVConnection::getSSLCipherSuite()
const char *
-QUICHandshake::negotiated_cipher_suite()
+QUICHandshake::negotiated_cipher_suite() const
{
return this->_hs_protocol->negotiated_cipher_suite();
}
void
-QUICHandshake::negotiated_application_name(const uint8_t **name, unsigned int *len)
+QUICHandshake::negotiated_application_name(const uint8_t **name, unsigned int *len) const
{
this->_hs_protocol->negotiated_application_name(name, len);
}
diff --git a/iocore/net/quic/QUICHandshake.h b/iocore/net/quic/QUICHandshake.h
index 5af42d8..017c96d 100644
--- a/iocore/net/quic/QUICHandshake.h
+++ b/iocore/net/quic/QUICHandshake.h
@@ -70,9 +70,9 @@
bool check_remote_transport_parameters();
// Getters
- QUICVersion negotiated_version();
- const char *negotiated_cipher_suite();
- void negotiated_application_name(const uint8_t **name, unsigned int *len);
+ QUICVersion negotiated_version() const;
+ const char *negotiated_cipher_suite() const;
+ void negotiated_application_name(const uint8_t **name, unsigned int *len) const;
std::shared_ptr<const QUICTransportParameters> local_transport_parameters();
std::shared_ptr<const QUICTransportParameters> remote_transport_parameters();
diff --git a/iocore/net/quic/QUICLossDetector.cc b/iocore/net/quic/QUICLossDetector.cc
index ad3dbfe..3d381b2 100644
--- a/iocore/net/quic/QUICLossDetector.cc
+++ b/iocore/net/quic/QUICLossDetector.cc
@@ -118,7 +118,7 @@
}
QUICPacketNumber
-QUICLossDetector::largest_acked_packet_number(QUICPacketNumberSpace pn_space)
+QUICLossDetector::largest_acked_packet_number(QUICPacketNumberSpace pn_space) const
{
int index = static_cast<int>(pn_space);
return this->_largest_acked_packet[index];
@@ -522,12 +522,12 @@
// ===== Functions below are helper functions =====
void
-QUICLossDetector::_retransmit_lost_packet(QUICPacketInfo &packet_info)
+QUICLossDetector::_retransmit_lost_packet(const QUICPacketInfo &packet_info)
{
SCOPED_MUTEX_LOCK(lock, this->_loss_detection_mutex, this_ethread());
QUICLDDebug("Retransmit %s packet #%" PRIu64, QUICDebugNames::packet_type(packet_info.type), packet_info.packet_number);
- for (QUICFrameInfo &frame_info : packet_info.frames) {
+ for (const QUICFrameInfo &frame_info : packet_info.frames) {
auto reactor = frame_info.generated_by();
if (reactor == nullptr) {
continue;
diff --git a/iocore/net/quic/QUICLossDetector.h b/iocore/net/quic/QUICLossDetector.h
index 9546a5e..891556e 100644
--- a/iocore/net/quic/QUICLossDetector.h
+++ b/iocore/net/quic/QUICLossDetector.h
@@ -103,7 +103,7 @@
ink_hrtime _congestion_recovery_start_time = 0;
uint32_t _ssthresh = UINT32_MAX;
- bool _in_congestion_recovery(ink_hrtime sent_time);
+ bool _in_congestion_recovery(ink_hrtime sent_time) const;
QUICContext &_context;
};
@@ -120,7 +120,7 @@
std::vector<QUICFrameType> interests() override;
virtual QUICConnectionErrorUPtr handle_frame(QUICEncryptionLevel level, const QUICFrame &frame) override;
void on_packet_sent(QUICPacketInfoUPtr packet_info, bool in_flight = true);
- QUICPacketNumber largest_acked_packet_number(QUICPacketNumberSpace pn_space);
+ QUICPacketNumber largest_acked_packet_number(QUICPacketNumberSpace pn_space) const;
void update_ack_delay_exponent(uint8_t ack_delay_exponent);
void reset();
@@ -164,7 +164,7 @@
void _detect_lost_packets(QUICPacketNumberSpace pn_space);
void _set_loss_detection_timer();
void _on_loss_detection_timeout();
- void _retransmit_lost_packet(QUICPacketInfo &packet_info);
+ void _retransmit_lost_packet(const QUICPacketInfo &packet_info);
ink_hrtime _get_earliest_loss_time(QUICPacketNumberSpace &pn_space);
diff --git a/iocore/net/quic/QUICNewRenoCongestionController.cc b/iocore/net/quic/QUICNewRenoCongestionController.cc
index a874c62..2658443 100644
--- a/iocore/net/quic/QUICNewRenoCongestionController.cc
+++ b/iocore/net/quic/QUICNewRenoCongestionController.cc
@@ -63,7 +63,7 @@
}
bool
-QUICNewRenoCongestionController::_in_congestion_recovery(ink_hrtime sent_time)
+QUICNewRenoCongestionController::_in_congestion_recovery(ink_hrtime sent_time) const
{
return sent_time <= this->_congestion_recovery_start_time;
}
diff --git a/iocore/net/quic/QUICPacket.cc b/iocore/net/quic/QUICPacket.cc
index 8026e4f..0bcf624 100644
--- a/iocore/net/quic/QUICPacket.cc
+++ b/iocore/net/quic/QUICPacket.cc
@@ -333,8 +333,8 @@
//
// QUICLongHeaderPacket
//
-QUICLongHeaderPacket::QUICLongHeaderPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, bool ack_eliciting,
- bool probing, bool crypto)
+QUICLongHeaderPacket::QUICLongHeaderPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid,
+ bool ack_eliciting, bool probing, bool crypto)
: QUICPacket(ack_eliciting, probing), _version(version), _dcid(dcid), _scid(scid), _is_crypto_packet(crypto)
{
}
@@ -567,7 +567,7 @@
//
// QUICShortHeaderPacket
//
-QUICShortHeaderPacket::QUICShortHeaderPacket(QUICConnectionId dcid, QUICPacketNumber packet_number,
+QUICShortHeaderPacket::QUICShortHeaderPacket(const QUICConnectionId &dcid, QUICPacketNumber packet_number,
QUICPacketNumber base_packet_number, QUICKeyPhase key_phase, bool ack_eliciting,
bool probing)
: QUICPacket(ack_eliciting, probing), _dcid(dcid), _packet_number(packet_number), _key_phase(key_phase)
@@ -1072,9 +1072,9 @@
//
// QUICInitialPacket
//
-QUICInitialPacket::QUICInitialPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, size_t token_len,
- ats_unique_buf token, size_t length, QUICPacketNumber packet_number, bool ack_eliciting,
- bool probing, bool crypto)
+QUICInitialPacket::QUICInitialPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid,
+ size_t token_len, ats_unique_buf token, size_t length, QUICPacketNumber packet_number,
+ bool ack_eliciting, bool probing, bool crypto)
: QUICLongHeaderPacket(version, dcid, scid, ack_eliciting, probing, crypto),
_token_len(token_len),
_token(std::move(token)),
@@ -1310,7 +1310,7 @@
//
// QUICZeroRttPacket
//
-QUICZeroRttPacket::QUICZeroRttPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, size_t length,
+QUICZeroRttPacket::QUICZeroRttPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid, size_t length,
QUICPacketNumber packet_number, bool ack_eliciting, bool probing)
: QUICLongHeaderPacket(version, dcid, scid, ack_eliciting, probing, false), _packet_number(packet_number)
{
@@ -1489,8 +1489,9 @@
//
// QUICHandshakePacket
//
-QUICHandshakePacket::QUICHandshakePacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, size_t length,
- QUICPacketNumber packet_number, bool ack_eliciting, bool probing, bool crypto)
+QUICHandshakePacket::QUICHandshakePacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid,
+ size_t length, QUICPacketNumber packet_number, bool ack_eliciting, bool probing,
+ bool crypto)
: QUICLongHeaderPacket(version, dcid, scid, ack_eliciting, probing, crypto), _packet_number(packet_number)
{
}
@@ -1668,7 +1669,8 @@
//
// QUICRetryPacket
//
-QUICRetryPacket::QUICRetryPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, QUICRetryToken &token)
+QUICRetryPacket::QUICRetryPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid,
+ QUICRetryToken &token)
: QUICLongHeaderPacket(version, dcid, scid, false, false, false), _token(token)
{
}
@@ -1833,7 +1835,7 @@
}
bool
-QUICRetryPacketR::has_valid_tag(QUICConnectionId &odcid) const
+QUICRetryPacketR::has_valid_tag(const QUICConnectionId &odcid) const
{
uint8_t tag_computed[QUICRetryIntegrityTag::LEN];
QUICRetryIntegrityTag::compute(tag_computed, odcid, this->_header_block, this->_payload_block_without_tag);
diff --git a/iocore/net/quic/QUICPacket.h b/iocore/net/quic/QUICPacket.h
index 9d20b23..a62daa4 100644
--- a/iocore/net/quic/QUICPacket.h
+++ b/iocore/net/quic/QUICPacket.h
@@ -168,8 +168,8 @@
/**
* For sending packet
*/
- QUICLongHeaderPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, bool ack_eliciting, bool probing,
- bool crypto);
+ QUICLongHeaderPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid, bool ack_eliciting,
+ bool probing, bool crypto);
QUICConnectionId source_cid() const;
@@ -226,7 +226,7 @@
/**
* For sending packet
*/
- QUICShortHeaderPacket(QUICConnectionId dcid, QUICPacketNumber packet_number, QUICPacketNumber base_packet_number,
+ QUICShortHeaderPacket(const QUICConnectionId &dcid, QUICPacketNumber packet_number, QUICPacketNumber base_packet_number,
QUICKeyPhase key_phase, bool ack_eliciting, bool probing);
QUICPacketType type() const override;
@@ -367,8 +367,9 @@
/**
* For sending packet
*/
- QUICInitialPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, size_t token_len, ats_unique_buf token,
- size_t length, QUICPacketNumber packet_number, bool ack_eliciting, bool probing, bool crypto);
+ QUICInitialPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid, size_t token_len,
+ ats_unique_buf token, size_t length, QUICPacketNumber packet_number, bool ack_eliciting, bool probing,
+ bool crypto);
QUICPacketType type() const override;
QUICPacketNumber packet_number() const override;
@@ -423,7 +424,7 @@
/**
* For sending packet
*/
- QUICZeroRttPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, size_t length,
+ QUICZeroRttPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid, size_t length,
QUICPacketNumber packet_number, bool ack_eliciting, bool probing);
QUICPacketType type() const override;
@@ -465,7 +466,7 @@
/**
* For sending packet
*/
- QUICHandshakePacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, size_t length,
+ QUICHandshakePacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid, size_t length,
QUICPacketNumber packet_number, bool ack_eliciting, bool probing, bool crypto);
QUICPacketType type() const override;
@@ -507,7 +508,7 @@
/**
* For sending packet
*/
- QUICRetryPacket(QUICVersion version, QUICConnectionId dcid, QUICConnectionId scid, QUICRetryToken &token);
+ QUICRetryPacket(QUICVersion version, const QUICConnectionId &dcid, const QUICConnectionId &scid, QUICRetryToken &token);
QUICPacketType type() const override;
QUICPacketNumber packet_number() const override;
@@ -541,7 +542,7 @@
QUICPacketNumber packet_number() const override;
const QUICAddressValidationToken &token() const;
- bool has_valid_tag(QUICConnectionId &odcid) const;
+ bool has_valid_tag(const QUICConnectionId &odcid) const;
private:
QUICAddressValidationToken *_token = nullptr;
diff --git a/iocore/net/quic/QUICPacketReceiveQueue.cc b/iocore/net/quic/QUICPacketReceiveQueue.cc
index f197790..a2aee1b 100644
--- a/iocore/net/quic/QUICPacketReceiveQueue.cc
+++ b/iocore/net/quic/QUICPacketReceiveQueue.cc
@@ -186,7 +186,7 @@
}
uint32_t
-QUICPacketReceiveQueue::size()
+QUICPacketReceiveQueue::size() const
{
return this->_queue.size;
}
diff --git a/iocore/net/quic/QUICPacketReceiveQueue.h b/iocore/net/quic/QUICPacketReceiveQueue.h
index 78e5b00..3ebded3 100644
--- a/iocore/net/quic/QUICPacketReceiveQueue.h
+++ b/iocore/net/quic/QUICPacketReceiveQueue.h
@@ -38,7 +38,7 @@
void enqueue(UDPPacket *packet);
QUICPacketUPtr dequeue(uint8_t *packet_buf, QUICPacketCreationResult &result);
- uint32_t size();
+ uint32_t size() const;
void reset();
private:
diff --git a/iocore/net/quic/QUICPathValidator.cc b/iocore/net/quic/QUICPathValidator.cc
index 21a97c9..e12022c 100644
--- a/iocore/net/quic/QUICPathValidator.cc
+++ b/iocore/net/quic/QUICPathValidator.cc
@@ -50,7 +50,7 @@
}
bool
-QUICPathValidator::is_validating(const QUICPath &path)
+QUICPathValidator::is_validating(const QUICPath &path) const
{
if (auto j = this->_jobs.find(path); j != this->_jobs.end()) {
return j->second.is_validating();
@@ -60,7 +60,7 @@
}
bool
-QUICPathValidator::is_validated(const QUICPath &path)
+QUICPathValidator::is_validated(const QUICPath &path) const
{
if (auto j = this->_jobs.find(path); j != this->_jobs.end()) {
return j->second.is_validated();
@@ -82,13 +82,13 @@
}
bool
-QUICPathValidator::ValidationJob::is_validating()
+QUICPathValidator::ValidationJob::is_validating() const
{
return this->_state == ValidationState::VALIDATING;
}
bool
-QUICPathValidator::ValidationJob::is_validated()
+QUICPathValidator::ValidationJob::is_validated() const
{
return this->_state == ValidationState::VALIDATED;
}
diff --git a/iocore/net/quic/QUICPathValidator.h b/iocore/net/quic/QUICPathValidator.h
index e06c64e..96f5f4f 100644
--- a/iocore/net/quic/QUICPathValidator.h
+++ b/iocore/net/quic/QUICPathValidator.h
@@ -37,8 +37,8 @@
: _cinfo(info), _on_validation_callback(callback)
{
}
- bool is_validating(const QUICPath &path);
- bool is_validated(const QUICPath &path);
+ bool is_validating(const QUICPath &path) const;
+ bool is_validated(const QUICPath &path) const;
void validate(const QUICPath &path);
// QUICFrameHandler
@@ -62,8 +62,8 @@
public:
ValidationJob(){};
~ValidationJob(){};
- bool is_validating();
- bool is_validated();
+ bool is_validating() const;
+ bool is_validated() const;
void start();
bool validate_response(const uint8_t *data);
bool has_more_challenges() const;
diff --git a/iocore/net/quic/QUICTransportParameters.h b/iocore/net/quic/QUICTransportParameters.h
index 00af57c..d3c19fe 100644
--- a/iocore/net/quic/QUICTransportParameters.h
+++ b/iocore/net/quic/QUICTransportParameters.h
@@ -59,7 +59,7 @@
}
bool
- operator==(uint16_t &x) const
+ operator==(const uint16_t &x) const
{
return this->_id == x;
}
diff --git a/iocore/net/quic/QUICVersionNegotiator.cc b/iocore/net/quic/QUICVersionNegotiator.cc
index e08504c..43d2fbf 100644
--- a/iocore/net/quic/QUICVersionNegotiator.cc
+++ b/iocore/net/quic/QUICVersionNegotiator.cc
@@ -25,7 +25,7 @@
#include "QUICTransportParameters.h"
QUICVersionNegotiationStatus
-QUICVersionNegotiator::status()
+QUICVersionNegotiator::status() const
{
return this->_status;
}
@@ -70,13 +70,13 @@
}
QUICVersionNegotiationStatus
-QUICVersionNegotiator::validate()
+QUICVersionNegotiator::validate() const
{
return this->_status;
}
QUICVersion
-QUICVersionNegotiator::negotiated_version()
+QUICVersionNegotiator::negotiated_version() const
{
return this->_negotiated_version;
}
diff --git a/iocore/net/quic/QUICVersionNegotiator.h b/iocore/net/quic/QUICVersionNegotiator.h
index 55068f0..392154e 100644
--- a/iocore/net/quic/QUICVersionNegotiator.h
+++ b/iocore/net/quic/QUICVersionNegotiator.h
@@ -34,10 +34,10 @@
class QUICVersionNegotiator
{
public:
- QUICVersionNegotiationStatus status();
+ QUICVersionNegotiationStatus status() const;
QUICVersionNegotiationStatus negotiate(const QUICPacket &initial_packet);
- QUICVersionNegotiationStatus validate();
- QUICVersion negotiated_version();
+ QUICVersionNegotiationStatus validate() const;
+ QUICVersion negotiated_version() const;
private:
QUICVersion _negotiated_version = 0;
diff --git a/iocore/net/quic/qlog/QLog.cc b/iocore/net/quic/qlog/QLog.cc
index f94fb39..71bb5fc 100644
--- a/iocore/net/quic/qlog/QLog.cc
+++ b/iocore/net/quic/qlog/QLog.cc
@@ -74,7 +74,7 @@
}
void
-QLog::dump(std::string dir)
+QLog::dump(const std::string &dir)
{
YAML::Node root;
root["qlog_version"] = this->_ver;
diff --git a/iocore/net/quic/qlog/QLog.h b/iocore/net/quic/qlog/QLog.h
index 2407d58..c40bb47 100644
--- a/iocore/net/quic/qlog/QLog.h
+++ b/iocore/net/quic/qlog/QLog.h
@@ -46,9 +46,13 @@
VantagePointType flow = VantagePointType::unknown;
};
- Trace(std::string odcid, std::string title = "", std::string desc = "") : _reference_time(Thread::get_hrtime()), _odcid(odcid) {}
+ Trace(const std::string &odcid, const std::string &title = "", const std::string &desc = "")
+ : _reference_time(Thread::get_hrtime()), _odcid(odcid)
+ {
+ }
- Trace(const VantagePoint &vp, std::string odcid, std::string title = "", std::string desc = "") : Trace(odcid, title, desc)
+ Trace(const VantagePoint &vp, const std::string &odcid, const std::string &title = "", const std::string &desc = "")
+ : Trace(odcid, title, desc)
{
set_vantage_point(vp);
}
@@ -71,7 +75,7 @@
}
void
- set_vantage_point(const VantagePoint vp)
+ set_vantage_point(const VantagePoint &vp)
{
this->_vp = vp;
}
@@ -107,10 +111,13 @@
public:
static constexpr char QLOG_VERSION[] = "draft-01";
- QLog(std::string title = "", std::string desc = "", std::string ver = QLOG_VERSION) : _title(title), _desc(desc), _ver(ver) {}
+ QLog(const std::string &title = "", const std::string &desc = "", const std::string &ver = QLOG_VERSION)
+ : _title(title), _desc(desc), _ver(ver)
+ {
+ }
Trace &
- new_trace(Trace::VantagePoint vp, std::string odcid, std::string title = "", std::string desc = "")
+ new_trace(Trace::VantagePoint vp, const std::string &odcid, const std::string &title = "", const std::string &desc = "")
{
this->_traces.push_back(std::make_unique<Trace>(vp, odcid, title, desc));
return *this->_traces.back().get();
@@ -133,7 +140,7 @@
return *this->_traces.back().get();
}
- void dump(std::string dir);
+ void dump(const std::string &dir);
private:
std::string _title;
diff --git a/iocore/net/quic/qlog/QLogEvent.h b/iocore/net/quic/qlog/QLogEvent.h
index a03f7cc..553a348 100644
--- a/iocore/net/quic/qlog/QLogEvent.h
+++ b/iocore/net/quic/qlog/QLogEvent.h
@@ -75,7 +75,7 @@
// Note: short vs long header is implicit through PacketType
void
- encode(YAML::Node &node)
+ encode(YAML::Node &node) const
{
node["packet_number"] = packet_number;
node["packet_size"] = packet_size;
@@ -90,7 +90,7 @@
#define SET_FUNC(cla, field, type) \
public: \
- cla &set_##field(type v) \
+ cla &set_##field(const type &v) \
{ \
this->_##field = v; \
return *this; \
@@ -173,7 +173,8 @@
class ConnectionStarted : public ConnectivityEvent
{
public:
- ConnectionStarted(std::string version, std::string sip, std::string dip, int sport, int dport, std::string protocol = "QUIC")
+ ConnectionStarted(const std::string &version, const std::string &sip, const std::string &dip, int sport, int dport,
+ const std::string &protocol = "QUIC")
{
set_ip_version(version);
set_protocol(protocol);
@@ -211,7 +212,7 @@
class ConnectionIdUpdated : public ConnectivityEvent
{
public:
- ConnectionIdUpdated(std::string old, std::string n, bool peer = false)
+ ConnectionIdUpdated(const std::string &old, const std::string &n, bool peer = false)
{
if (peer) {
set_dst_old(old);
@@ -345,7 +346,7 @@
tls,
};
- KeyEvent(KeyType ty, std::string n, int generation, Triggered triggered = Triggered::unknown)
+ KeyEvent(KeyType ty, const std::string &n, int generation, Triggered triggered = Triggered::unknown)
{
set_key_type(ty);
set_new(n);
@@ -388,7 +389,7 @@
class KeyUpdated : public KeyEvent
{
public:
- KeyUpdated(KeyType ty, std::string n, int generation, Triggered triggered = KeyEvent::Triggered::unknown)
+ KeyUpdated(KeyType ty, const std::string &n, int generation, Triggered triggered = KeyEvent::Triggered::unknown)
: KeyEvent(ty, n, generation, triggered)
{
}
@@ -403,7 +404,7 @@
class KeyRetired : public KeyEvent
{
public:
- KeyRetired(KeyType ty, std::string n, int generation, Triggered triggered = KeyEvent::Triggered::unknown)
+ KeyRetired(KeyType ty, const std::string &n, int generation, Triggered triggered = KeyEvent::Triggered::unknown)
: KeyEvent(ty, n, generation, triggered)
{
}
@@ -495,7 +496,7 @@
cc_bandwidth_probe, // needed for some CCs to figure out bandwidth allocations when there are no normal sends
};
- PacketEvent(PacketType type, PacketHeader h, Triggered tr = Triggered::unknown)
+ PacketEvent(const PacketType &type, PacketHeader h, Triggered tr = Triggered::unknown)
{
set_packet_type(type).set_header(h).set_trigger(tr);
}
@@ -543,7 +544,7 @@
class PacketSent : public PacketEvent
{
public:
- PacketSent(PacketType type, PacketHeader h, Triggered tr = Triggered::unknown) : PacketEvent(type, h, tr) {}
+ PacketSent(const PacketType &type, const PacketHeader &h, Triggered tr = Triggered::unknown) : PacketEvent(type, h, tr) {}
std::string
event() const override
{
@@ -554,7 +555,7 @@
class PacketReceived : public PacketEvent
{
public:
- PacketReceived(PacketType type, PacketHeader h, Triggered tr = Triggered::unknown) : PacketEvent(type, h, tr) {}
+ PacketReceived(const PacketType &type, const PacketHeader &h, Triggered tr = Triggered::unknown) : PacketEvent(type, h, tr) {}
std::string
event() const override
{
diff --git a/iocore/net/quic/qlog/QLogFrame.h b/iocore/net/quic/qlog/QLogFrame.h
index be56351..6dfb035 100644
--- a/iocore/net/quic/qlog/QLogFrame.h
+++ b/iocore/net/quic/qlog/QLogFrame.h
@@ -171,7 +171,7 @@
};
struct MaxDataFrame : public QLogFrame {
- MaxDataFrame(const QUICMaxDataFrame &frame) : QLogFrame(frame.type()) { maximum = std::to_string(frame.maximum_data()); }
+ MaxDataFrame(const QUICMaxDataFrame &frame) : QLogFrame(frame.type()), maximum(std::to_string(frame.maximum_data())) {}
void encode(YAML::Node &) override;
std::string maximum;
@@ -234,9 +234,9 @@
};
struct NewConnectionIDFrame : public QLogFrame {
- NewConnectionIDFrame(const QUICNewConnectionIdFrame &frame) : QLogFrame(frame.type())
+ NewConnectionIDFrame(const QUICNewConnectionIdFrame &frame)
+ : QLogFrame(frame.type()), sequence_number(std::to_string(frame.sequence()))
{
- sequence_number = std::to_string(frame.sequence());
retire_prior_to = std::to_string(frame.retire_prior_to());
connection_id = frame.connection_id().hex();
stateless_reset_token = QUICBase::to_hex(frame.stateless_reset_token().buf(), QUICStatelessResetToken::LEN);
@@ -249,37 +249,37 @@
};
struct RetireConnectionIDFrame : public QLogFrame {
- RetireConnectionIDFrame(const QUICRetireConnectionIdFrame &frame) : QLogFrame(frame.type())
+ RetireConnectionIDFrame(const QUICRetireConnectionIdFrame &frame)
+ : QLogFrame(frame.type()), sequence_number(std::to_string(frame.seq_num()))
{
- sequence_number = std::to_string(frame.seq_num());
}
void encode(YAML::Node &) override;
std::string sequence_number;
};
struct PathChallengeFrame : public QLogFrame {
- PathChallengeFrame(const QUICPathChallengeFrame &frame) : QLogFrame(frame.type())
+ PathChallengeFrame(const QUICPathChallengeFrame &frame)
+ : QLogFrame(frame.type()), data(QUICBase::to_hex(frame.data(), QUICPathChallengeFrame::DATA_LEN))
{
- data = QUICBase::to_hex(frame.data(), QUICPathChallengeFrame::DATA_LEN);
}
void encode(YAML::Node &) override;
std::string data;
};
struct PathResponseFrame : public QLogFrame {
- PathResponseFrame(const QUICPathResponseFrame &frame) : QLogFrame(frame.type())
+ PathResponseFrame(const QUICPathResponseFrame &frame)
+ : QLogFrame(frame.type()), data(QUICBase::to_hex(frame.data(), QUICPathChallengeFrame::DATA_LEN))
{
- data = QUICBase::to_hex(frame.data(), QUICPathChallengeFrame::DATA_LEN);
}
void encode(YAML::Node &) override;
std::string data;
};
struct ConnectionCloseFrame : public QLogFrame {
- ConnectionCloseFrame(const QUICConnectionCloseFrame &frame, bool app = false) : QLogFrame(frame.type())
+ ConnectionCloseFrame(const QUICConnectionCloseFrame &frame, bool app = false)
+ : QLogFrame(frame.type()), error_space(app ? "application" : "transport")
{
- error_space = app ? "application" : "transport";
- error_code = frame.error_code();
+ error_code = frame.error_code();
// FIXME
raw_error_code = error_code;
reason = frame.reason_phrase();
diff --git a/proxy/http3/QPACK.cc b/proxy/http3/QPACK.cc
index 6af4a16..2170214 100644
--- a/proxy/http3/QPACK.cc
+++ b/proxy/http3/QPACK.cc
@@ -1397,7 +1397,7 @@
}
uint16_t
-QPACK::DynamicTable::largest_index()
+QPACK::DynamicTable::largest_index() const
{
return this->_entries_inserted;
}
@@ -1802,7 +1802,8 @@
}
void
-QPACK::DynamicTableStorage::read(uint16_t offset, const char **name, uint16_t name_len, const char **value, uint16_t value_len)
+QPACK::DynamicTableStorage::read(uint16_t offset, const char **name, uint16_t name_len, const char **value,
+ uint16_t value_len) const
{
*name = reinterpret_cast<const char *>(this->_data + offset);
*value = reinterpret_cast<const char *>(this->_data + offset + name_len);
diff --git a/proxy/http3/QPACK.h b/proxy/http3/QPACK.h
index 9b40c17..e81b4ab 100644
--- a/proxy/http3/QPACK.h
+++ b/proxy/http3/QPACK.h
@@ -112,7 +112,7 @@
public:
DynamicTableStorage(uint16_t size);
~DynamicTableStorage();
- void read(uint16_t offset, const char **name, uint16_t name_len, const char **value, uint16_t value_len);
+ void read(uint16_t offset, const char **name, uint16_t name_len, const char **value, uint16_t value_len) const;
uint16_t write(const char *name, uint16_t name_len, const char *value, uint16_t value_len);
void erase(uint16_t name_len, uint16_t value_len);
@@ -139,7 +139,7 @@
void update_size(uint16_t max_size);
void ref_entry(uint16_t index);
void unref_entry(uint16_t index);
- uint16_t largest_index();
+ uint16_t largest_index() const;
private:
uint16_t _available = 0;
@@ -169,7 +169,7 @@
}
uint16_t
- largest_reference()
+ largest_reference() const
{
return this->_largest_reference;
}
@@ -187,19 +187,19 @@
}
uint64_t
- stream_id()
+ stream_id() const
{
return this->_stream_id;
}
const uint8_t *
- header_block()
+ header_block() const
{
return this->_header_block;
}
size_t
- header_block_len()
+ header_block_len() const
{
return this->_header_block_len;
}