├── .bazelrc ├── .bazelversion ├── BUILD.bazel ├── CONTRIBUTING.md ├── LICENSE ├── MODULE.bazel ├── MODULE.bazel.lock ├── README.md ├── WHITESPACE ├── build ├── BUILD.bazel ├── source_list.bzl ├── source_list.gni ├── source_list.json └── test.bzl ├── depstool ├── deps │ ├── fetch.go │ ├── fetch_test.go │ ├── parse.go │ └── parse_test.go ├── depstool.go ├── go.mod └── go.sum └── quiche ├── BUILD.bazel ├── balsa ├── balsa_enums.cc ├── balsa_enums.h ├── balsa_frame.cc ├── balsa_frame.h ├── balsa_frame_test.cc ├── balsa_headers.cc ├── balsa_headers.h ├── balsa_headers_sequence.cc ├── balsa_headers_sequence.h ├── balsa_headers_sequence_test.cc ├── balsa_headers_test.cc ├── balsa_visitor_interface.h ├── framer_interface.h ├── header_api.h ├── header_properties.cc ├── header_properties.h ├── header_properties_test.cc ├── http_validation_policy.h ├── noop_balsa_visitor.h ├── simple_buffer.cc ├── simple_buffer.h ├── simple_buffer_test.cc ├── standard_header_map.cc └── standard_header_map.h ├── binary_http ├── binary_http_message.cc ├── binary_http_message.h └── binary_http_message_test.cc ├── blind_sign_auth ├── blind_sign_auth.cc ├── blind_sign_auth.h ├── blind_sign_auth_interface.h ├── blind_sign_auth_protos.h ├── blind_sign_auth_test.cc ├── blind_sign_message_interface.h ├── blind_sign_message_response.cc ├── blind_sign_message_response.h ├── cached_blind_sign_auth.cc ├── cached_blind_sign_auth.h ├── cached_blind_sign_auth_test.cc ├── proto │ ├── any.proto │ ├── attestation.proto │ ├── auth_and_sign.proto │ ├── blind_sign_auth_options.proto │ ├── get_initial_data.proto │ ├── key_services.proto │ ├── proxy_layer.proto │ ├── public_metadata.proto │ └── spend_token_data.proto └── test_tools │ ├── mock_blind_sign_auth_interface.h │ └── mock_blind_sign_message_interface.h ├── common ├── btree_scheduler.h ├── btree_scheduler_test.cc ├── bug_utils.cc ├── bug_utils.h ├── bug_utils_test.cc ├── bug_utils_test_helper.h ├── capsule.cc ├── capsule.h ├── capsule_test.cc ├── http │ ├── http_header_block.cc │ ├── http_header_block.h │ ├── http_header_block_test.cc │ ├── http_header_storage.cc │ ├── http_header_storage.h │ └── http_header_storage_test.cc ├── internet_checksum.cc ├── internet_checksum.h ├── internet_checksum_test.cc ├── lifetime_tracking.h ├── lifetime_tracking_test.cc ├── masque │ ├── connect_ip_datagram_payload.cc │ ├── connect_ip_datagram_payload.h │ ├── connect_ip_datagram_payload_test.cc │ ├── connect_udp_datagram_payload.cc │ ├── connect_udp_datagram_payload.h │ └── connect_udp_datagram_payload_test.cc ├── platform │ ├── api │ │ ├── quiche_bug_tracker.h │ │ ├── quiche_client_stats.h │ │ ├── quiche_command_line_flags.h │ │ ├── quiche_containers.h │ │ ├── quiche_default_proof_providers.h │ │ ├── quiche_event_loop.h │ │ ├── quiche_expect_bug.h │ │ ├── quiche_export.h │ │ ├── quiche_file_utils.cc │ │ ├── quiche_file_utils.h │ │ ├── quiche_file_utils_test.cc │ │ ├── quiche_flag_utils.h │ │ ├── quiche_flags.h │ │ ├── quiche_googleurl.h │ │ ├── quiche_header_policy.h │ │ ├── quiche_hostname_utils.cc │ │ ├── quiche_hostname_utils.h │ │ ├── quiche_hostname_utils_test.cc │ │ ├── quiche_iovec.h │ │ ├── quiche_logging.h │ │ ├── quiche_lower_case_string.h │ │ ├── quiche_lower_case_string_test.cc │ │ ├── quiche_reference_counted.h │ │ ├── quiche_reference_counted_test.cc │ │ ├── quiche_server_stats.h │ │ ├── quiche_stack_trace.h │ │ ├── quiche_stack_trace_test.cc │ │ ├── quiche_system_event_loop.h │ │ ├── quiche_test.h │ │ ├── quiche_test_loopback.cc │ │ ├── quiche_test_loopback.h │ │ ├── quiche_test_output.h │ │ ├── quiche_testvalue.h │ │ ├── quiche_thread.h │ │ ├── quiche_time_utils.h │ │ ├── quiche_time_utils_test.cc │ │ ├── quiche_udp_socket_platform_api.h │ │ ├── quiche_url_utils.h │ │ ├── quiche_url_utils_test.cc │ │ └── testdir │ │ │ ├── README.md │ │ │ ├── a │ │ │ ├── b │ │ │ │ └── c │ │ │ │ │ └── d │ │ │ │ │ └── e │ │ │ ├── subdir │ │ │ │ └── testfile │ │ │ └── z │ │ │ └── testfile │ └── default │ │ └── quiche_platform_impl │ │ ├── quiche_bug_tracker_impl.h │ │ ├── quiche_client_stats_impl.h │ │ ├── quiche_command_line_flags_impl.cc │ │ ├── quiche_command_line_flags_impl.h │ │ ├── quiche_containers_impl.h │ │ ├── quiche_default_proof_providers_impl.cc │ │ ├── quiche_default_proof_providers_impl.h │ │ ├── quiche_event_loop_impl.h │ │ ├── quiche_expect_bug_impl.h │ │ ├── quiche_export_impl.h │ │ ├── quiche_file_utils_impl.cc │ │ ├── quiche_file_utils_impl.h │ │ ├── quiche_flag_utils_impl.h │ │ ├── quiche_flags_impl.cc │ │ ├── quiche_flags_impl.h │ │ ├── quiche_googleurl_impl.h │ │ ├── quiche_header_policy_impl.h │ │ ├── quiche_iovec_impl.h │ │ ├── quiche_logging_impl.cc │ │ ├── quiche_logging_impl.h │ │ ├── quiche_lower_case_string_impl.h │ │ ├── quiche_reference_counted_impl.h │ │ ├── quiche_server_stats_impl.h │ │ ├── quiche_stack_trace_impl.cc │ │ ├── quiche_stack_trace_impl.h │ │ ├── quiche_stream_buffer_allocator_impl.h │ │ ├── quiche_system_event_loop_impl.h │ │ ├── quiche_test_impl.cc │ │ ├── quiche_test_impl.h │ │ ├── quiche_test_loopback_impl.cc │ │ ├── quiche_test_loopback_impl.h │ │ ├── quiche_test_output_impl.h │ │ ├── quiche_testvalue_impl.h │ │ ├── quiche_thread_impl.h │ │ ├── quiche_time_utils_impl.cc │ │ ├── quiche_time_utils_impl.h │ │ ├── quiche_udp_socket_platform_impl.h │ │ ├── quiche_url_utils_impl.cc │ │ └── quiche_url_utils_impl.h ├── print_elements.h ├── print_elements_test.cc ├── quiche_buffer_allocator.cc ├── quiche_buffer_allocator.h ├── quiche_buffer_allocator_test.cc ├── quiche_callbacks.h ├── quiche_callbacks_test.cc ├── quiche_circular_deque.h ├── quiche_circular_deque_test.cc ├── quiche_crypto_logging.cc ├── quiche_crypto_logging.h ├── quiche_data_reader.cc ├── quiche_data_reader.h ├── quiche_data_reader_test.cc ├── quiche_data_writer.cc ├── quiche_data_writer.h ├── quiche_data_writer_test.cc ├── quiche_endian.h ├── quiche_endian_test.cc ├── quiche_feature_flags_list.h ├── quiche_intrusive_list.h ├── quiche_intrusive_list_test.cc ├── quiche_ip_address.cc ├── quiche_ip_address.h ├── quiche_ip_address_family.cc ├── quiche_ip_address_family.h ├── quiche_ip_address_test.cc ├── quiche_linked_hash_map.h ├── quiche_linked_hash_map_test.cc ├── quiche_mem_slice.cc ├── quiche_mem_slice.h ├── quiche_mem_slice_storage.cc ├── quiche_mem_slice_storage.h ├── quiche_mem_slice_storage_test.cc ├── quiche_mem_slice_test.cc ├── quiche_protocol_flags_list.h ├── quiche_random.cc ├── quiche_random.h ├── quiche_random_test.cc ├── quiche_simple_arena.cc ├── quiche_simple_arena.h ├── quiche_simple_arena_test.cc ├── quiche_socket_address.cc ├── quiche_socket_address.h ├── quiche_socket_address_test.cc ├── quiche_status_utils.h ├── quiche_stream.h ├── quiche_text_utils.cc ├── quiche_text_utils.h ├── quiche_text_utils_test.cc ├── quiche_weak_ptr.h ├── quiche_weak_ptr_test.cc ├── simple_buffer_allocator.cc ├── simple_buffer_allocator.h ├── simple_buffer_allocator_test.cc ├── structured_headers.cc ├── structured_headers.h ├── structured_headers_fuzzer.cc ├── structured_headers_generated_test.cc ├── structured_headers_test.cc ├── test_tools │ ├── mock_streams.h │ ├── mock_streams_test.cc │ ├── quiche_test_utils.cc │ ├── quiche_test_utils.h │ └── quiche_test_utils_test.cc ├── vectorized_io_utils.cc ├── vectorized_io_utils.h ├── vectorized_io_utils_test.cc ├── wire_serialization.h └── wire_serialization_test.cc ├── http2 ├── adapter │ ├── README.md │ ├── adapter_impl_comparison_test.cc │ ├── callback_visitor.cc │ ├── callback_visitor.h │ ├── callback_visitor_test.cc │ ├── chunked_buffer.cc │ ├── chunked_buffer.h │ ├── chunked_buffer_test.cc │ ├── data_source.h │ ├── event_forwarder.cc │ ├── event_forwarder.h │ ├── event_forwarder_test.cc │ ├── header_validator.cc │ ├── header_validator.h │ ├── header_validator_base.h │ ├── header_validator_test.cc │ ├── http2_adapter.h │ ├── http2_protocol.cc │ ├── http2_protocol.h │ ├── http2_session.h │ ├── http2_util.cc │ ├── http2_util.h │ ├── http2_visitor_interface.h │ ├── mock_http2_visitor.h │ ├── mock_nghttp2_callbacks.cc │ ├── mock_nghttp2_callbacks.h │ ├── nghttp2.h │ ├── nghttp2_adapter.cc │ ├── nghttp2_adapter.h │ ├── nghttp2_adapter_test.cc │ ├── nghttp2_callbacks.cc │ ├── nghttp2_callbacks.h │ ├── nghttp2_data_provider.cc │ ├── nghttp2_data_provider.h │ ├── nghttp2_data_provider_test.cc │ ├── nghttp2_session.cc │ ├── nghttp2_session.h │ ├── nghttp2_session_test.cc │ ├── nghttp2_test.cc │ ├── nghttp2_test_utils.cc │ ├── nghttp2_test_utils.h │ ├── nghttp2_util.cc │ ├── nghttp2_util.h │ ├── noop_header_validator.cc │ ├── noop_header_validator.h │ ├── noop_header_validator_test.cc │ ├── oghttp2_adapter.cc │ ├── oghttp2_adapter.h │ ├── oghttp2_adapter_metadata_test.cc │ ├── oghttp2_adapter_test.cc │ ├── oghttp2_session.cc │ ├── oghttp2_session.h │ ├── oghttp2_session_test.cc │ ├── oghttp2_util.cc │ ├── oghttp2_util.h │ ├── oghttp2_util_test.cc │ ├── recording_http2_visitor.cc │ ├── recording_http2_visitor.h │ ├── recording_http2_visitor_test.cc │ ├── test_frame_sequence.cc │ ├── test_frame_sequence.h │ ├── test_utils.cc │ ├── test_utils.h │ ├── test_utils_test.cc │ ├── window_manager.cc │ ├── window_manager.h │ └── window_manager_test.cc ├── core │ ├── array_output_buffer.cc │ ├── array_output_buffer.h │ ├── array_output_buffer_test.cc │ ├── header_byte_listener_interface.h │ ├── http2_constants.cc │ ├── http2_constants.h │ ├── http2_constants_test.cc │ ├── http2_frame_decoder_adapter.cc │ ├── http2_frame_decoder_adapter.h │ ├── http2_frame_decoder_adapter_fuzzer.cc │ ├── http2_header_block_hpack_listener.h │ ├── http2_structures.cc │ ├── http2_structures.h │ ├── http2_structures_test.cc │ ├── http2_trace_logging.cc │ ├── http2_trace_logging.h │ ├── no_op_headers_handler.h │ ├── priority_write_scheduler.h │ ├── priority_write_scheduler_test.cc │ ├── recording_headers_handler.cc │ ├── recording_headers_handler.h │ ├── spdy_alt_svc_wire_format.cc │ ├── spdy_alt_svc_wire_format.h │ ├── spdy_alt_svc_wire_format_test.cc │ ├── spdy_bitmasks.h │ ├── spdy_frame_builder.cc │ ├── spdy_frame_builder.h │ ├── spdy_frame_builder_test.cc │ ├── spdy_framer.cc │ ├── spdy_framer.h │ ├── spdy_framer_test.cc │ ├── spdy_headers_handler_interface.h │ ├── spdy_no_op_visitor.cc │ ├── spdy_no_op_visitor.h │ ├── spdy_protocol.cc │ ├── spdy_protocol.h │ ├── spdy_protocol_test.cc │ └── zero_copy_output_buffer.h ├── decoder │ ├── README.md │ ├── decode_buffer.cc │ ├── decode_buffer.h │ ├── decode_buffer_test.cc │ ├── decode_http2_structures.cc │ ├── decode_http2_structures.h │ ├── decode_http2_structures_test.cc │ ├── decode_status.cc │ ├── decode_status.h │ ├── frame_decoder_state.cc │ ├── frame_decoder_state.h │ ├── http2_frame_decoder.cc │ ├── http2_frame_decoder.h │ ├── http2_frame_decoder_fuzzer.cc │ ├── http2_frame_decoder_listener.cc │ ├── http2_frame_decoder_listener.h │ ├── http2_frame_decoder_test.cc │ ├── http2_structure_decoder.cc │ ├── http2_structure_decoder.h │ ├── http2_structure_decoder_remaining_payload_test.cc │ ├── http2_structure_decoder_test.cc │ └── payload_decoders │ │ ├── README.md │ │ ├── altsvc_payload_decoder.cc │ │ ├── altsvc_payload_decoder.h │ │ ├── altsvc_payload_decoder_test.cc │ │ ├── continuation_payload_decoder.cc │ │ ├── continuation_payload_decoder.h │ │ ├── continuation_payload_decoder_test.cc │ │ ├── data_payload_decoder.cc │ │ ├── data_payload_decoder.h │ │ ├── data_payload_decoder_test.cc │ │ ├── goaway_payload_decoder.cc │ │ ├── goaway_payload_decoder.h │ │ ├── goaway_payload_decoder_test.cc │ │ ├── headers_payload_decoder.cc │ │ ├── headers_payload_decoder.h │ │ ├── headers_payload_decoder_test.cc │ │ ├── ping_payload_decoder.cc │ │ ├── ping_payload_decoder.h │ │ ├── ping_payload_decoder_test.cc │ │ ├── priority_payload_decoder.cc │ │ ├── priority_payload_decoder.h │ │ ├── priority_payload_decoder_test.cc │ │ ├── priority_update_payload_decoder.cc │ │ ├── priority_update_payload_decoder.h │ │ ├── priority_update_payload_decoder_test.cc │ │ ├── push_promise_payload_decoder.cc │ │ ├── push_promise_payload_decoder.h │ │ ├── push_promise_payload_decoder_test.cc │ │ ├── rst_stream_payload_decoder.cc │ │ ├── rst_stream_payload_decoder.h │ │ ├── rst_stream_payload_decoder_test.cc │ │ ├── settings_payload_decoder.cc │ │ ├── settings_payload_decoder.h │ │ ├── settings_payload_decoder_test.cc │ │ ├── unknown_payload_decoder.cc │ │ ├── unknown_payload_decoder.h │ │ ├── unknown_payload_decoder_test.cc │ │ ├── window_update_payload_decoder.cc │ │ ├── window_update_payload_decoder.h │ │ └── window_update_payload_decoder_test.cc ├── hpack │ ├── decoder │ │ ├── hpack_block_collector_test.cc │ │ ├── hpack_block_decoder.cc │ │ ├── hpack_block_decoder.h │ │ ├── hpack_block_decoder_test.cc │ │ ├── hpack_decoder.cc │ │ ├── hpack_decoder.h │ │ ├── hpack_decoder_listener.cc │ │ ├── hpack_decoder_listener.h │ │ ├── hpack_decoder_state.cc │ │ ├── hpack_decoder_state.h │ │ ├── hpack_decoder_state_test.cc │ │ ├── hpack_decoder_string_buffer.cc │ │ ├── hpack_decoder_string_buffer.h │ │ ├── hpack_decoder_string_buffer_test.cc │ │ ├── hpack_decoder_tables.cc │ │ ├── hpack_decoder_tables.h │ │ ├── hpack_decoder_tables_test.cc │ │ ├── hpack_decoder_test.cc │ │ ├── hpack_decoding_error.cc │ │ ├── hpack_decoding_error.h │ │ ├── hpack_entry_collector_test.cc │ │ ├── hpack_entry_decoder.cc │ │ ├── hpack_entry_decoder.h │ │ ├── hpack_entry_decoder_listener.cc │ │ ├── hpack_entry_decoder_listener.h │ │ ├── hpack_entry_decoder_test.cc │ │ ├── hpack_entry_type_decoder.cc │ │ ├── hpack_entry_type_decoder.h │ │ ├── hpack_entry_type_decoder_test.cc │ │ ├── hpack_string_decoder.cc │ │ ├── hpack_string_decoder.h │ │ ├── hpack_string_decoder_listener.cc │ │ ├── hpack_string_decoder_listener.h │ │ ├── hpack_string_decoder_test.cc │ │ ├── hpack_whole_entry_buffer.cc │ │ ├── hpack_whole_entry_buffer.h │ │ ├── hpack_whole_entry_buffer_test.cc │ │ ├── hpack_whole_entry_listener.cc │ │ └── hpack_whole_entry_listener.h │ ├── hpack_constants.cc │ ├── hpack_constants.h │ ├── hpack_decoder_adapter.cc │ ├── hpack_decoder_adapter.h │ ├── hpack_decoder_adapter_test.cc │ ├── hpack_encoder.cc │ ├── hpack_encoder.h │ ├── hpack_encoder_test.cc │ ├── hpack_entry.cc │ ├── hpack_entry.h │ ├── hpack_entry_test.cc │ ├── hpack_header_table.cc │ ├── hpack_header_table.h │ ├── hpack_header_table_test.cc │ ├── hpack_output_stream.cc │ ├── hpack_output_stream.h │ ├── hpack_output_stream_test.cc │ ├── hpack_round_trip_test.cc │ ├── hpack_static_table.cc │ ├── hpack_static_table.h │ ├── hpack_static_table_entries.inc │ ├── hpack_static_table_test.cc │ ├── http2_hpack_constants.cc │ ├── http2_hpack_constants.h │ ├── http2_hpack_constants_test.cc │ ├── huffman │ │ ├── hpack_huffman_decoder.cc │ │ ├── hpack_huffman_decoder.h │ │ ├── hpack_huffman_decoder_test.cc │ │ ├── hpack_huffman_encoder.cc │ │ ├── hpack_huffman_encoder.h │ │ ├── hpack_huffman_encoder_test.cc │ │ ├── hpack_huffman_transcoder_test.cc │ │ ├── huffman_spec_tables.cc │ │ └── huffman_spec_tables.h │ └── varint │ │ ├── hpack_varint_decoder.cc │ │ ├── hpack_varint_decoder.h │ │ ├── hpack_varint_decoder_test.cc │ │ ├── hpack_varint_encoder.cc │ │ ├── hpack_varint_encoder.h │ │ ├── hpack_varint_encoder_test.cc │ │ └── hpack_varint_round_trip_test.cc └── test_tools │ ├── frame_decoder_state_test_util.cc │ ├── frame_decoder_state_test_util.h │ ├── frame_parts.cc │ ├── frame_parts.h │ ├── frame_parts_collector.cc │ ├── frame_parts_collector.h │ ├── frame_parts_collector_listener.cc │ ├── frame_parts_collector_listener.h │ ├── hpack_block_builder.cc │ ├── hpack_block_builder.h │ ├── hpack_block_builder_test.cc │ ├── hpack_block_collector.cc │ ├── hpack_block_collector.h │ ├── hpack_entry_collector.cc │ ├── hpack_entry_collector.h │ ├── hpack_example.cc │ ├── hpack_example.h │ ├── hpack_example_test.cc │ ├── hpack_string_collector.cc │ ├── hpack_string_collector.h │ ├── http2_constants_test_util.cc │ ├── http2_constants_test_util.h │ ├── http2_frame_builder.cc │ ├── http2_frame_builder.h │ ├── http2_frame_builder_test.cc │ ├── http2_frame_decoder_listener_test_util.cc │ ├── http2_frame_decoder_listener_test_util.h │ ├── http2_random.cc │ ├── http2_random.h │ ├── http2_random_test.cc │ ├── http2_structure_decoder_test_util.cc │ ├── http2_structure_decoder_test_util.h │ ├── http2_structures_test_util.cc │ ├── http2_structures_test_util.h │ ├── http2_trace_printer.cc │ ├── http2_trace_printer.h │ ├── mock_spdy_framer_visitor.cc │ ├── mock_spdy_framer_visitor.h │ ├── payload_decoder_base_test_util.cc │ ├── payload_decoder_base_test_util.h │ ├── random_decoder_test_base.cc │ ├── random_decoder_test_base.h │ ├── random_decoder_test_base_test.cc │ ├── random_util.cc │ ├── random_util.h │ ├── spdy_test_utils.cc │ ├── spdy_test_utils.h │ └── verify_macros.h ├── oblivious_http ├── buffers │ ├── oblivious_http_integration_test.cc │ ├── oblivious_http_request.cc │ ├── oblivious_http_request.h │ ├── oblivious_http_request_test.cc │ ├── oblivious_http_response.cc │ ├── oblivious_http_response.h │ └── oblivious_http_response_test.cc ├── common │ ├── oblivious_http_header_key_config.cc │ ├── oblivious_http_header_key_config.h │ └── oblivious_http_header_key_config_test.cc ├── oblivious_http_client.cc ├── oblivious_http_client.h ├── oblivious_http_client_test.cc ├── oblivious_http_gateway.cc ├── oblivious_http_gateway.h └── oblivious_http_gateway_test.cc ├── quic ├── bindings │ ├── quic_libevent.cc │ ├── quic_libevent.h │ └── quic_libevent_test.cc ├── core │ ├── batch_writer │ │ ├── quic_batch_writer_base.cc │ │ ├── quic_batch_writer_base.h │ │ ├── quic_batch_writer_buffer.cc │ │ ├── quic_batch_writer_buffer.h │ │ ├── quic_batch_writer_buffer_test.cc │ │ ├── quic_batch_writer_test.cc │ │ ├── quic_batch_writer_test.h │ │ ├── quic_gso_batch_writer.cc │ │ ├── quic_gso_batch_writer.h │ │ ├── quic_gso_batch_writer_test.cc │ │ ├── quic_sendmmsg_batch_writer.cc │ │ ├── quic_sendmmsg_batch_writer.h │ │ └── quic_sendmmsg_batch_writer_test.cc │ ├── chlo_extractor.cc │ ├── chlo_extractor.h │ ├── chlo_extractor_test.cc │ ├── congestion_control │ │ ├── bandwidth_sampler.cc │ │ ├── bandwidth_sampler.h │ │ ├── bandwidth_sampler_test.cc │ │ ├── bbr2_drain.cc │ │ ├── bbr2_drain.h │ │ ├── bbr2_misc.cc │ │ ├── bbr2_misc.h │ │ ├── bbr2_probe_bw.cc │ │ ├── bbr2_probe_bw.h │ │ ├── bbr2_probe_rtt.cc │ │ ├── bbr2_probe_rtt.h │ │ ├── bbr2_sender.cc │ │ ├── bbr2_sender.h │ │ ├── bbr2_simulator_test.cc │ │ ├── bbr2_startup.cc │ │ ├── bbr2_startup.h │ │ ├── bbr_sender.cc │ │ ├── bbr_sender.h │ │ ├── bbr_sender_test.cc │ │ ├── cubic_bytes.cc │ │ ├── cubic_bytes.h │ │ ├── cubic_bytes_test.cc │ │ ├── general_loss_algorithm.cc │ │ ├── general_loss_algorithm.h │ │ ├── general_loss_algorithm_test.cc │ │ ├── hybrid_slow_start.cc │ │ ├── hybrid_slow_start.h │ │ ├── hybrid_slow_start_test.cc │ │ ├── loss_detection_interface.h │ │ ├── pacing_sender.cc │ │ ├── pacing_sender.h │ │ ├── pacing_sender_test.cc │ │ ├── prague_sender.cc │ │ ├── prague_sender.h │ │ ├── prague_sender_test.cc │ │ ├── prr_sender.cc │ │ ├── prr_sender.h │ │ ├── prr_sender_test.cc │ │ ├── rtt_stats.cc │ │ ├── rtt_stats.h │ │ ├── rtt_stats_test.cc │ │ ├── send_algorithm_interface.cc │ │ ├── send_algorithm_interface.h │ │ ├── send_algorithm_test.cc │ │ ├── tcp_cubic_sender_bytes.cc │ │ ├── tcp_cubic_sender_bytes.h │ │ ├── tcp_cubic_sender_bytes_test.cc │ │ ├── uber_loss_algorithm.cc │ │ ├── uber_loss_algorithm.h │ │ ├── uber_loss_algorithm_test.cc │ │ ├── windowed_filter.h │ │ └── windowed_filter_test.cc │ ├── connecting_client_socket.h │ ├── connection_id_generator.h │ ├── crypto │ │ ├── aead_base_decrypter.cc │ │ ├── aead_base_decrypter.h │ │ ├── aead_base_encrypter.cc │ │ ├── aead_base_encrypter.h │ │ ├── aes_128_gcm_12_decrypter.cc │ │ ├── aes_128_gcm_12_decrypter.h │ │ ├── aes_128_gcm_12_decrypter_test.cc │ │ ├── aes_128_gcm_12_encrypter.cc │ │ ├── aes_128_gcm_12_encrypter.h │ │ ├── aes_128_gcm_12_encrypter_test.cc │ │ ├── aes_128_gcm_decrypter.cc │ │ ├── aes_128_gcm_decrypter.h │ │ ├── aes_128_gcm_decrypter_test.cc │ │ ├── aes_128_gcm_encrypter.cc │ │ ├── aes_128_gcm_encrypter.h │ │ ├── aes_128_gcm_encrypter_test.cc │ │ ├── aes_256_gcm_decrypter.cc │ │ ├── aes_256_gcm_decrypter.h │ │ ├── aes_256_gcm_decrypter_test.cc │ │ ├── aes_256_gcm_encrypter.cc │ │ ├── aes_256_gcm_encrypter.h │ │ ├── aes_256_gcm_encrypter_test.cc │ │ ├── aes_base_decrypter.cc │ │ ├── aes_base_decrypter.h │ │ ├── aes_base_encrypter.cc │ │ ├── aes_base_encrypter.h │ │ ├── boring_utils.h │ │ ├── cert_compressor.cc │ │ ├── cert_compressor.h │ │ ├── cert_compressor_test.cc │ │ ├── certificate_util.cc │ │ ├── certificate_util.h │ │ ├── certificate_util_test.cc │ │ ├── certificate_view.cc │ │ ├── certificate_view.h │ │ ├── certificate_view_der_fuzzer.cc │ │ ├── certificate_view_pem_fuzzer.cc │ │ ├── certificate_view_test.cc │ │ ├── chacha20_poly1305_decrypter.cc │ │ ├── chacha20_poly1305_decrypter.h │ │ ├── chacha20_poly1305_decrypter_test.cc │ │ ├── chacha20_poly1305_encrypter.cc │ │ ├── chacha20_poly1305_encrypter.h │ │ ├── chacha20_poly1305_encrypter_test.cc │ │ ├── chacha20_poly1305_tls_decrypter.cc │ │ ├── chacha20_poly1305_tls_decrypter.h │ │ ├── chacha20_poly1305_tls_decrypter_test.cc │ │ ├── chacha20_poly1305_tls_encrypter.cc │ │ ├── chacha20_poly1305_tls_encrypter.h │ │ ├── chacha20_poly1305_tls_encrypter_test.cc │ │ ├── chacha_base_decrypter.cc │ │ ├── chacha_base_decrypter.h │ │ ├── chacha_base_encrypter.cc │ │ ├── chacha_base_encrypter.h │ │ ├── channel_id.cc │ │ ├── channel_id.h │ │ ├── channel_id_test.cc │ │ ├── client_proof_source.cc │ │ ├── client_proof_source.h │ │ ├── client_proof_source_test.cc │ │ ├── crypto_framer.cc │ │ ├── crypto_framer.h │ │ ├── crypto_framer_test.cc │ │ ├── crypto_handshake.cc │ │ ├── crypto_handshake.h │ │ ├── crypto_handshake_message.cc │ │ ├── crypto_handshake_message.h │ │ ├── crypto_handshake_message_test.cc │ │ ├── crypto_message_parser.h │ │ ├── crypto_protocol.h │ │ ├── crypto_secret_boxer.cc │ │ ├── crypto_secret_boxer.h │ │ ├── crypto_secret_boxer_test.cc │ │ ├── crypto_server_test.cc │ │ ├── crypto_utils.cc │ │ ├── crypto_utils.h │ │ ├── crypto_utils_test.cc │ │ ├── curve25519_key_exchange.cc │ │ ├── curve25519_key_exchange.h │ │ ├── curve25519_key_exchange_test.cc │ │ ├── key_exchange.cc │ │ ├── key_exchange.h │ │ ├── null_decrypter.cc │ │ ├── null_decrypter.h │ │ ├── null_decrypter_test.cc │ │ ├── null_encrypter.cc │ │ ├── null_encrypter.h │ │ ├── null_encrypter_test.cc │ │ ├── p256_key_exchange.cc │ │ ├── p256_key_exchange.h │ │ ├── p256_key_exchange_test.cc │ │ ├── proof_source.cc │ │ ├── proof_source.h │ │ ├── proof_source_x509.cc │ │ ├── proof_source_x509.h │ │ ├── proof_source_x509_test.cc │ │ ├── proof_verifier.h │ │ ├── quic_client_session_cache.cc │ │ ├── quic_client_session_cache.h │ │ ├── quic_client_session_cache_test.cc │ │ ├── quic_compressed_certs_cache.cc │ │ ├── quic_compressed_certs_cache.h │ │ ├── quic_compressed_certs_cache_test.cc │ │ ├── quic_crypter.cc │ │ ├── quic_crypter.h │ │ ├── quic_crypto_client_config.cc │ │ ├── quic_crypto_client_config.h │ │ ├── quic_crypto_client_config_test.cc │ │ ├── quic_crypto_proof.cc │ │ ├── quic_crypto_proof.h │ │ ├── quic_crypto_server_config.cc │ │ ├── quic_crypto_server_config.h │ │ ├── quic_crypto_server_config_test.cc │ │ ├── quic_decrypter.cc │ │ ├── quic_decrypter.h │ │ ├── quic_encrypter.cc │ │ ├── quic_encrypter.h │ │ ├── quic_hkdf.cc │ │ ├── quic_hkdf.h │ │ ├── quic_hkdf_test.cc │ │ ├── quic_random.h │ │ ├── tls_client_connection.cc │ │ ├── tls_client_connection.h │ │ ├── tls_connection.cc │ │ ├── tls_connection.h │ │ ├── tls_server_connection.cc │ │ ├── tls_server_connection.h │ │ ├── transport_parameters.cc │ │ ├── transport_parameters.h │ │ ├── transport_parameters_test.cc │ │ ├── web_transport_fingerprint_proof_verifier.cc │ │ ├── web_transport_fingerprint_proof_verifier.h │ │ └── web_transport_fingerprint_proof_verifier_test.cc │ ├── deterministic_connection_id_generator.cc │ ├── deterministic_connection_id_generator.h │ ├── deterministic_connection_id_generator_test.cc │ ├── flow_label.h │ ├── frames │ │ ├── quic_ack_frame.cc │ │ ├── quic_ack_frame.h │ │ ├── quic_ack_frequency_frame.cc │ │ ├── quic_ack_frequency_frame.h │ │ ├── quic_blocked_frame.cc │ │ ├── quic_blocked_frame.h │ │ ├── quic_connection_close_frame.cc │ │ ├── quic_connection_close_frame.h │ │ ├── quic_crypto_frame.cc │ │ ├── quic_crypto_frame.h │ │ ├── quic_frame.cc │ │ ├── quic_frame.h │ │ ├── quic_frames_test.cc │ │ ├── quic_goaway_frame.cc │ │ ├── quic_goaway_frame.h │ │ ├── quic_handshake_done_frame.cc │ │ ├── quic_handshake_done_frame.h │ │ ├── quic_immediate_ack_frame.cc │ │ ├── quic_immediate_ack_frame.h │ │ ├── quic_inlined_frame.h │ │ ├── quic_max_streams_frame.cc │ │ ├── quic_max_streams_frame.h │ │ ├── quic_message_frame.cc │ │ ├── quic_message_frame.h │ │ ├── quic_mtu_discovery_frame.h │ │ ├── quic_new_connection_id_frame.cc │ │ ├── quic_new_connection_id_frame.h │ │ ├── quic_new_token_frame.cc │ │ ├── quic_new_token_frame.h │ │ ├── quic_padding_frame.cc │ │ ├── quic_padding_frame.h │ │ ├── quic_path_challenge_frame.cc │ │ ├── quic_path_challenge_frame.h │ │ ├── quic_path_response_frame.cc │ │ ├── quic_path_response_frame.h │ │ ├── quic_ping_frame.cc │ │ ├── quic_ping_frame.h │ │ ├── quic_reset_stream_at_frame.cc │ │ ├── quic_reset_stream_at_frame.h │ │ ├── quic_retire_connection_id_frame.cc │ │ ├── quic_retire_connection_id_frame.h │ │ ├── quic_rst_stream_frame.cc │ │ ├── quic_rst_stream_frame.h │ │ ├── quic_stop_sending_frame.cc │ │ ├── quic_stop_sending_frame.h │ │ ├── quic_stop_waiting_frame.cc │ │ ├── quic_stop_waiting_frame.h │ │ ├── quic_stream_frame.cc │ │ ├── quic_stream_frame.h │ │ ├── quic_streams_blocked_frame.cc │ │ ├── quic_streams_blocked_frame.h │ │ ├── quic_window_update_frame.cc │ │ └── quic_window_update_frame.h │ ├── handshaker_delegate_interface.h │ ├── http │ │ ├── end_to_end_test.cc │ │ ├── http_constants.cc │ │ ├── http_constants.h │ │ ├── http_decoder.cc │ │ ├── http_decoder.h │ │ ├── http_decoder_test.cc │ │ ├── http_encoder.cc │ │ ├── http_encoder.h │ │ ├── http_encoder_test.cc │ │ ├── http_frames.h │ │ ├── http_frames_test.cc │ │ ├── metadata_decoder.cc │ │ ├── metadata_decoder.h │ │ ├── metadata_decoder_test.cc │ │ ├── quic_header_list.cc │ │ ├── quic_header_list.h │ │ ├── quic_header_list_test.cc │ │ ├── quic_headers_stream.cc │ │ ├── quic_headers_stream.h │ │ ├── quic_headers_stream_test.cc │ │ ├── quic_receive_control_stream.cc │ │ ├── quic_receive_control_stream.h │ │ ├── quic_receive_control_stream_test.cc │ │ ├── quic_send_control_stream.cc │ │ ├── quic_send_control_stream.h │ │ ├── quic_send_control_stream_test.cc │ │ ├── quic_server_initiated_spdy_stream.cc │ │ ├── quic_server_initiated_spdy_stream.h │ │ ├── quic_server_session_base.cc │ │ ├── quic_server_session_base.h │ │ ├── quic_server_session_base_test.cc │ │ ├── quic_spdy_client_session.cc │ │ ├── quic_spdy_client_session.h │ │ ├── quic_spdy_client_session_base.cc │ │ ├── quic_spdy_client_session_base.h │ │ ├── quic_spdy_client_session_test.cc │ │ ├── quic_spdy_client_stream.cc │ │ ├── quic_spdy_client_stream.h │ │ ├── quic_spdy_client_stream_test.cc │ │ ├── quic_spdy_server_stream_base.cc │ │ ├── quic_spdy_server_stream_base.h │ │ ├── quic_spdy_server_stream_base_test.cc │ │ ├── quic_spdy_session.cc │ │ ├── quic_spdy_session.h │ │ ├── quic_spdy_session_test.cc │ │ ├── quic_spdy_stream.cc │ │ ├── quic_spdy_stream.h │ │ ├── quic_spdy_stream_body_manager.cc │ │ ├── quic_spdy_stream_body_manager.h │ │ ├── quic_spdy_stream_body_manager_test.cc │ │ ├── quic_spdy_stream_test.cc │ │ ├── spdy_utils.cc │ │ ├── spdy_utils.h │ │ ├── spdy_utils_test.cc │ │ ├── web_transport_http3.cc │ │ ├── web_transport_http3.h │ │ ├── web_transport_http3_test.cc │ │ ├── web_transport_stream_adapter.cc │ │ └── web_transport_stream_adapter.h │ ├── io │ │ ├── event_loop_connecting_client_socket.cc │ │ ├── event_loop_connecting_client_socket.h │ │ ├── event_loop_connecting_client_socket_test.cc │ │ ├── event_loop_socket_factory.cc │ │ ├── event_loop_socket_factory.h │ │ ├── quic_all_event_loops_test.cc │ │ ├── quic_default_event_loop.cc │ │ ├── quic_default_event_loop.h │ │ ├── quic_event_loop.h │ │ ├── quic_poll_event_loop.cc │ │ ├── quic_poll_event_loop.h │ │ ├── quic_poll_event_loop_test.cc │ │ ├── quic_server_io_harness.cc │ │ ├── quic_server_io_harness.h │ │ ├── socket.cc │ │ ├── socket.h │ │ ├── socket_internal.h │ │ ├── socket_posix.inc │ │ ├── socket_test.cc │ │ └── socket_win.inc │ ├── legacy_quic_stream_id_manager.cc │ ├── legacy_quic_stream_id_manager.h │ ├── legacy_quic_stream_id_manager_test.cc │ ├── packet_number_indexed_queue.h │ ├── packet_number_indexed_queue_test.cc │ ├── proto │ │ ├── cached_network_parameters.proto │ │ ├── cached_network_parameters_proto.h │ │ ├── crypto_server_config.proto │ │ ├── crypto_server_config_proto.h │ │ ├── source_address_token.proto │ │ └── source_address_token_proto.h │ ├── qpack │ │ ├── fuzzer │ │ │ ├── qpack_decoder_fuzzer.cc │ │ │ ├── qpack_decoder_stream_receiver_fuzzer.cc │ │ │ ├── qpack_decoder_stream_sender_fuzzer.cc │ │ │ ├── qpack_encoder_stream_receiver_fuzzer.cc │ │ │ ├── qpack_encoder_stream_sender_fuzzer.cc │ │ │ └── qpack_round_trip_fuzzer.cc │ │ ├── new_qpack_blocking_manager.cc │ │ ├── new_qpack_blocking_manager.h │ │ ├── new_qpack_blocking_manager_test.cc │ │ ├── qpack_decoded_headers_accumulator.cc │ │ ├── qpack_decoded_headers_accumulator.h │ │ ├── qpack_decoded_headers_accumulator_test.cc │ │ ├── qpack_decoder.cc │ │ ├── qpack_decoder.h │ │ ├── qpack_decoder_stream_receiver.cc │ │ ├── qpack_decoder_stream_receiver.h │ │ ├── qpack_decoder_stream_receiver_test.cc │ │ ├── qpack_decoder_stream_sender.cc │ │ ├── qpack_decoder_stream_sender.h │ │ ├── qpack_decoder_stream_sender_test.cc │ │ ├── qpack_decoder_test.cc │ │ ├── qpack_encoder.cc │ │ ├── qpack_encoder.h │ │ ├── qpack_encoder_stream_receiver.cc │ │ ├── qpack_encoder_stream_receiver.h │ │ ├── qpack_encoder_stream_receiver_test.cc │ │ ├── qpack_encoder_stream_sender.cc │ │ ├── qpack_encoder_stream_sender.h │ │ ├── qpack_encoder_stream_sender_test.cc │ │ ├── qpack_encoder_test.cc │ │ ├── qpack_header_table.cc │ │ ├── qpack_header_table.h │ │ ├── qpack_header_table_test.cc │ │ ├── qpack_index_conversions.cc │ │ ├── qpack_index_conversions.h │ │ ├── qpack_index_conversions_test.cc │ │ ├── qpack_instruction_decoder.cc │ │ ├── qpack_instruction_decoder.h │ │ ├── qpack_instruction_decoder_test.cc │ │ ├── qpack_instruction_encoder.cc │ │ ├── qpack_instruction_encoder.h │ │ ├── qpack_instruction_encoder_test.cc │ │ ├── qpack_instructions.cc │ │ ├── qpack_instructions.h │ │ ├── qpack_progressive_decoder.cc │ │ ├── qpack_progressive_decoder.h │ │ ├── qpack_receive_stream.cc │ │ ├── qpack_receive_stream.h │ │ ├── qpack_receive_stream_test.cc │ │ ├── qpack_required_insert_count.cc │ │ ├── qpack_required_insert_count.h │ │ ├── qpack_required_insert_count_test.cc │ │ ├── qpack_round_trip_test.cc │ │ ├── qpack_send_stream.cc │ │ ├── qpack_send_stream.h │ │ ├── qpack_send_stream_test.cc │ │ ├── qpack_static_table.cc │ │ ├── qpack_static_table.h │ │ ├── qpack_static_table_test.cc │ │ ├── qpack_stream_receiver.h │ │ ├── qpack_stream_sender_delegate.h │ │ ├── value_splitting_header_list.cc │ │ ├── value_splitting_header_list.h │ │ └── value_splitting_header_list_test.cc │ ├── quic_ack_listener_interface.cc │ ├── quic_ack_listener_interface.h │ ├── quic_alarm.cc │ ├── quic_alarm.h │ ├── quic_alarm_factory.h │ ├── quic_alarm_factory_proxy.h │ ├── quic_alarm_test.cc │ ├── quic_arena_scoped_ptr.h │ ├── quic_arena_scoped_ptr_test.cc │ ├── quic_bandwidth.cc │ ├── quic_bandwidth.h │ ├── quic_bandwidth_test.cc │ ├── quic_blocked_writer_interface.h │ ├── quic_blocked_writer_list.cc │ ├── quic_blocked_writer_list.h │ ├── quic_blocked_writer_list_test.cc │ ├── quic_buffered_packet_store.cc │ ├── quic_buffered_packet_store.h │ ├── quic_buffered_packet_store_test.cc │ ├── quic_chaos_protector.cc │ ├── quic_chaos_protector.h │ ├── quic_chaos_protector_test.cc │ ├── quic_clock.h │ ├── quic_coalesced_packet.cc │ ├── quic_coalesced_packet.h │ ├── quic_coalesced_packet_test.cc │ ├── quic_config.cc │ ├── quic_config.h │ ├── quic_config_test.cc │ ├── quic_connection.cc │ ├── quic_connection.h │ ├── quic_connection_alarms.cc │ ├── quic_connection_alarms.h │ ├── quic_connection_alarms_test.cc │ ├── quic_connection_context.cc │ ├── quic_connection_context.h │ ├── quic_connection_context_test.cc │ ├── quic_connection_id.cc │ ├── quic_connection_id.h │ ├── quic_connection_id_manager.cc │ ├── quic_connection_id_manager.h │ ├── quic_connection_id_manager_test.cc │ ├── quic_connection_id_test.cc │ ├── quic_connection_stats.cc │ ├── quic_connection_stats.h │ ├── quic_connection_test.cc │ ├── quic_constants.cc │ ├── quic_constants.h │ ├── quic_control_frame_manager.cc │ ├── quic_control_frame_manager.h │ ├── quic_control_frame_manager_test.cc │ ├── quic_crypto_client_handshaker.cc │ ├── quic_crypto_client_handshaker.h │ ├── quic_crypto_client_handshaker_test.cc │ ├── quic_crypto_client_stream.cc │ ├── quic_crypto_client_stream.h │ ├── quic_crypto_client_stream_test.cc │ ├── quic_crypto_handshaker.cc │ ├── quic_crypto_handshaker.h │ ├── quic_crypto_server_stream.cc │ ├── quic_crypto_server_stream.h │ ├── quic_crypto_server_stream_base.cc │ ├── quic_crypto_server_stream_base.h │ ├── quic_crypto_server_stream_test.cc │ ├── quic_crypto_stream.cc │ ├── quic_crypto_stream.h │ ├── quic_crypto_stream_test.cc │ ├── quic_data_reader.cc │ ├── quic_data_reader.h │ ├── quic_data_writer.cc │ ├── quic_data_writer.h │ ├── quic_data_writer_test.cc │ ├── quic_datagram_queue.cc │ ├── quic_datagram_queue.h │ ├── quic_datagram_queue_test.cc │ ├── quic_default_clock.cc │ ├── quic_default_clock.h │ ├── quic_default_connection_helper.h │ ├── quic_default_packet_writer.cc │ ├── quic_default_packet_writer.h │ ├── quic_dispatcher.cc │ ├── quic_dispatcher.h │ ├── quic_dispatcher_stats.cc │ ├── quic_dispatcher_stats.h │ ├── quic_dispatcher_test.cc │ ├── quic_error_codes.cc │ ├── quic_error_codes.h │ ├── quic_error_codes_test.cc │ ├── quic_flow_controller.cc │ ├── quic_flow_controller.h │ ├── quic_flow_controller_test.cc │ ├── quic_framer.cc │ ├── quic_framer.h │ ├── quic_framer_test.cc │ ├── quic_generic_session.cc │ ├── quic_generic_session.h │ ├── quic_generic_session_test.cc │ ├── quic_idle_network_detector.cc │ ├── quic_idle_network_detector.h │ ├── quic_idle_network_detector_test.cc │ ├── quic_inlined_string_view.h │ ├── quic_inlined_string_view_test.cc │ ├── quic_interval.h │ ├── quic_interval_deque.h │ ├── quic_interval_deque_test.cc │ ├── quic_interval_set.h │ ├── quic_interval_set_test.cc │ ├── quic_interval_test.cc │ ├── quic_linux_socket_utils.cc │ ├── quic_linux_socket_utils.h │ ├── quic_linux_socket_utils_test.cc │ ├── quic_lru_cache.h │ ├── quic_lru_cache_test.cc │ ├── quic_mtu_discovery.cc │ ├── quic_mtu_discovery.h │ ├── quic_network_blackhole_detector.cc │ ├── quic_network_blackhole_detector.h │ ├── quic_network_blackhole_detector_test.cc │ ├── quic_one_block_arena.h │ ├── quic_one_block_arena_test.cc │ ├── quic_packet_creator.cc │ ├── quic_packet_creator.h │ ├── quic_packet_creator_test.cc │ ├── quic_packet_number.cc │ ├── quic_packet_number.h │ ├── quic_packet_number_test.cc │ ├── quic_packet_reader.cc │ ├── quic_packet_reader.h │ ├── quic_packet_writer.h │ ├── quic_packet_writer_wrapper.cc │ ├── quic_packet_writer_wrapper.h │ ├── quic_packets.cc │ ├── quic_packets.h │ ├── quic_packets_test.cc │ ├── quic_path_validator.cc │ ├── quic_path_validator.h │ ├── quic_path_validator_test.cc │ ├── quic_ping_manager.cc │ ├── quic_ping_manager.h │ ├── quic_ping_manager_test.cc │ ├── quic_process_packet_interface.h │ ├── quic_queue_alarm_factory.cc │ ├── quic_queue_alarm_factory.h │ ├── quic_received_packet_manager.cc │ ├── quic_received_packet_manager.h │ ├── quic_received_packet_manager_test.cc │ ├── quic_sent_packet_manager.cc │ ├── quic_sent_packet_manager.h │ ├── quic_sent_packet_manager_test.cc │ ├── quic_server_id.cc │ ├── quic_server_id.h │ ├── quic_server_id_test.cc │ ├── quic_session.cc │ ├── quic_session.h │ ├── quic_session_test.cc │ ├── quic_socket_address_coder.cc │ ├── quic_socket_address_coder.h │ ├── quic_socket_address_coder_test.cc │ ├── quic_stream.cc │ ├── quic_stream.h │ ├── quic_stream_frame_data_producer.h │ ├── quic_stream_id_manager.cc │ ├── quic_stream_id_manager.h │ ├── quic_stream_id_manager_test.cc │ ├── quic_stream_priority.cc │ ├── quic_stream_priority.h │ ├── quic_stream_priority_test.cc │ ├── quic_stream_send_buffer.cc │ ├── quic_stream_send_buffer.h │ ├── quic_stream_send_buffer_base.cc │ ├── quic_stream_send_buffer_base.h │ ├── quic_stream_send_buffer_inlining.cc │ ├── quic_stream_send_buffer_inlining.h │ ├── quic_stream_send_buffer_test.cc │ ├── quic_stream_sequencer.cc │ ├── quic_stream_sequencer.h │ ├── quic_stream_sequencer_buffer.cc │ ├── quic_stream_sequencer_buffer.h │ ├── quic_stream_sequencer_buffer_test.cc │ ├── quic_stream_sequencer_test.cc │ ├── quic_stream_test.cc │ ├── quic_sustained_bandwidth_recorder.cc │ ├── quic_sustained_bandwidth_recorder.h │ ├── quic_sustained_bandwidth_recorder_test.cc │ ├── quic_syscall_wrapper.cc │ ├── quic_syscall_wrapper.h │ ├── quic_tag.cc │ ├── quic_tag.h │ ├── quic_tag_test.cc │ ├── quic_time.cc │ ├── quic_time.h │ ├── quic_time_accumulator.h │ ├── quic_time_accumulator_test.cc │ ├── quic_time_test.cc │ ├── quic_time_wait_list_manager.cc │ ├── quic_time_wait_list_manager.h │ ├── quic_time_wait_list_manager_test.cc │ ├── quic_trace_visitor.cc │ ├── quic_trace_visitor.h │ ├── quic_trace_visitor_test.cc │ ├── quic_transmission_info.cc │ ├── quic_transmission_info.h │ ├── quic_types.cc │ ├── quic_types.h │ ├── quic_udp_socket.cc │ ├── quic_udp_socket.h │ ├── quic_udp_socket_posix.inc │ ├── quic_udp_socket_test.cc │ ├── quic_udp_socket_win.inc │ ├── quic_unacked_packet_map.cc │ ├── quic_unacked_packet_map.h │ ├── quic_unacked_packet_map_test.cc │ ├── quic_utils.cc │ ├── quic_utils.h │ ├── quic_utils_test.cc │ ├── quic_version_manager.cc │ ├── quic_version_manager.h │ ├── quic_version_manager_test.cc │ ├── quic_versions.cc │ ├── quic_versions.h │ ├── quic_versions_test.cc │ ├── quic_write_blocked_list.cc │ ├── quic_write_blocked_list.h │ ├── quic_write_blocked_list_test.cc │ ├── session_notifier_interface.h │ ├── socket_factory.h │ ├── stream_delegate_interface.h │ ├── tls_chlo_extractor.cc │ ├── tls_chlo_extractor.h │ ├── tls_chlo_extractor_test.cc │ ├── tls_client_handshaker.cc │ ├── tls_client_handshaker.h │ ├── tls_client_handshaker_test.cc │ ├── tls_handshaker.cc │ ├── tls_handshaker.h │ ├── tls_server_handshaker.cc │ ├── tls_server_handshaker.h │ ├── tls_server_handshaker_test.cc │ ├── uber_quic_stream_id_manager.cc │ ├── uber_quic_stream_id_manager.h │ ├── uber_quic_stream_id_manager_test.cc │ ├── uber_received_packet_manager.cc │ ├── uber_received_packet_manager.h │ ├── uber_received_packet_manager_test.cc │ ├── web_transport_interface.h │ ├── web_transport_stats.cc │ ├── web_transport_stats.h │ ├── web_transport_write_blocked_list.cc │ ├── web_transport_write_blocked_list.h │ └── web_transport_write_blocked_list_test.cc ├── load_balancer │ ├── load_balancer_config.cc │ ├── load_balancer_config.h │ ├── load_balancer_config_test.cc │ ├── load_balancer_decoder.cc │ ├── load_balancer_decoder.h │ ├── load_balancer_decoder_test.cc │ ├── load_balancer_encoder.cc │ ├── load_balancer_encoder.h │ ├── load_balancer_encoder_test.cc │ ├── load_balancer_server_id.cc │ ├── load_balancer_server_id.h │ ├── load_balancer_server_id_map.h │ ├── load_balancer_server_id_map_test.cc │ └── load_balancer_server_id_test.cc ├── masque │ ├── README.md │ ├── masque_client.cc │ ├── masque_client.h │ ├── masque_client_bin.cc │ ├── masque_client_session.cc │ ├── masque_client_session.h │ ├── masque_client_tools.cc │ ├── masque_client_tools.h │ ├── masque_connection_pool.cc │ ├── masque_connection_pool.h │ ├── masque_dispatcher.cc │ ├── masque_dispatcher.h │ ├── masque_encapsulated_client.cc │ ├── masque_encapsulated_client.h │ ├── masque_encapsulated_client_session.cc │ ├── masque_encapsulated_client_session.h │ ├── masque_h2_connection.cc │ ├── masque_h2_connection.h │ ├── masque_ohttp_client_bin.cc │ ├── masque_server.cc │ ├── masque_server.h │ ├── masque_server_backend.cc │ ├── masque_server_backend.h │ ├── masque_server_bin.cc │ ├── masque_server_session.cc │ ├── masque_server_session.h │ ├── masque_tcp_client_bin.cc │ ├── masque_tcp_server_bin.cc │ ├── masque_utils.cc │ └── masque_utils.h ├── moqt │ ├── moqt_bitrate_adjuster.cc │ ├── moqt_bitrate_adjuster.h │ ├── moqt_bitrate_adjuster_test.cc │ ├── moqt_cached_object.cc │ ├── moqt_cached_object.h │ ├── moqt_failed_fetch.h │ ├── moqt_framer.cc │ ├── moqt_framer.h │ ├── moqt_framer_test.cc │ ├── moqt_integration_test.cc │ ├── moqt_known_track_publisher.cc │ ├── moqt_known_track_publisher.h │ ├── moqt_live_relay_queue.cc │ ├── moqt_live_relay_queue.h │ ├── moqt_live_relay_queue_test.cc │ ├── moqt_messages.cc │ ├── moqt_messages.h │ ├── moqt_messages_test.cc │ ├── moqt_outgoing_queue.cc │ ├── moqt_outgoing_queue.h │ ├── moqt_outgoing_queue_test.cc │ ├── moqt_parser.cc │ ├── moqt_parser.h │ ├── moqt_parser_test.cc │ ├── moqt_priority.cc │ ├── moqt_priority.h │ ├── moqt_priority_test.cc │ ├── moqt_probe_manager.cc │ ├── moqt_probe_manager.h │ ├── moqt_probe_manager_test.cc │ ├── moqt_publisher.h │ ├── moqt_session.cc │ ├── moqt_session.h │ ├── moqt_session_callbacks.h │ ├── moqt_session_interface.h │ ├── moqt_session_test.cc │ ├── moqt_subscribe_windows.cc │ ├── moqt_subscribe_windows.h │ ├── moqt_subscribe_windows_test.cc │ ├── moqt_track.cc │ ├── moqt_track.h │ ├── moqt_track_test.cc │ ├── test_tools │ │ ├── mock_moqt_session.cc │ │ ├── mock_moqt_session.h │ │ ├── mock_moqt_session_test.cc │ │ ├── moqt_framer_utils.cc │ │ ├── moqt_framer_utils.h │ │ ├── moqt_session_peer.h │ │ ├── moqt_simulator_harness.cc │ │ ├── moqt_simulator_harness.h │ │ └── moqt_test_message.h │ └── tools │ │ ├── chat_client.cc │ │ ├── chat_client.h │ │ ├── chat_client_bin.cc │ │ ├── chat_server.cc │ │ ├── chat_server.h │ │ ├── chat_server_bin.cc │ │ ├── moq_chat.cc │ │ ├── moq_chat.h │ │ ├── moq_chat_end_to_end_test.cc │ │ ├── moq_chat_test.cc │ │ ├── moqt_client.cc │ │ ├── moqt_client.h │ │ ├── moqt_end_to_end_test.cc │ │ ├── moqt_ingestion_server_bin.cc │ │ ├── moqt_mock_visitor.h │ │ ├── moqt_server.cc │ │ ├── moqt_server.h │ │ ├── moqt_server_test.cc │ │ └── moqt_simulator_bin.cc ├── platform │ ├── README.md │ └── api │ │ ├── quic_bug_tracker.h │ │ ├── quic_client_stats.h │ │ ├── quic_default_proof_providers.h │ │ ├── quic_expect_bug.h │ │ ├── quic_export.h │ │ ├── quic_exported_stats.h │ │ ├── quic_flag_utils.h │ │ ├── quic_flags.h │ │ ├── quic_hostname_utils.h │ │ ├── quic_ip_address.h │ │ ├── quic_ip_address_family.h │ │ ├── quic_logging.h │ │ ├── quic_server_stats.h │ │ ├── quic_socket_address.h │ │ ├── quic_stack_trace.h │ │ ├── quic_test.h │ │ ├── quic_test_loopback.h │ │ ├── quic_test_output.h │ │ ├── quic_testvalue.h │ │ ├── quic_thread.h │ │ └── quic_udp_socket_platform_api.h ├── qbone │ ├── bonnet │ │ ├── icmp_reachable.cc │ │ ├── icmp_reachable.h │ │ ├── icmp_reachable_interface.h │ │ ├── icmp_reachable_test.cc │ │ ├── mock_icmp_reachable.h │ │ ├── mock_packet_exchanger_stats_interface.h │ │ ├── mock_qbone_tunnel.h │ │ ├── mock_tun_device.h │ │ ├── mock_tun_device_controller.h │ │ ├── qbone_tunnel_info.cc │ │ ├── qbone_tunnel_info.h │ │ ├── qbone_tunnel_interface.h │ │ ├── tun_device.cc │ │ ├── tun_device.h │ │ ├── tun_device_controller.cc │ │ ├── tun_device_controller.h │ │ ├── tun_device_controller_test.cc │ │ ├── tun_device_interface.h │ │ ├── tun_device_packet_exchanger.cc │ │ ├── tun_device_packet_exchanger.h │ │ ├── tun_device_packet_exchanger_test.cc │ │ └── tun_device_test.cc │ ├── mock_qbone_client.h │ ├── mock_qbone_server_session.h │ ├── platform │ │ ├── icmp_packet.cc │ │ ├── icmp_packet.h │ │ ├── icmp_packet_test.cc │ │ ├── ip_range.cc │ │ ├── ip_range.h │ │ ├── ip_range_test.cc │ │ ├── kernel_interface.h │ │ ├── mock_kernel.h │ │ ├── mock_netlink.h │ │ ├── netlink.cc │ │ ├── netlink.h │ │ ├── netlink_interface.h │ │ ├── netlink_test.cc │ │ ├── rtnetlink_message.cc │ │ ├── rtnetlink_message.h │ │ ├── rtnetlink_message_test.cc │ │ ├── tcp_packet.cc │ │ ├── tcp_packet.h │ │ └── tcp_packet_test.cc │ ├── qbone_client.cc │ ├── qbone_client.h │ ├── qbone_client_interface.h │ ├── qbone_client_session.cc │ ├── qbone_client_session.h │ ├── qbone_client_test.cc │ ├── qbone_constants.cc │ ├── qbone_constants.h │ ├── qbone_control.proto │ ├── qbone_control_placeholder.proto │ ├── qbone_control_stream.cc │ ├── qbone_control_stream.h │ ├── qbone_packet_exchanger.cc │ ├── qbone_packet_exchanger.h │ ├── qbone_packet_exchanger_test.cc │ ├── qbone_packet_processor.cc │ ├── qbone_packet_processor.h │ ├── qbone_packet_processor_test.cc │ ├── qbone_packet_processor_test_tools.cc │ ├── qbone_packet_processor_test_tools.h │ ├── qbone_packet_writer.h │ ├── qbone_server_session.cc │ ├── qbone_server_session.h │ ├── qbone_session_base.cc │ ├── qbone_session_base.h │ ├── qbone_session_test.cc │ ├── qbone_stream.cc │ ├── qbone_stream.h │ └── qbone_stream_test.cc ├── test_tools │ ├── bad_packet_writer.cc │ ├── bad_packet_writer.h │ ├── crypto_test_utils.cc │ ├── crypto_test_utils.h │ ├── crypto_test_utils_test.cc │ ├── failing_proof_source.cc │ ├── failing_proof_source.h │ ├── fake_proof_source.cc │ ├── fake_proof_source.h │ ├── fake_proof_source_handle.cc │ ├── fake_proof_source_handle.h │ ├── first_flight.cc │ ├── first_flight.h │ ├── fuzzing │ │ ├── README.md │ │ ├── quic_framer_fuzzer.cc │ │ └── quic_framer_process_data_packet_fuzzer.cc │ ├── limited_mtu_test_writer.cc │ ├── limited_mtu_test_writer.h │ ├── mock_clock.cc │ ├── mock_clock.h │ ├── mock_connection_id_generator.h │ ├── mock_load_balancer_encoder.h │ ├── mock_quic_connection_alarms.h │ ├── mock_quic_dispatcher.cc │ ├── mock_quic_dispatcher.h │ ├── mock_quic_session_visitor.cc │ ├── mock_quic_session_visitor.h │ ├── mock_quic_spdy_client_stream.cc │ ├── mock_quic_spdy_client_stream.h │ ├── mock_quic_time_wait_list_manager.cc │ ├── mock_quic_time_wait_list_manager.h │ ├── mock_random.cc │ ├── mock_random.h │ ├── packet_dropping_test_writer.cc │ ├── packet_dropping_test_writer.h │ ├── packet_reordering_writer.cc │ ├── packet_reordering_writer.h │ ├── qpack │ │ ├── qpack_decoder_test_utils.cc │ │ ├── qpack_decoder_test_utils.h │ │ ├── qpack_encoder_peer.cc │ │ ├── qpack_encoder_peer.h │ │ ├── qpack_offline_decoder.cc │ │ ├── qpack_offline_decoder.h │ │ ├── qpack_test_utils.cc │ │ └── qpack_test_utils.h │ ├── quic_buffered_packet_store_peer.cc │ ├── quic_buffered_packet_store_peer.h │ ├── quic_client_session_cache_peer.h │ ├── quic_coalesced_packet_peer.cc │ ├── quic_coalesced_packet_peer.h │ ├── quic_config_peer.cc │ ├── quic_config_peer.h │ ├── quic_connection_id_manager_peer.h │ ├── quic_connection_peer.cc │ ├── quic_connection_peer.h │ ├── quic_crypto_server_config_peer.cc │ ├── quic_crypto_server_config_peer.h │ ├── quic_dispatcher_peer.cc │ ├── quic_dispatcher_peer.h │ ├── quic_flow_controller_peer.cc │ ├── quic_flow_controller_peer.h │ ├── quic_framer_peer.cc │ ├── quic_framer_peer.h │ ├── quic_http_response_cache_data │ │ └── test.example.com │ │ │ ├── index.html │ │ │ └── map.html │ ├── quic_interval_deque_peer.h │ ├── quic_mock_syscall_wrapper.cc │ ├── quic_mock_syscall_wrapper.h │ ├── quic_packet_creator_peer.cc │ ├── quic_packet_creator_peer.h │ ├── quic_path_validator_peer.cc │ ├── quic_path_validator_peer.h │ ├── quic_sent_packet_manager_peer.cc │ ├── quic_sent_packet_manager_peer.h │ ├── quic_server_peer.cc │ ├── quic_server_peer.h │ ├── quic_server_session_base_peer.h │ ├── quic_session_peer.cc │ ├── quic_session_peer.h │ ├── quic_spdy_session_peer.cc │ ├── quic_spdy_session_peer.h │ ├── quic_spdy_stream_peer.cc │ ├── quic_spdy_stream_peer.h │ ├── quic_stream_id_manager_peer.cc │ ├── quic_stream_id_manager_peer.h │ ├── quic_stream_peer.cc │ ├── quic_stream_peer.h │ ├── quic_stream_send_buffer_peer.cc │ ├── quic_stream_send_buffer_peer.h │ ├── quic_stream_sequencer_buffer_peer.cc │ ├── quic_stream_sequencer_buffer_peer.h │ ├── quic_stream_sequencer_peer.cc │ ├── quic_stream_sequencer_peer.h │ ├── quic_sustained_bandwidth_recorder_peer.cc │ ├── quic_sustained_bandwidth_recorder_peer.h │ ├── quic_test_backend.cc │ ├── quic_test_backend.h │ ├── quic_test_client.cc │ ├── quic_test_client.h │ ├── quic_test_server.cc │ ├── quic_test_server.h │ ├── quic_test_utils.cc │ ├── quic_test_utils.h │ ├── quic_test_utils_test.cc │ ├── quic_time_wait_list_manager_peer.cc │ ├── quic_time_wait_list_manager_peer.h │ ├── quic_unacked_packet_map_peer.cc │ ├── quic_unacked_packet_map_peer.h │ ├── rtt_stats_peer.cc │ ├── rtt_stats_peer.h │ ├── send_algorithm_test_result.proto │ ├── send_algorithm_test_utils.cc │ ├── send_algorithm_test_utils.h │ ├── server_thread.cc │ ├── server_thread.h │ ├── simple_data_producer.cc │ ├── simple_data_producer.h │ ├── simple_quic_framer.cc │ ├── simple_quic_framer.h │ ├── simple_session_cache.cc │ ├── simple_session_cache.h │ ├── simple_session_notifier.cc │ ├── simple_session_notifier.h │ ├── simple_session_notifier_test.cc │ ├── simulator │ │ ├── README.md │ │ ├── actor.cc │ │ ├── actor.h │ │ ├── alarm_factory.cc │ │ ├── alarm_factory.h │ │ ├── link.cc │ │ ├── link.h │ │ ├── packet_filter.cc │ │ ├── packet_filter.h │ │ ├── port.cc │ │ ├── port.h │ │ ├── queue.cc │ │ ├── queue.h │ │ ├── quic_endpoint.cc │ │ ├── quic_endpoint.h │ │ ├── quic_endpoint_base.cc │ │ ├── quic_endpoint_base.h │ │ ├── quic_endpoint_test.cc │ │ ├── simulator.cc │ │ ├── simulator.h │ │ ├── simulator_test.cc │ │ ├── switch.cc │ │ ├── switch.h │ │ ├── test_harness.cc │ │ ├── test_harness.h │ │ ├── traffic_policer.cc │ │ └── traffic_policer.h │ ├── test_certificates.cc │ ├── test_certificates.h │ ├── test_ip_packets.cc │ ├── test_ip_packets.h │ ├── test_ip_packets_test.cc │ ├── test_ticket_crypter.cc │ ├── test_ticket_crypter.h │ ├── web_transport_resets_backend.cc │ ├── web_transport_resets_backend.h │ └── web_transport_test_tools.h └── tools │ ├── connect_server_backend.cc │ ├── connect_server_backend.h │ ├── connect_tunnel.cc │ ├── connect_tunnel.h │ ├── connect_tunnel_test.cc │ ├── connect_udp_tunnel.cc │ ├── connect_udp_tunnel.h │ ├── connect_udp_tunnel_test.cc │ ├── crypto_message_printer_bin.cc │ ├── devious_baton.cc │ ├── devious_baton.h │ ├── fake_proof_verifier.h │ ├── interactive_cli.cc │ ├── interactive_cli.h │ ├── interactive_cli_demo_bin.cc │ ├── qpack_offline_decoder_bin.cc │ ├── quic_backend_response.cc │ ├── quic_backend_response.h │ ├── quic_client_base.cc │ ├── quic_client_base.h │ ├── quic_client_bin.cc │ ├── quic_client_default_network_helper.cc │ ├── quic_client_default_network_helper.h │ ├── quic_client_factory.h │ ├── quic_client_interop_test_bin.cc │ ├── quic_default_client.cc │ ├── quic_default_client.h │ ├── quic_default_client_test.cc │ ├── quic_epoll_client_factory.cc │ ├── quic_epoll_client_factory.h │ ├── quic_event_loop_tools.h │ ├── quic_memory_cache_backend.cc │ ├── quic_memory_cache_backend.h │ ├── quic_memory_cache_backend_test.cc │ ├── quic_name_lookup.cc │ ├── quic_name_lookup.h │ ├── quic_packet_printer_bin.cc │ ├── quic_reject_reason_decoder_bin.cc │ ├── quic_server.cc │ ├── quic_server.h │ ├── quic_server_bin.cc │ ├── quic_server_factory.cc │ ├── quic_server_factory.h │ ├── quic_server_test.cc │ ├── quic_simple_client_session.cc │ ├── quic_simple_client_session.h │ ├── quic_simple_client_stream.cc │ ├── quic_simple_client_stream.h │ ├── quic_simple_crypto_server_stream_helper.cc │ ├── quic_simple_crypto_server_stream_helper.h │ ├── quic_simple_dispatcher.cc │ ├── quic_simple_dispatcher.h │ ├── quic_simple_server_backend.h │ ├── quic_simple_server_session.cc │ ├── quic_simple_server_session.h │ ├── quic_simple_server_session_test.cc │ ├── quic_simple_server_stream.cc │ ├── quic_simple_server_stream.h │ ├── quic_simple_server_stream_test.cc │ ├── quic_spdy_client_base.cc │ ├── quic_spdy_client_base.h │ ├── quic_spdy_server_base.h │ ├── quic_tcp_like_trace_converter.cc │ ├── quic_tcp_like_trace_converter.h │ ├── quic_tcp_like_trace_converter_test.cc │ ├── quic_toy_client.cc │ ├── quic_toy_client.h │ ├── quic_toy_server.cc │ ├── quic_toy_server.h │ ├── quic_url.cc │ ├── quic_url.h │ ├── quic_url_test.cc │ ├── simple_ticket_crypter.cc │ ├── simple_ticket_crypter.h │ ├── simple_ticket_crypter_test.cc │ ├── web_transport_only_backend.cc │ ├── web_transport_only_backend.h │ ├── web_transport_test_server.cc │ └── web_transport_test_visitors.h └── web_transport ├── complete_buffer_visitor.cc ├── complete_buffer_visitor.h ├── encapsulated ├── encapsulated_web_transport.cc ├── encapsulated_web_transport.h └── encapsulated_web_transport_test.cc ├── test_tools ├── in_memory_stream.cc ├── in_memory_stream.h ├── in_memory_stream_test.cc └── mock_web_transport.h ├── web_transport.h ├── web_transport_headers.cc ├── web_transport_headers.h ├── web_transport_headers_test.cc ├── web_transport_priority_scheduler.cc ├── web_transport_priority_scheduler.h └── web_transport_priority_scheduler_test.cc /.bazelrc: -------------------------------------------------------------------------------- 1 | # Automatically detect host platform to pick config 2 | common --enable_platform_specific_config 3 | 4 | build --cxxopt=-std=c++17 5 | build --cxxopt=-fno-rtti 6 | 7 | # Enable Abseil/Googletest integration 8 | build --define absl=1 9 | 10 | # Don't fail on converting "0xff" to char 11 | build --copt=-Wno-narrowing 12 | 13 | # There is no system ICU on non-Linux platforms 14 | build:macos --@com_google_googleurl//build_config:system_icu=0 15 | -------------------------------------------------------------------------------- /.bazelversion: -------------------------------------------------------------------------------- 1 | 7.0.0 2 | -------------------------------------------------------------------------------- /BUILD.bazel: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Chromium Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | licenses(["notice"]) 6 | 7 | exports_files(["LICENSE"]) 8 | -------------------------------------------------------------------------------- /WHITESPACE: -------------------------------------------------------------------------------- 1 | Edits in this file will cause a Copybara migration. 2 | 3 | 1 2 3 4 5 6 -------------------------------------------------------------------------------- /build/BUILD.bazel: -------------------------------------------------------------------------------- 1 | # Copyright 2022 The Chromium Authors. All rights reserved. 2 | # Use of this source code is governed by a BSD-style license that can be 3 | # found in the LICENSE file. 4 | 5 | licenses(["notice"]) 6 | 7 | exports_files(["source_list.json"]) 8 | -------------------------------------------------------------------------------- /build/test.bzl: -------------------------------------------------------------------------------- 1 | """Tools for building QUICHE tests.""" 2 | 3 | load("@bazel_skylib//lib:dicts.bzl", "dicts") 4 | load("@bazel_skylib//lib:paths.bzl", "paths") 5 | 6 | def test_suite_from_source_list(name, srcs, **kwargs): 7 | """ 8 | Generates a test target for every individual test source file specified. 9 | 10 | Args: 11 | name: the name of the resulting test_suite target. 12 | srcs: the list of source files from which the test targets are generated. 13 | **kwargs: other arguments that are passed to the cc_test rule directly.s 14 | """ 15 | 16 | tests = [] 17 | for sourcefile in srcs: 18 | if not sourcefile.endswith("_test.cc"): 19 | fail("All source files passed to test_suite_from_source_list() must end with _test.cc") 20 | test_name, _ = paths.split_extension(paths.basename(sourcefile)) 21 | extra_kwargs = {} 22 | if test_name == "end_to_end_test": 23 | extra_kwargs["shard_count"] = 16 24 | native.cc_test( 25 | name = test_name, 26 | srcs = [sourcefile], 27 | **dicts.add(kwargs, extra_kwargs) 28 | ) 29 | tests.append(test_name) 30 | native.test_suite(name = name, tests = tests) 31 | -------------------------------------------------------------------------------- /depstool/go.mod: -------------------------------------------------------------------------------- 1 | module quiche.googlesource.com/quiche/depstool 2 | 3 | go 1.20 4 | 5 | require ( 6 | github.com/bazelbuild/buildtools v0.0.0-20221004120235-7186f635531b 7 | ) 8 | -------------------------------------------------------------------------------- /depstool/go.sum: -------------------------------------------------------------------------------- 1 | github.com/bazelbuild/buildtools v0.0.0-20221004120235-7186f635531b h1:jhiMzJ+8unnLRtV8rpbWBFE9pFNzIqgUTyZU5aA++w8= 2 | github.com/bazelbuild/buildtools v0.0.0-20221004120235-7186f635531b/go.mod h1:689QdV3hBP7Vo9dJMmzhoYIyo/9iMhEmHkJcnaPRCbo= 3 | -------------------------------------------------------------------------------- /quiche/balsa/balsa_headers_sequence.cc: -------------------------------------------------------------------------------- 1 | #include "quiche/balsa/balsa_headers_sequence.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "quiche/balsa/balsa_headers.h" 7 | 8 | namespace quiche { 9 | 10 | void BalsaHeadersSequence::Append(std::unique_ptr headers) { 11 | sequence_.push_back(std::move(headers)); 12 | } 13 | 14 | bool BalsaHeadersSequence::HasNext() const { return next_ < sequence_.size(); } 15 | 16 | BalsaHeaders* BalsaHeadersSequence::PeekNext() { 17 | if (!HasNext()) { 18 | return nullptr; 19 | } 20 | return sequence_[next_].get(); 21 | } 22 | 23 | BalsaHeaders* BalsaHeadersSequence::Next() { 24 | if (!HasNext()) { 25 | return nullptr; 26 | } 27 | return sequence_[next_++].get(); 28 | } 29 | 30 | void BalsaHeadersSequence::Clear() { 31 | sequence_.clear(); 32 | next_ = 0; 33 | } 34 | 35 | } // namespace quiche 36 | -------------------------------------------------------------------------------- /quiche/balsa/framer_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_BALSA_FRAMER_INTERFACE_H_ 6 | #define QUICHE_BALSA_FRAMER_INTERFACE_H_ 7 | 8 | #include 9 | 10 | #include "quiche/common/platform/api/quiche_export.h" 11 | 12 | namespace quiche { 13 | 14 | // A minimal interface supported by BalsaFrame and other framer types. For use 15 | // in HttpReader. 16 | class QUICHE_EXPORT FramerInterface { 17 | public: 18 | virtual ~FramerInterface() {} 19 | virtual size_t ProcessInput(const char* input, size_t length) = 0; 20 | }; 21 | 22 | } // namespace quiche 23 | 24 | #endif // QUICHE_BALSA_FRAMER_INTERFACE_H_ 25 | -------------------------------------------------------------------------------- /quiche/balsa/standard_header_map.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_BALSA_STANDARD_HEADER_MAP_H_ 6 | #define QUICHE_BALSA_STANDARD_HEADER_MAP_H_ 7 | 8 | #include "absl/container/flat_hash_set.h" 9 | #include "absl/strings/string_view.h" 10 | #include "quiche/common/quiche_text_utils.h" 11 | 12 | namespace quiche { 13 | 14 | // This specifies an absl::flat_hash_set with case-insensitive lookup and 15 | // hashing 16 | using StandardHttpHeaderNameSet = 17 | absl::flat_hash_set; 19 | 20 | const StandardHttpHeaderNameSet& GetStandardHeaderSet(); 21 | 22 | } // namespace quiche 23 | 24 | #endif // QUICHE_BALSA_STANDARD_HEADER_MAP_H_ 25 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/blind_sign_auth_protos.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_BLIND_SIGN_AUTH_BLIND_SIGN_AUTH_PROTOS_H_ 2 | #define QUICHE_BLIND_SIGN_AUTH_BLIND_SIGN_AUTH_PROTOS_H_ 3 | 4 | #include "anonymous_tokens/proto/anonymous_tokens.pb.h" // IWYU pragma: export 5 | #include "quiche/blind_sign_auth/proto/auth_and_sign.pb.h" // IWYU pragma: export 6 | #include "quiche/blind_sign_auth/proto/blind_sign_auth_options.pb.h" // IWYU pragma: export 7 | #include "quiche/blind_sign_auth/proto/get_initial_data.pb.h" // IWYU pragma: export 8 | #include "quiche/blind_sign_auth/proto/key_services.pb.h" // IWYU pragma: export 9 | #include "quiche/blind_sign_auth/proto/proxy_layer.pb.h" // IWYU pragma: export 10 | #include "quiche/blind_sign_auth/proto/public_metadata.pb.h" // IWYU pragma: export 11 | #include "quiche/blind_sign_auth/proto/spend_token_data.pb.h" // IWYU pragma: export 12 | #include "anonymous_tokens/proto/anonymous_tokens.pb.h" // IWYU pragma: export 13 | 14 | #endif // QUICHE_BLIND_SIGN_AUTH_BLIND_SIGN_AUTH_PROTOS_H_ 15 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/proto/any.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package quiche.protobuf; 18 | 19 | option java_multiple_files = true; 20 | option java_package = "com.google.privacy.ppn.proto"; 21 | 22 | // Cloned from 23 | // https://github.com/protocolbuffers/protobuf/blob/main/src/google/protobuf/any.proto. 24 | message Any { 25 | string type_url = 1; 26 | 27 | // Must be a valid serialized protocol buffer of the above specified type. 28 | bytes value = 2; 29 | } 30 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/proto/blind_sign_auth_options.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package privacy.ppn; 18 | 19 | message BlindSignAuthOptions { 20 | // Use Privacy Pass crypto library and token formats instead of RSA BSSA. 21 | bool enable_privacy_pass = 1; 22 | } 23 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/proto/key_services.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2023 Google LLC 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // https://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS-IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | 15 | syntax = "proto3"; 16 | 17 | package privacy.ppn; 18 | 19 | option java_multiple_files = true; 20 | option java_package = "com.google.privacy.ppn.proto"; 21 | 22 | // Indicates client's desired or capable key support. 23 | enum KeyType { 24 | reserved 3; 25 | UNKNOWN_KEY_TYPE = 0; 26 | ZINC_KEY_TYPE = 1; 27 | AT_PUBLIC_METADATA_KEY_TYPE = 2; 28 | } 29 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/proto/proxy_layer.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto3"; 2 | 3 | package privacy.ppn; 4 | 5 | option java_multiple_files = true; 6 | option java_package = "com.google.privacy.ppn.proto"; 7 | 8 | // Indicates which proxy layer a set of tokens will be used with. 9 | enum ProxyLayer { 10 | PROXY_LAYER_UNSPECIFIED = 0; 11 | PROXY_A = 1; 12 | PROXY_B = 2; 13 | } 14 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/test_tools/mock_blind_sign_auth_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_BLIND_SIGN_AUTH_TEST_TOOLS_MOCK_BLIND_SIGN_AUTH_INTERFACE_H_ 6 | #define QUICHE_BLIND_SIGN_AUTH_TEST_TOOLS_MOCK_BLIND_SIGN_AUTH_INTERFACE_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "quiche/blind_sign_auth/blind_sign_auth_interface.h" 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | #include "quiche/common/platform/api/quiche_test.h" 14 | 15 | namespace quiche::test { 16 | 17 | class QUICHE_NO_EXPORT MockBlindSignAuthInterface 18 | : public BlindSignAuthInterface { 19 | public: 20 | MOCK_METHOD(void, GetTokens, 21 | (std::optional oauth_token, int num_tokens, 22 | ProxyLayer proxy_layer, BlindSignAuthServiceType service_type, 23 | SignedTokenCallback callback), 24 | (override)); 25 | }; 26 | 27 | } // namespace quiche::test 28 | 29 | #endif // QUICHE_BLIND_SIGN_AUTH_TEST_TOOLS_MOCK_BLIND_SIGN_AUTH_INTERFACE_H_ 30 | -------------------------------------------------------------------------------- /quiche/blind_sign_auth/test_tools/mock_blind_sign_message_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2023 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_BLIND_SIGN_AUTH_TEST_TOOLS_MOCK_BLIND_SIGN_MESSAGE_INTERFACE_H_ 6 | #define QUICHE_BLIND_SIGN_AUTH_TEST_TOOLS_MOCK_BLIND_SIGN_MESSAGE_INTERFACE_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "absl/strings/string_view.h" 12 | #include "quiche/blind_sign_auth/blind_sign_message_interface.h" 13 | #include "quiche/common/platform/api/quiche_export.h" 14 | #include "quiche/common/platform/api/quiche_test.h" 15 | 16 | namespace quiche::test { 17 | 18 | class QUICHE_NO_EXPORT MockBlindSignMessageInterface 19 | : public BlindSignMessageInterface { 20 | public: 21 | MOCK_METHOD(void, DoRequest, 22 | (BlindSignMessageRequestType request_type, 23 | std::optional authorization_header, 24 | const std::string& body, BlindSignMessageCallback callback), 25 | (override)); 26 | }; 27 | 28 | } // namespace quiche::test 29 | 30 | #endif // QUICHE_BLIND_SIGN_AUTH_TEST_TOOLS_MOCK_BLIND_SIGN_MESSAGE_INTERFACE_H_ 31 | -------------------------------------------------------------------------------- /quiche/common/http/http_header_storage_test.cc: -------------------------------------------------------------------------------- 1 | #include "quiche/common/http/http_header_storage.h" 2 | 3 | #include "quiche/common/platform/api/quiche_test.h" 4 | 5 | namespace quiche { 6 | namespace test { 7 | 8 | TEST(JoinTest, JoinEmpty) { 9 | Fragments empty; 10 | absl::string_view separator = ", "; 11 | char buf[10] = ""; 12 | size_t written = Join(buf, empty, separator); 13 | EXPECT_EQ(0u, written); 14 | } 15 | 16 | TEST(JoinTest, JoinOne) { 17 | Fragments v = {"one"}; 18 | absl::string_view separator = ", "; 19 | char buf[15]; 20 | size_t written = Join(buf, v, separator); 21 | EXPECT_EQ(3u, written); 22 | EXPECT_EQ("one", absl::string_view(buf, written)); 23 | } 24 | 25 | TEST(JoinTest, JoinMultiple) { 26 | Fragments v = {"one", "two", "three"}; 27 | absl::string_view separator = ", "; 28 | char buf[15]; 29 | size_t written = Join(buf, v, separator); 30 | EXPECT_EQ(15u, written); 31 | EXPECT_EQ("one, two, three", absl::string_view(buf, written)); 32 | } 33 | 34 | } // namespace test 35 | } // namespace quiche 36 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_bug_tracker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_BUG_TRACKER_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_BUG_TRACKER_H_ 7 | 8 | #include "quiche_platform_impl/quiche_bug_tracker_impl.h" 9 | 10 | #define QUICHE_BUG QUICHE_BUG_IMPL 11 | #define QUICHE_BUG_IF QUICHE_BUG_IF_IMPL 12 | #define QUICHE_PEER_BUG QUICHE_PEER_BUG_IMPL 13 | #define QUICHE_PEER_BUG_IF QUICHE_PEER_BUG_IF_IMPL 14 | 15 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_BUG_TRACKER_H_ 16 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_containers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_CONTAINERS_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_CONTAINERS_H_ 7 | 8 | #include "quiche_platform_impl/quiche_containers_impl.h" 9 | 10 | namespace quiche { 11 | 12 | // An ordered container optimized for small sets. 13 | // An implementation with O(n) mutations might be chosen 14 | // in case it has better memory usage and/or faster access. 15 | // 16 | // DOES NOT GUARANTEE POINTER OR ITERATOR STABILITY! 17 | template > 18 | using QuicheSmallOrderedSet = QuicheSmallOrderedSetImpl; 19 | 20 | } // namespace quiche 21 | 22 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_CONTAINERS_H_ 23 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_event_loop.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUIC_EVENT_LOOP_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUIC_EVENT_LOOP_H_ 7 | 8 | #include "quiche_platform_impl/quiche_event_loop_impl.h" 9 | 10 | namespace quic { 11 | class QuicEventLoopFactory; 12 | } 13 | 14 | namespace quiche { 15 | 16 | inline quic::QuicEventLoopFactory* GetOverrideForDefaultEventLoop() { 17 | return GetOverrideForDefaultEventLoopImpl(); 18 | } 19 | 20 | inline std::vector 21 | GetExtraEventLoopImplementations() { 22 | return GetExtraEventLoopImplementationsImpl(); 23 | } 24 | 25 | } // namespace quiche 26 | 27 | #endif // QUICHE_COMMON_PLATFORM_API_QUIC_EVENT_LOOP_H_ 28 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_expect_bug.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_EXPECT_BUG_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_EXPECT_BUG_H_ 7 | 8 | #include "quiche_platform_impl/quiche_expect_bug_impl.h" 9 | 10 | #define EXPECT_QUICHE_BUG EXPECT_QUICHE_BUG_IMPL 11 | #define EXPECT_QUICHE_PEER_BUG(statement, regex) \ 12 | EXPECT_QUICHE_PEER_BUG_IMPL(statement, regex) 13 | 14 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_EXPECT_BUG_H_ 15 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_export.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_EXPORT_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_EXPORT_H_ 7 | 8 | #include "quiche_platform_impl/quiche_export_impl.h" 9 | 10 | // QUICHE_EXPORT is meant for QUICHE functionality that is built in 11 | // Chromium as part of //net/third_party/quiche component, and not fully 12 | // contained in headers. It is required for Windows DLL builds to work. 13 | #define QUICHE_EXPORT QUICHE_EXPORT_IMPL 14 | 15 | // QUICHE_NO_EXPORT is meant for QUICHE functionality that is either fully 16 | // defined in a header, or is built in Chromium as part of tests or tools. 17 | #define QUICHE_NO_EXPORT QUICHE_NO_EXPORT_IMPL 18 | 19 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_EXPORT_H_ 20 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_flag_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_FLAG_UTILS_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_FLAG_UTILS_H_ 7 | 8 | #include "quiche_platform_impl/quiche_flag_utils_impl.h" 9 | 10 | #define QUICHE_RELOADABLE_FLAG_COUNT QUICHE_RELOADABLE_FLAG_COUNT_IMPL 11 | #define QUICHE_RELOADABLE_FLAG_COUNT_N QUICHE_RELOADABLE_FLAG_COUNT_N_IMPL 12 | 13 | #define QUICHE_RESTART_FLAG_COUNT QUICHE_RESTART_FLAG_COUNT_IMPL 14 | #define QUICHE_RESTART_FLAG_COUNT_N QUICHE_RESTART_FLAG_COUNT_N_IMPL 15 | 16 | #define QUICHE_CODE_COUNT QUICHE_CODE_COUNT_IMPL 17 | #define QUICHE_CODE_COUNT_N QUICHE_CODE_COUNT_N_IMPL 18 | 19 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_FLAG_UTILS_H_ 20 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_googleurl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_GOOGLEURL_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_GOOGLEURL_H_ 7 | 8 | #include "quiche_platform_impl/quiche_googleurl_impl.h" // IWYU pragma: export 9 | 10 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_GOOGLEURL_H_ 11 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_header_policy.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_HEADER_POLICY_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_HEADER_POLICY_H_ 7 | 8 | #include "quiche_platform_impl/quiche_header_policy_impl.h" 9 | 10 | #include "absl/strings/string_view.h" 11 | 12 | namespace quiche { 13 | 14 | // Invoke some platform-specific action based on header key. 15 | inline void QuicheHandleHeaderPolicy(absl::string_view key) { 16 | QuicheHandleHeaderPolicyImpl(key); 17 | } 18 | 19 | } // namespace quiche 20 | 21 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_HEADER_POLICY_H_ 22 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_hostname_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_HOSTNAME_UTILS_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_HOSTNAME_UTILS_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "quiche/common/platform/api/quiche_export.h" 12 | 13 | namespace quiche { 14 | 15 | class QUICHE_EXPORT QuicheHostnameUtils { 16 | public: 17 | QuicheHostnameUtils() = delete; 18 | 19 | // Returns true if the sni is valid, false otherwise. 20 | // (1) disallow IP addresses; 21 | // (2) check that the hostname contains valid characters only; and 22 | // (3) contains at least one dot. 23 | static bool IsValidSNI(absl::string_view sni); 24 | 25 | // Canonicalizes the specified hostname. This involves a wide variety of 26 | // transformations, including lowercasing, removing trailing dots and IDNA 27 | // conversion. 28 | static std::string NormalizeHostname(absl::string_view hostname); 29 | }; 30 | 31 | } // namespace quiche 32 | 33 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_HOSTNAME_UTILS_H_ 34 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_iovec.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_IOVEC_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_IOVEC_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "quiche_platform_impl/quiche_iovec_impl.h" 12 | 13 | // The impl header has to export struct iovec, or a POSIX-compatible polyfill. 14 | // Below, we mostly assert that what we have is appropriate. 15 | static_assert(std::is_standard_layout::value, 16 | "iovec has to be a standard-layout struct"); 17 | 18 | static_assert(offsetof(struct iovec, iov_base) < sizeof(struct iovec), 19 | "iovec has to have iov_base"); 20 | static_assert(offsetof(struct iovec, iov_len) < sizeof(struct iovec), 21 | "iovec has to have iov_len"); 22 | 23 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_IOVEC_H_ 24 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_lower_case_string.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_LOWER_CASE_STRING_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_LOWER_CASE_STRING_H_ 7 | 8 | #include "quiche_platform_impl/quiche_lower_case_string_impl.h" 9 | 10 | namespace quiche { 11 | 12 | using QuicheLowerCaseString = QuicheLowerCaseStringImpl; 13 | 14 | } // namespace quiche 15 | 16 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_LOWER_CASE_STRING_H_ 17 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_lower_case_string_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/common/platform/api/quiche_lower_case_string.h" 6 | 7 | #include "absl/strings/string_view.h" 8 | #include "quiche/common/platform/api/quiche_test.h" 9 | 10 | namespace quiche::test { 11 | namespace { 12 | 13 | TEST(QuicheLowerCaseString, Basic) { 14 | QuicheLowerCaseString empty(""); 15 | EXPECT_EQ("", empty.get()); 16 | 17 | QuicheLowerCaseString from_lower_case("foo"); 18 | EXPECT_EQ("foo", from_lower_case.get()); 19 | 20 | QuicheLowerCaseString from_mixed_case("BaR"); 21 | EXPECT_EQ("bar", from_mixed_case.get()); 22 | 23 | const absl::string_view kData = "FooBar"; 24 | QuicheLowerCaseString from_string_view(kData); 25 | EXPECT_EQ("foobar", from_string_view.get()); 26 | } 27 | 28 | } // namespace 29 | } // namespace quiche::test 30 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_system_event_loop.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_SYSTEM_EVENT_LOOP_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_SYSTEM_EVENT_LOOP_H_ 7 | 8 | #include "quiche_platform_impl/quiche_system_event_loop_impl.h" 9 | 10 | namespace quiche { 11 | 12 | inline void QuicheRunSystemEventLoopIteration() { 13 | QuicheRunSystemEventLoopIterationImpl(); 14 | } 15 | 16 | using QuicheSystemEventLoop = QuicheSystemEventLoopImpl; 17 | 18 | } // namespace quiche 19 | 20 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_SYSTEM_EVENT_LOOP_H_ 21 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_test_loopback.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/common/platform/api/quiche_test_loopback.h" 6 | 7 | namespace quiche { 8 | 9 | quic::IpAddressFamily AddressFamilyUnderTest() { 10 | return AddressFamilyUnderTestImpl(); 11 | } 12 | 13 | quic::QuicIpAddress TestLoopback4() { return TestLoopback4Impl(); } 14 | 15 | quic::QuicIpAddress TestLoopback6() { return TestLoopback6Impl(); } 16 | 17 | quic::QuicIpAddress TestLoopback() { return TestLoopbackImpl(); } 18 | 19 | quic::QuicIpAddress TestLoopback(int index) { return TestLoopbackImpl(index); } 20 | 21 | } // namespace quiche 22 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_testvalue.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_TESTVALUE_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_TESTVALUE_H_ 7 | 8 | #include "quiche_platform_impl/quiche_testvalue_impl.h" 9 | 10 | #include "absl/strings/string_view.h" 11 | 12 | namespace quiche { 13 | 14 | // Interface allowing injection of test-specific code in production codepaths. 15 | // |label| is an arbitrary value identifying the location, and |var| is a 16 | // pointer to the value to be modified. 17 | // 18 | // Note that this method does nothing in Chromium. 19 | template 20 | void AdjustTestValue(absl::string_view label, T* var) { 21 | AdjustTestValueImpl(label, var); 22 | } 23 | 24 | } // namespace quiche 25 | 26 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_TESTVALUE_H_ 27 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_thread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_THREAD_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_THREAD_H_ 7 | 8 | #include 9 | 10 | #include "quiche_platform_impl/quiche_thread_impl.h" 11 | 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | 14 | namespace quiche { 15 | 16 | // A class representing a thread of execution in QUIC. 17 | class QUICHE_EXPORT QuicheThread : public QuicheThreadImpl { 18 | public: 19 | QuicheThread(const std::string& string) : QuicheThreadImpl(string) {} 20 | QuicheThread(const QuicheThread&) = delete; 21 | QuicheThread& operator=(const QuicheThread&) = delete; 22 | 23 | // Impl defines a virtual void Run() method which subclasses 24 | // must implement. 25 | }; 26 | 27 | } // namespace quiche 28 | 29 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_THREAD_H_ 30 | -------------------------------------------------------------------------------- /quiche/common/platform/api/quiche_time_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_API_QUICHE_TIME_UTILS_H_ 6 | #define QUICHE_COMMON_PLATFORM_API_QUICHE_TIME_UTILS_H_ 7 | 8 | #include 9 | 10 | #include "quiche_platform_impl/quiche_time_utils_impl.h" 11 | 12 | namespace quiche { 13 | 14 | // Converts a civil time specified in UTC into a number of seconds since the 15 | // Unix epoch. This function is strict about validity of accepted dates. For 16 | // instance, it will reject February 29 on non-leap years, or 25 hours in a day. 17 | // As a notable exception, 60 seconds is accepted to deal with potential leap 18 | // seconds. If the date predates Unix epoch, nullopt will be returned. 19 | inline std::optional QuicheUtcDateTimeToUnixSeconds( 20 | int year, int month, int day, int hour, int minute, int second) { 21 | return QuicheUtcDateTimeToUnixSecondsImpl(year, month, day, hour, minute, 22 | second); 23 | } 24 | 25 | } // namespace quiche 26 | 27 | #endif // QUICHE_COMMON_PLATFORM_API_QUICHE_TIME_UTILS_H_ 28 | -------------------------------------------------------------------------------- /quiche/common/platform/api/testdir/README.md: -------------------------------------------------------------------------------- 1 | This directory is used in the QUICHE filesystem API tests. 2 | -------------------------------------------------------------------------------- /quiche/common/platform/api/testdir/a/b/c/d/e: -------------------------------------------------------------------------------- 1 | Test file for deeply nested folders. -------------------------------------------------------------------------------- /quiche/common/platform/api/testdir/a/subdir/testfile: -------------------------------------------------------------------------------- 1 | Test for a file with the same name as the other file. -------------------------------------------------------------------------------- /quiche/common/platform/api/testdir/a/z: -------------------------------------------------------------------------------- 1 | Test for a file in a subdirectory. -------------------------------------------------------------------------------- /quiche/common/platform/api/testdir/testfile: -------------------------------------------------------------------------------- 1 | This is a test file. -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_bug_tracker_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_BUG_TRACKER_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_BUG_TRACKER_IMPL_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_logging.h" 9 | 10 | #define QUICHE_BUG_IMPL(b) QUICHE_LOG(DFATAL) << #b ": " 11 | #define QUICHE_BUG_IF_IMPL(b, condition) \ 12 | QUICHE_LOG_IF(DFATAL, condition) << #b ": " 13 | #define QUICHE_PEER_BUG_IMPL(b) QUICHE_LOG(DFATAL) << #b ": " 14 | #define QUICHE_PEER_BUG_IF_IMPL(b, condition) \ 15 | QUICHE_LOG_IF(DFATAL, condition) << #b ": " 16 | 17 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_BUG_TRACKER_IMPL_H_ 18 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_containers_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_CONTAINERS_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_CONTAINERS_IMPL_H_ 7 | 8 | #include "absl/container/btree_set.h" 9 | 10 | namespace quiche { 11 | 12 | template 13 | using QuicheSmallOrderedSetImpl = absl::btree_set; 14 | 15 | } // namespace quiche 16 | 17 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_CONTAINERS_IMPL_H_ 18 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_default_proof_providers_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_DEFAULT_PROOF_PROVIDERS_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_DEFAULT_PROOF_PROVIDERS_IMPL_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/crypto/proof_source.h" 11 | #include "quiche/quic/core/crypto/proof_verifier.h" 12 | 13 | namespace quiche { 14 | 15 | std::unique_ptr CreateDefaultProofVerifierImpl( 16 | const std::string& host); 17 | std::unique_ptr CreateDefaultProofSourceImpl(); 18 | 19 | } // namespace quiche 20 | 21 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_DEFAULT_PROOF_PROVIDERS_IMPL_H_ 22 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_event_loop_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EVENT_LOOP_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EVENT_LOOP_IMPL_H_ 7 | 8 | #include 9 | 10 | namespace quic { 11 | class QuicEventLoopFactory; 12 | } 13 | 14 | namespace quiche { 15 | 16 | inline quic::QuicEventLoopFactory* GetOverrideForDefaultEventLoopImpl() { 17 | return nullptr; 18 | } 19 | 20 | inline std::vector 21 | GetExtraEventLoopImplementationsImpl() { 22 | return {}; 23 | } 24 | 25 | } // namespace quiche 26 | 27 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EVENT_LOOP_IMPL_H_ 28 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_expect_bug_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EXPECT_BUG_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EXPECT_BUG_IMPL_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_test.h" 9 | 10 | #define EXPECT_QUICHE_BUG_IMPL(statement, regex) \ 11 | EXPECT_QUICHE_DEBUG_DEATH(statement, regex) 12 | #define EXPECT_QUICHE_PEER_BUG_IMPL(statement, regex) \ 13 | EXPECT_QUICHE_DEBUG_DEATH(statement, regex) 14 | 15 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EXPECT_BUG_IMPL_H_ 16 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_export_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EXPORT_IMPL_H_ 2 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EXPORT_IMPL_H_ 3 | 4 | #include "absl/base/attributes.h" 5 | 6 | // These macros are documented in: quiche/quic/platform/api/quic_export.h 7 | 8 | #if defined(_WIN32) 9 | #define QUICHE_EXPORT_IMPL 10 | #elif ABSL_HAVE_ATTRIBUTE(visibility) 11 | #define QUICHE_EXPORT_IMPL __attribute__((visibility("default"))) 12 | #else 13 | #define QUICHE_EXPORT_IMPL 14 | #endif 15 | 16 | #define QUICHE_NO_EXPORT_IMPL QUICHE_EXPORT_IMPL 17 | 18 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_EXPORT_IMPL_H_ 19 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_file_utils_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_FILE_UTILS_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_FILE_UTILS_IMPL_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "absl/strings/string_view.h" 13 | 14 | namespace quiche { 15 | 16 | std::string JoinPathImpl(absl::string_view a, absl::string_view b); 17 | 18 | std::optional ReadFileContentsImpl(absl::string_view file); 19 | 20 | bool EnumerateDirectoryImpl(absl::string_view path, 21 | std::vector& directories, 22 | std::vector& files); 23 | 24 | } // namespace quiche 25 | 26 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_FILE_UTILS_IMPL_H_ 27 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_flags_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche_platform_impl/quiche_flags_impl.h" 6 | 7 | #define QUICHE_FLAG(type, flag, internal_value, external_value, doc) \ 8 | type FLAGS_##flag = external_value; 9 | #include "quiche/common/quiche_feature_flags_list.h" 10 | #undef QUICHE_FLAG 11 | 12 | #define QUICHE_PROTOCOL_FLAG(type, flag, value, doc) type FLAGS_##flag = value; 13 | #include "quiche/common/quiche_protocol_flags_list.h" 14 | #undef QUICHE_PROTOCOL_FLAG 15 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_googleurl_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_GOOGLEURL_IMPL_H_ 2 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_GOOGLEURL_IMPL_H_ 3 | 4 | #include "url/gurl.h" 5 | #include "url/third_party/mozilla/url_parse.h" 6 | #include "url/url_canon.h" 7 | #include "url/url_canon_stdstring.h" 8 | #include "url/url_constants.h" 9 | #include "url/url_util.h" 10 | 11 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_GOOGLEURL_IMPL_H_ 12 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_header_policy_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_HEADER_POLICY_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_HEADER_POLICY_IMPL_H_ 7 | 8 | #include "absl/strings/string_view.h" 9 | 10 | namespace quiche { 11 | 12 | inline void QuicheHandleHeaderPolicyImpl(absl::string_view /*key*/) {} 13 | 14 | } // namespace quiche 15 | 16 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_HEADER_POLICY_IMPL_H_ 17 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_iovec_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_IOVEC_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_IOVEC_IMPL_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | 10 | #if defined(_WIN32) 11 | 12 | // See 13 | struct QUICHE_EXPORT iovec { 14 | void* iov_base; 15 | size_t iov_len; 16 | }; 17 | 18 | #else 19 | 20 | #include // IWYU pragma: export 21 | 22 | #endif // defined(_WIN32) 23 | 24 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_IOVEC_IMPL_H_ 25 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_logging_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche_platform_impl/quiche_logging_impl.h" 6 | 7 | #include "absl/flags/flag.h" 8 | #include "absl/log/absl_log.h" 9 | #include "absl/strings/string_view.h" 10 | 11 | #ifndef ABSL_VLOG 12 | ABSL_FLAG(int, v, 0, "Show all QUICHE_VLOG(m) messages for m <= this."); 13 | #endif 14 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_lower_case_string_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_LOWER_CASE_STRING_IMPL_H_ 2 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_LOWER_CASE_STRING_IMPL_H_ 3 | 4 | #include 5 | 6 | #include "absl/strings/ascii.h" 7 | #include "absl/strings/string_view.h" 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | 10 | namespace quiche { 11 | 12 | class QUICHE_EXPORT QuicheLowerCaseStringImpl { 13 | public: 14 | QuicheLowerCaseStringImpl(absl::string_view str) 15 | : str_(absl::AsciiStrToLower(str)) {} 16 | 17 | const std::string& get() const { return str_; } 18 | 19 | private: 20 | std::string str_; 21 | }; 22 | 23 | } // namespace quiche 24 | 25 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_LOWER_CASE_STRING_IMPL_H_ 26 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_stack_trace_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_STACK_TRACE_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_STACK_TRACE_IMPL_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "absl/types/span.h" 12 | 13 | namespace quiche { 14 | 15 | std::vector CurrentStackTraceImpl(); 16 | std::string SymbolizeStackTraceImpl(absl::Span stacktrace); 17 | std::string QuicheStackTraceImpl(); 18 | bool QuicheShouldRunStackTraceTestImpl(); 19 | 20 | } // namespace quiche 21 | 22 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_STACK_TRACE_IMPL_H_ 23 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_stream_buffer_allocator_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_STREAM_BUFFER_ALLOCATOR_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_STREAM_BUFFER_ALLOCATOR_IMPL_H_ 7 | 8 | #include "quiche/common/simple_buffer_allocator.h" 9 | 10 | namespace quiche { 11 | 12 | using QuicheStreamBufferAllocatorImpl = quiche::SimpleBufferAllocator; 13 | 14 | } // namespace quiche 15 | 16 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_STREAM_BUFFER_ALLOCATOR_IMPL_H_ 17 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_system_event_loop_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_SYSTEM_EVENT_LOOP_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_SYSTEM_EVENT_LOOP_IMPL_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | #include "quiche/common/platform/api/quiche_logging.h" 10 | 11 | namespace quiche { 12 | 13 | inline void QuicheRunSystemEventLoopIterationImpl() {} 14 | 15 | class QUICHE_EXPORT QuicheSystemEventLoopImpl { 16 | public: 17 | QuicheSystemEventLoopImpl(std::string context_name) { 18 | QUICHE_LOG(INFO) << "Starting event loop for " << context_name; 19 | } 20 | }; 21 | 22 | } // namespace quiche 23 | 24 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_SYSTEM_EVENT_LOOP_IMPL_H_ 25 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_test_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche_platform_impl/quiche_test_impl.h" 6 | 7 | #include "quiche/common/platform/api/quiche_flags.h" 8 | 9 | QuicheFlagSaverImpl::QuicheFlagSaverImpl() { 10 | #define QUICHE_FLAG(type, flag, internal_value, external_value, doc) \ 11 | saved_##flag##_ = FLAGS_##flag; 12 | #include "quiche/common/quiche_feature_flags_list.h" 13 | #undef QUICHE_FLAG 14 | #define QUICHE_PROTOCOL_FLAG(type, flag, ...) saved_##flag##_ = FLAGS_##flag; 15 | #include "quiche/common/quiche_protocol_flags_list.h" 16 | #undef QUICHE_PROTOCOL_FLAG 17 | } 18 | 19 | QuicheFlagSaverImpl::~QuicheFlagSaverImpl() { 20 | #define QUICHE_FLAG(type, flag, internal_value, external_value, doc) \ 21 | FLAGS_##flag = saved_##flag##_; 22 | #include "quiche/common/quiche_feature_flags_list.h" // NOLINT 23 | #undef QUICHE_FLAG 24 | #define QUICHE_PROTOCOL_FLAG(type, flag, ...) FLAGS_##flag = saved_##flag##_; 25 | #include "quiche/common/quiche_protocol_flags_list.h" // NOLINT 26 | #undef QUICHE_PROTOCOL_FLAG 27 | } 28 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_test_loopback_impl.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche_platform_impl/quiche_test_loopback_impl.h" 6 | 7 | namespace quiche { 8 | 9 | quic::IpAddressFamily AddressFamilyUnderTestImpl() { 10 | return quic::IpAddressFamily::IP_V4; 11 | } 12 | 13 | quic::QuicIpAddress TestLoopback4Impl() { 14 | return quic::QuicIpAddress::Loopback4(); 15 | } 16 | 17 | quic::QuicIpAddress TestLoopback6Impl() { 18 | return quic::QuicIpAddress::Loopback6(); 19 | } 20 | 21 | quic::QuicIpAddress TestLoopbackImpl() { 22 | return quic::QuicIpAddress::Loopback4(); 23 | } 24 | 25 | quic::QuicIpAddress TestLoopbackImpl(int index) { 26 | const char kLocalhostIPv4[] = {127, 0, 0, static_cast(index)}; 27 | quic::QuicIpAddress address; 28 | address.FromPackedString(kLocalhostIPv4, 4); 29 | return address; 30 | } 31 | 32 | } // namespace quiche 33 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_test_loopback_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TEST_LOOPBACK_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TEST_LOOPBACK_IMPL_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_ip_address.h" 9 | #include "quiche/quic/platform/api/quic_ip_address_family.h" 10 | 11 | namespace quiche { 12 | 13 | // Returns the address family IPv4 used to run test under. 14 | quic::IpAddressFamily AddressFamilyUnderTestImpl(); 15 | 16 | // Returns an IPv4 loopback address. 17 | quic::QuicIpAddress TestLoopback4Impl(); 18 | 19 | // Returns the only IPv6 loopback address. 20 | quic::QuicIpAddress TestLoopback6Impl(); 21 | 22 | // Returns an IPv4 loopback address. 23 | quic::QuicIpAddress TestLoopbackImpl(); 24 | 25 | // Returns an indexed IPv4 loopback address. 26 | quic::QuicIpAddress TestLoopbackImpl(int index); 27 | 28 | } // namespace quiche 29 | 30 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TEST_LOOPBACK_IMPL_H_ 31 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_test_output_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TEST_OUTPUT_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TEST_OUTPUT_IMPL_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | 12 | namespace quiche { 13 | 14 | inline void QuicheSaveTestOutputImpl(absl::string_view /*filename*/, 15 | absl::string_view /*data*/) {} 16 | 17 | inline bool QuicheLoadTestOutputImpl(absl::string_view /*filename*/, 18 | std::string* /*data*/) { 19 | return false; 20 | } 21 | 22 | inline void QuicheRecordTraceImpl(absl::string_view /*identifier*/, 23 | absl::string_view /*data*/) {} 24 | 25 | } // namespace quiche 26 | 27 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TEST_OUTPUT_IMPL_H_ 28 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_testvalue_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TESTVALUE_IMPL_H_ 2 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TESTVALUE_IMPL_H_ 3 | 4 | #include "absl/strings/string_view.h" 5 | 6 | namespace quiche { 7 | 8 | template 9 | void AdjustTestValueImpl(absl::string_view /*label*/, T* /*var*/) {} 10 | 11 | } // namespace quiche 12 | 13 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TESTVALUE_IMPL_H_ 14 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_thread_impl.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_THREAD_IMPL_H_ 2 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_THREAD_IMPL_H_ 3 | 4 | #include 5 | #include 6 | #include // NOLINT: only used outside of google3 7 | 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | 10 | class QUICHE_NO_EXPORT QuicheThreadImpl { 11 | public: 12 | QuicheThreadImpl(const std::string&) {} 13 | virtual ~QuicheThreadImpl() {} 14 | 15 | virtual void Run() = 0; 16 | 17 | void Start() { 18 | thread_.emplace([this]() { Run(); }); 19 | } 20 | void Join() { thread_->join(); } 21 | 22 | private: 23 | std::optional thread_; 24 | }; 25 | 26 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_THREAD_IMPL_H_ 27 | -------------------------------------------------------------------------------- /quiche/common/platform/default/quiche_platform_impl/quiche_time_utils_impl.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TIME_UTILS_IMPL_H_ 6 | #define QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TIME_UTILS_IMPL_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "quiche/common/platform/api/quiche_export.h" 12 | 13 | namespace quiche { 14 | 15 | QUICHE_EXPORT std::optional QuicheUtcDateTimeToUnixSecondsImpl( 16 | int year, int month, int day, int hour, int minute, int second); 17 | 18 | } // namespace quiche 19 | 20 | #endif // QUICHE_COMMON_PLATFORM_DEFAULT_QUICHE_PLATFORM_IMPL_QUICHE_TIME_UTILS_IMPL_H_ 21 | -------------------------------------------------------------------------------- /quiche/common/print_elements.h: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_PRINT_ELEMENTS_H_ 6 | #define QUICHE_COMMON_PRINT_ELEMENTS_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | 14 | namespace quiche { 15 | 16 | // Print elements of any iterable container that has cbegin() and cend() methods 17 | // and the elements have operator<<(ostream) override. 18 | template 19 | QUICHE_NO_EXPORT inline std::string PrintElements(const T& container) { 20 | std::stringstream debug_string; 21 | debug_string << "{"; 22 | auto it = container.cbegin(); 23 | if (it != container.cend()) { 24 | debug_string << *it; 25 | ++it; 26 | while (it != container.cend()) { 27 | debug_string << ", " << *it; 28 | ++it; 29 | } 30 | } 31 | debug_string << "}"; 32 | return debug_string.str(); 33 | } 34 | 35 | } // namespace quiche 36 | 37 | #endif // QUICHE_COMMON_PRINT_ELEMENTS_H_ 38 | -------------------------------------------------------------------------------- /quiche/common/quiche_crypto_logging.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_QUICHE_CRYPTO_LOGGING_H_ 6 | #define QUICHE_COMMON_QUICHE_CRYPTO_LOGGING_H_ 7 | 8 | #include "absl/status/status.h" 9 | 10 | namespace quiche { 11 | 12 | // In debug builds only, log OpenSSL error stack. Then clear OpenSSL error 13 | // stack. 14 | void DLogOpenSslErrors(); 15 | 16 | // Clears OpenSSL error stack. 17 | void ClearOpenSslErrors(); 18 | 19 | // Include OpenSSL error stack in Status msg so that callers could choose to 20 | // only log it in debug builds if required. 21 | absl::Status SslErrorAsStatus( 22 | absl::string_view msg, absl::StatusCode code = absl::StatusCode::kInternal); 23 | 24 | } // namespace quiche 25 | 26 | #endif // QUICHE_COMMON_QUICHE_CRYPTO_LOGGING_H_ 27 | -------------------------------------------------------------------------------- /quiche/common/quiche_ip_address_family.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_QUICHE_IP_ADDRESS_FAMILY_H_ 6 | #define QUICHE_COMMON_QUICHE_IP_ADDRESS_FAMILY_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | 10 | namespace quiche { 11 | 12 | // IP address family type used in QUIC. This hides platform dependant IP address 13 | // family types. 14 | enum class IpAddressFamily { 15 | IP_V4, 16 | IP_V6, 17 | IP_UNSPEC, 18 | }; 19 | 20 | QUICHE_EXPORT int ToPlatformAddressFamily(IpAddressFamily family); 21 | QUICHE_EXPORT IpAddressFamily FromPlatformAddressFamily(int family); 22 | 23 | } // namespace quiche 24 | 25 | #endif // QUICHE_COMMON_QUICHE_IP_ADDRESS_FAMILY_H_ 26 | -------------------------------------------------------------------------------- /quiche/common/quiche_mem_slice_storage.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/common/quiche_mem_slice_storage.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "quiche/quic/core/quic_utils.h" 11 | 12 | namespace quiche { 13 | 14 | QuicheMemSliceStorage::QuicheMemSliceStorage( 15 | const struct iovec* iov, int iov_count, QuicheBufferAllocator* allocator, 16 | const quic::QuicByteCount max_slice_len) { 17 | if (iov == nullptr) { 18 | return; 19 | } 20 | quic::QuicByteCount write_len = 0; 21 | for (int i = 0; i < iov_count; ++i) { 22 | write_len += iov[i].iov_len; 23 | } 24 | QUICHE_DCHECK_LT(0u, write_len); 25 | 26 | size_t io_offset = 0; 27 | while (write_len > 0) { 28 | size_t slice_len = std::min(write_len, max_slice_len); 29 | QuicheBuffer buffer = QuicheBuffer::CopyFromIovec(allocator, iov, iov_count, 30 | io_offset, slice_len); 31 | storage_.push_back(QuicheMemSlice(std::move(buffer))); 32 | write_len -= slice_len; 33 | io_offset += slice_len; 34 | } 35 | } 36 | 37 | } // namespace quiche 38 | -------------------------------------------------------------------------------- /quiche/common/simple_buffer_allocator.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/common/simple_buffer_allocator.h" 6 | 7 | namespace quiche { 8 | 9 | char* SimpleBufferAllocator::New(size_t size) { return new char[size]; } 10 | 11 | char* SimpleBufferAllocator::New(size_t size, bool /* flag_enable */) { 12 | return New(size); 13 | } 14 | 15 | void SimpleBufferAllocator::Delete(char* buffer) { delete[] buffer; } 16 | 17 | } // namespace quiche 18 | -------------------------------------------------------------------------------- /quiche/common/simple_buffer_allocator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_SIMPLE_BUFFER_ALLOCATOR_H_ 6 | #define QUICHE_COMMON_SIMPLE_BUFFER_ALLOCATOR_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | #include "quiche/common/quiche_buffer_allocator.h" 10 | 11 | namespace quiche { 12 | 13 | // Provides buffer allocation using operators new[] and delete[] on char arrays. 14 | // Note that some of the QUICHE code relies on this being the case for deleting 15 | // new[]-allocated arrays from elsewhere. 16 | class QUICHE_EXPORT SimpleBufferAllocator : public QuicheBufferAllocator { 17 | public: 18 | static SimpleBufferAllocator* Get() { 19 | static SimpleBufferAllocator* singleton = new SimpleBufferAllocator(); 20 | return singleton; 21 | } 22 | 23 | char* New(size_t size) override; 24 | char* New(size_t size, bool flag_enable) override; 25 | void Delete(char* buffer) override; 26 | }; 27 | 28 | } // namespace quiche 29 | 30 | #endif // QUICHE_COMMON_SIMPLE_BUFFER_ALLOCATOR_H_ 31 | -------------------------------------------------------------------------------- /quiche/common/structured_headers_fuzzer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "absl/strings/string_view.h" 6 | #include "quiche/common/structured_headers.h" 7 | 8 | namespace quiche { 9 | namespace structured_headers { 10 | 11 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 12 | absl::string_view input(reinterpret_cast(data), size); 13 | ParseItem(input); 14 | ParseListOfLists(input); 15 | ParseList(input); 16 | ParseDictionary(input); 17 | ParseParameterisedList(input); 18 | return 0; 19 | } 20 | 21 | } // namespace structured_headers 22 | } // namespace quiche 23 | -------------------------------------------------------------------------------- /quiche/common/vectorized_io_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_COMMON_VECTORIZED_IO_UTILS_H_ 6 | #define QUICHE_COMMON_VECTORIZED_IO_UTILS_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "absl/types/span.h" 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | 14 | namespace quiche { 15 | 16 | // Computes the total size of all strings in the provided span. 17 | size_t TotalStringViewSpanSize(absl::Span span); 18 | 19 | // Copies data contained in `inputs` into `output`, up until either the `output` 20 | // is full or the `inputs` are copied fully; returns the actual number of bytes 21 | // copied. 22 | size_t QUICHE_EXPORT GatherStringViewSpan( 23 | absl::Span inputs, absl::Span output); 24 | 25 | } // namespace quiche 26 | 27 | #endif // QUICHE_COMMON_VECTORIZED_IO_UTILS_H_ 28 | -------------------------------------------------------------------------------- /quiche/http2/adapter/http2_session.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_ADAPTER_HTTP2_SESSION_H_ 2 | #define QUICHE_HTTP2_ADAPTER_HTTP2_SESSION_H_ 3 | 4 | #include 5 | 6 | #include "absl/strings/string_view.h" 7 | #include "quiche/http2/adapter/http2_protocol.h" 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | 10 | namespace http2 { 11 | namespace adapter { 12 | 13 | struct QUICHE_EXPORT Http2SessionCallbacks {}; 14 | 15 | // A class to represent the state of a single HTTP/2 connection. 16 | class QUICHE_EXPORT Http2Session { 17 | public: 18 | Http2Session() = default; 19 | virtual ~Http2Session() {} 20 | 21 | virtual int64_t ProcessBytes(absl::string_view bytes) = 0; 22 | 23 | virtual int Consume(Http2StreamId stream_id, size_t num_bytes) = 0; 24 | 25 | virtual bool want_read() const = 0; 26 | virtual bool want_write() const = 0; 27 | virtual int GetRemoteWindowSize() const = 0; 28 | }; 29 | 30 | } // namespace adapter 31 | } // namespace http2 32 | 33 | #endif // QUICHE_HTTP2_ADAPTER_HTTP2_SESSION_H_ 34 | -------------------------------------------------------------------------------- /quiche/http2/adapter/http2_util.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_ADAPTER_HTTP2_UTIL_H_ 2 | #define QUICHE_HTTP2_ADAPTER_HTTP2_UTIL_H_ 3 | 4 | #include 5 | 6 | #include "quiche/http2/adapter/http2_protocol.h" 7 | #include "quiche/http2/adapter/http2_visitor_interface.h" 8 | #include "quiche/http2/core/spdy_protocol.h" 9 | #include "quiche/common/platform/api/quiche_export.h" 10 | 11 | namespace http2 { 12 | namespace adapter { 13 | 14 | QUICHE_EXPORT spdy::SpdyErrorCode TranslateErrorCode(Http2ErrorCode code); 15 | QUICHE_EXPORT Http2ErrorCode TranslateErrorCode(spdy::SpdyErrorCode code); 16 | 17 | QUICHE_EXPORT absl::string_view ConnectionErrorToString( 18 | Http2VisitorInterface::ConnectionError error); 19 | 20 | QUICHE_EXPORT absl::string_view InvalidFrameErrorToString( 21 | Http2VisitorInterface::InvalidFrameError error); 22 | 23 | // A WINDOW_UPDATE sending strategy that returns true if the `delta` to be sent 24 | // is positive and at least half of the window `limit`. 25 | QUICHE_EXPORT bool DeltaAtLeastHalfLimit(int64_t limit, int64_t /*size*/, 26 | int64_t delta); 27 | 28 | } // namespace adapter 29 | } // namespace http2 30 | 31 | #endif // QUICHE_HTTP2_ADAPTER_HTTP2_UTIL_H_ 32 | -------------------------------------------------------------------------------- /quiche/http2/adapter/nghttp2.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_ADAPTER_NGHTTP2_H_ 2 | #define QUICHE_HTTP2_ADAPTER_NGHTTP2_H_ 3 | 4 | #include 5 | 6 | // Required to build on Windows. 7 | using ssize_t = ptrdiff_t; 8 | 9 | #include "nghttp2/nghttp2.h" // IWYU pragma: export 10 | 11 | #endif // QUICHE_HTTP2_ADAPTER_NGHTTP2_H_ 12 | -------------------------------------------------------------------------------- /quiche/http2/adapter/nghttp2_data_provider.cc: -------------------------------------------------------------------------------- 1 | #include "quiche/http2/adapter/nghttp2_data_provider.h" 2 | 3 | #include 4 | 5 | #include "quiche/http2/adapter/http2_visitor_interface.h" 6 | #include "quiche/http2/adapter/nghttp2_util.h" 7 | 8 | namespace http2 { 9 | namespace adapter { 10 | namespace callbacks { 11 | 12 | ssize_t VisitorReadCallback(Http2VisitorInterface& visitor, int32_t stream_id, 13 | size_t max_length, uint32_t* data_flags) { 14 | *data_flags |= NGHTTP2_DATA_FLAG_NO_COPY; 15 | auto [payload_length, end_data, end_stream] = 16 | visitor.OnReadyToSendDataForStream(stream_id, max_length); 17 | if (payload_length == 0 && !end_data) { 18 | return NGHTTP2_ERR_DEFERRED; 19 | } else if (payload_length == DataFrameSource::kError) { 20 | return NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE; 21 | } 22 | if (end_data) { 23 | *data_flags |= NGHTTP2_DATA_FLAG_EOF; 24 | } 25 | if (!end_stream) { 26 | *data_flags |= NGHTTP2_DATA_FLAG_NO_END_STREAM; 27 | } 28 | return payload_length; 29 | } 30 | 31 | } // namespace callbacks 32 | } // namespace adapter 33 | } // namespace http2 34 | -------------------------------------------------------------------------------- /quiche/http2/adapter/nghttp2_data_provider.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_ 2 | #define QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_ 3 | 4 | #include 5 | #include 6 | 7 | #include "quiche/http2/adapter/data_source.h" 8 | #include "quiche/http2/adapter/http2_visitor_interface.h" 9 | #include "quiche/http2/adapter/nghttp2.h" 10 | 11 | namespace http2 { 12 | namespace adapter { 13 | namespace callbacks { 14 | 15 | // A callback that returns DATA frame payload size and associated flags, given a 16 | // Http2VisitorInterface. 17 | ssize_t VisitorReadCallback(Http2VisitorInterface& visitor, int32_t stream_id, 18 | size_t max_length, uint32_t* data_flags); 19 | 20 | } // namespace callbacks 21 | } // namespace adapter 22 | } // namespace http2 23 | 24 | #endif // QUICHE_HTTP2_ADAPTER_NGHTTP2_DATA_PROVIDER_H_ 25 | -------------------------------------------------------------------------------- /quiche/http2/adapter/noop_header_validator.cc: -------------------------------------------------------------------------------- 1 | #include "quiche/http2/adapter/noop_header_validator.h" 2 | 3 | #include 4 | 5 | #include "absl/strings/escaping.h" 6 | #include "quiche/common/platform/api/quiche_logging.h" 7 | 8 | namespace http2 { 9 | namespace adapter { 10 | 11 | HeaderValidatorBase::HeaderStatus NoopHeaderValidator::ValidateSingleHeader( 12 | absl::string_view key, absl::string_view value) { 13 | if (key == ":status") { 14 | status_ = std::string(value); 15 | } 16 | return HEADER_OK; 17 | } 18 | 19 | bool NoopHeaderValidator::FinishHeaderBlock(HeaderType /* type */) { 20 | return true; 21 | } 22 | 23 | } // namespace adapter 24 | } // namespace http2 25 | -------------------------------------------------------------------------------- /quiche/http2/adapter/noop_header_validator.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_ADAPTER_NOOP_HEADER_VALIDATOR_H_ 2 | #define QUICHE_HTTP2_ADAPTER_NOOP_HEADER_VALIDATOR_H_ 3 | 4 | #include "absl/strings/string_view.h" 5 | #include "quiche/http2/adapter/header_validator_base.h" 6 | #include "quiche/common/platform/api/quiche_export.h" 7 | 8 | namespace http2 { 9 | namespace adapter { 10 | 11 | // A validator that does not actually perform any validation. 12 | class QUICHE_EXPORT NoopHeaderValidator : public HeaderValidatorBase { 13 | public: 14 | NoopHeaderValidator() = default; 15 | 16 | HeaderStatus ValidateSingleHeader(absl::string_view key, 17 | absl::string_view value) override; 18 | 19 | bool FinishHeaderBlock(HeaderType type) override; 20 | }; 21 | 22 | } // namespace adapter 23 | } // namespace http2 24 | 25 | #endif // QUICHE_HTTP2_ADAPTER_NOOP_HEADER_VALIDATOR_H_ 26 | -------------------------------------------------------------------------------- /quiche/http2/adapter/oghttp2_util.cc: -------------------------------------------------------------------------------- 1 | #include "quiche/http2/adapter/oghttp2_util.h" 2 | 3 | namespace http2 { 4 | namespace adapter { 5 | 6 | quiche::HttpHeaderBlock ToHeaderBlock(absl::Span headers) { 7 | quiche::HttpHeaderBlock block; 8 | for (const Header& header : headers) { 9 | absl::string_view name = GetStringView(header.first).first; 10 | absl::string_view value = GetStringView(header.second).first; 11 | block.AppendValueOrAddHeader(name, value); 12 | } 13 | return block; 14 | } 15 | 16 | } // namespace adapter 17 | } // namespace http2 18 | -------------------------------------------------------------------------------- /quiche/http2/adapter/oghttp2_util.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_ADAPTER_OGHTTP2_UTIL_H_ 2 | #define QUICHE_HTTP2_ADAPTER_OGHTTP2_UTIL_H_ 3 | 4 | #include "absl/types/span.h" 5 | #include "quiche/http2/adapter/http2_protocol.h" 6 | #include "quiche/common/http/http_header_block.h" 7 | #include "quiche/common/platform/api/quiche_export.h" 8 | 9 | namespace http2 { 10 | namespace adapter { 11 | 12 | QUICHE_EXPORT quiche::HttpHeaderBlock ToHeaderBlock( 13 | absl::Span headers); 14 | 15 | } // namespace adapter 16 | } // namespace http2 17 | 18 | #endif // QUICHE_HTTP2_ADAPTER_OGHTTP2_UTIL_H_ 19 | -------------------------------------------------------------------------------- /quiche/http2/core/array_output_buffer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/core/array_output_buffer.h" 6 | 7 | #include 8 | 9 | namespace spdy { 10 | 11 | void ArrayOutputBuffer::Next(char** data, int* size) { 12 | *data = current_; 13 | *size = capacity_ > 0 ? capacity_ : 0; 14 | } 15 | 16 | void ArrayOutputBuffer::AdvanceWritePtr(int64_t count) { 17 | current_ += count; 18 | capacity_ -= count; 19 | } 20 | 21 | uint64_t ArrayOutputBuffer::BytesFree() const { return capacity_; } 22 | 23 | } // namespace spdy 24 | -------------------------------------------------------------------------------- /quiche/http2/core/header_byte_listener_interface.h: -------------------------------------------------------------------------------- 1 | #ifndef QUICHE_HTTP2_CORE_HEADER_BYTE_LISTENER_INTERFACE_H_ 2 | #define QUICHE_HTTP2_CORE_HEADER_BYTE_LISTENER_INTERFACE_H_ 3 | 4 | #include 5 | 6 | #include "quiche/common/platform/api/quiche_export.h" 7 | 8 | namespace spdy { 9 | 10 | // Listens for the receipt of uncompressed header bytes. 11 | class QUICHE_EXPORT HeaderByteListenerInterface { 12 | public: 13 | virtual ~HeaderByteListenerInterface() {} 14 | 15 | // Called when a header block has been parsed, with the number of uncompressed 16 | // header bytes parsed from the header block. 17 | virtual void OnHeaderBytesReceived(size_t uncompressed_header_bytes) = 0; 18 | }; 19 | 20 | } // namespace spdy 21 | 22 | #endif // QUICHE_HTTP2_CORE_HEADER_BYTE_LISTENER_INTERFACE_H_ 23 | -------------------------------------------------------------------------------- /quiche/http2/core/http2_frame_decoder_adapter_fuzzer.cc: -------------------------------------------------------------------------------- 1 | #include "testing/fuzzing/fuzztest.h" 2 | #include "quiche/http2/core/http2_frame_decoder_adapter.h" 3 | #include "quiche/http2/core/spdy_no_op_visitor.h" 4 | 5 | void DecoderFuzzTest(const std::string& data) { 6 | spdy::SpdyNoOpVisitor visitor; 7 | http2::Http2DecoderAdapter decoder; 8 | decoder.set_visitor(&visitor); 9 | decoder.ProcessInput(data.data(), data.size()); 10 | } 11 | FUZZ_TEST(Http2FrameDecoderAdapterFuzzTest, DecoderFuzzTest); 12 | -------------------------------------------------------------------------------- /quiche/http2/core/spdy_bitmasks.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_CORE_SPDY_BITMASKS_H_ 6 | #define QUICHE_HTTP2_CORE_SPDY_BITMASKS_H_ 7 | 8 | namespace spdy { 9 | 10 | // StreamId mask from the SpdyHeader 11 | inline constexpr unsigned int kStreamIdMask = 0x7fffffff; 12 | 13 | // Mask the lower 24 bits. 14 | inline constexpr unsigned int kLengthMask = 0xffffff; 15 | 16 | } // namespace spdy 17 | 18 | #endif // QUICHE_HTTP2_CORE_SPDY_BITMASKS_H_ 19 | -------------------------------------------------------------------------------- /quiche/http2/core/spdy_no_op_visitor.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/core/spdy_no_op_visitor.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "quiche/http2/core/spdy_headers_handler_interface.h" 11 | #include "quiche/http2/core/spdy_protocol.h" 12 | 13 | namespace spdy { 14 | 15 | SpdyNoOpVisitor::SpdyNoOpVisitor() { 16 | static_assert(std::is_abstract::value == false, 17 | "Need to update SpdyNoOpVisitor."); 18 | } 19 | SpdyNoOpVisitor::~SpdyNoOpVisitor() = default; 20 | 21 | SpdyHeadersHandlerInterface* SpdyNoOpVisitor::OnHeaderFrameStart( 22 | SpdyStreamId /*stream_id*/) { 23 | return this; 24 | } 25 | 26 | bool SpdyNoOpVisitor::OnUnknownFrame(SpdyStreamId /*stream_id*/, 27 | uint8_t /*frame_type*/) { 28 | return true; 29 | } 30 | 31 | } // namespace spdy 32 | -------------------------------------------------------------------------------- /quiche/http2/core/zero_copy_output_buffer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_CORE_ZERO_COPY_OUTPUT_BUFFER_H_ 6 | #define QUICHE_HTTP2_CORE_ZERO_COPY_OUTPUT_BUFFER_H_ 7 | 8 | #include 9 | 10 | #include "quiche/common/platform/api/quiche_export.h" 11 | 12 | namespace spdy { 13 | 14 | class QUICHE_EXPORT ZeroCopyOutputBuffer { 15 | public: 16 | virtual ~ZeroCopyOutputBuffer() {} 17 | 18 | // Returns the next available segment of memory to write. Will always return 19 | // the same segment until AdvanceWritePtr is called. 20 | virtual void Next(char** data, int* size) = 0; 21 | 22 | // After writing to a buffer returned from Next(), the caller should call 23 | // this method to indicate how many bytes were written. 24 | virtual void AdvanceWritePtr(int64_t count) = 0; 25 | 26 | // Returns the available capacity of the buffer. 27 | virtual uint64_t BytesFree() const = 0; 28 | }; 29 | 30 | } // namespace spdy 31 | 32 | #endif // QUICHE_HTTP2_CORE_ZERO_COPY_OUTPUT_BUFFER_H_ 33 | -------------------------------------------------------------------------------- /quiche/http2/decoder/decode_status.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/decoder/decode_status.h" 6 | 7 | #include 8 | 9 | #include "quiche/common/platform/api/quiche_bug_tracker.h" 10 | #include "quiche/common/platform/api/quiche_logging.h" 11 | 12 | namespace http2 { 13 | 14 | std::ostream& operator<<(std::ostream& out, DecodeStatus v) { 15 | switch (v) { 16 | case DecodeStatus::kDecodeDone: 17 | return out << "DecodeDone"; 18 | case DecodeStatus::kDecodeInProgress: 19 | return out << "DecodeInProgress"; 20 | case DecodeStatus::kDecodeError: 21 | return out << "DecodeError"; 22 | } 23 | // Since the value doesn't come over the wire, only a programming bug should 24 | // result in reaching this point. 25 | int unknown = static_cast(v); 26 | QUICHE_BUG(http2_bug_147_1) << "Unknown DecodeStatus " << unknown; 27 | return out << "DecodeStatus(" << unknown << ")"; 28 | } 29 | 30 | } // namespace http2 31 | -------------------------------------------------------------------------------- /quiche/http2/decoder/decode_status.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_DECODER_DECODE_STATUS_H_ 6 | #define QUICHE_HTTP2_DECODER_DECODE_STATUS_H_ 7 | 8 | // Enum DecodeStatus is used to report the status of decoding of many 9 | // types of HTTP/2 and HPACK objects. 10 | 11 | #include 12 | 13 | #include "quiche/common/platform/api/quiche_export.h" 14 | 15 | namespace http2 { 16 | 17 | enum class DecodeStatus { 18 | // Decoding is done. 19 | kDecodeDone, 20 | 21 | // Decoder needs more input to be able to make progress. 22 | kDecodeInProgress, 23 | 24 | // Decoding failed (e.g. HPACK variable length integer is too large, or 25 | // an HTTP/2 frame has padding declared to be larger than the payload). 26 | kDecodeError, 27 | }; 28 | QUICHE_EXPORT std::ostream& operator<<(std::ostream& out, DecodeStatus v); 29 | 30 | } // namespace http2 31 | 32 | #endif // QUICHE_HTTP2_DECODER_DECODE_STATUS_H_ 33 | -------------------------------------------------------------------------------- /quiche/http2/decoder/http2_frame_decoder_fuzzer.cc: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | #include "quiche/http2/decoder/decode_buffer.h" 5 | #include "quiche/http2/decoder/http2_frame_decoder.h" 6 | #include "quiche/http2/decoder/http2_frame_decoder_listener.h" 7 | 8 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { 9 | http2::Http2FrameDecoderNoOpListener listener; 10 | http2::Http2FrameDecoder decoder(&listener); 11 | http2::DecodeBuffer db(reinterpret_cast(data), size); 12 | decoder.DecodeFrame(&db); 13 | return 0; // Always return 0; other values are reserved for future uses. 14 | } 15 | -------------------------------------------------------------------------------- /quiche/http2/decoder/http2_frame_decoder_listener.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/decoder/http2_frame_decoder_listener.h" 6 | 7 | namespace http2 { 8 | 9 | bool Http2FrameDecoderNoOpListener::OnFrameHeader( 10 | const Http2FrameHeader& /*header*/) { 11 | return true; 12 | } 13 | 14 | } // namespace http2 15 | -------------------------------------------------------------------------------- /quiche/http2/hpack/decoder/hpack_decoder_listener.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/hpack/decoder/hpack_decoder_listener.h" 6 | 7 | namespace http2 { 8 | 9 | HpackDecoderListener::HpackDecoderListener() = default; 10 | HpackDecoderListener::~HpackDecoderListener() = default; 11 | 12 | HpackDecoderNoOpListener::HpackDecoderNoOpListener() = default; 13 | HpackDecoderNoOpListener::~HpackDecoderNoOpListener() = default; 14 | 15 | void HpackDecoderNoOpListener::OnHeaderListStart() {} 16 | void HpackDecoderNoOpListener::OnHeader(absl::string_view /*name*/, 17 | absl::string_view /*value*/) {} 18 | void HpackDecoderNoOpListener::OnHeaderListEnd() {} 19 | void HpackDecoderNoOpListener::OnHeaderErrorDetected( 20 | absl::string_view /*error_message*/) {} 21 | 22 | // static 23 | HpackDecoderNoOpListener* HpackDecoderNoOpListener::NoOpListener() { 24 | static HpackDecoderNoOpListener* static_instance = 25 | new HpackDecoderNoOpListener(); 26 | return static_instance; 27 | } 28 | 29 | } // namespace http2 30 | -------------------------------------------------------------------------------- /quiche/http2/hpack/hpack_entry.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/hpack/hpack_entry.h" 6 | 7 | #include 8 | #include 9 | #include 10 | 11 | #include "absl/strings/str_cat.h" 12 | #include "absl/strings/string_view.h" 13 | 14 | namespace spdy { 15 | 16 | HpackEntry::HpackEntry(std::string name, std::string value) 17 | : name_(std::move(name)), value_(std::move(value)) {} 18 | 19 | // static 20 | size_t HpackEntry::Size(absl::string_view name, absl::string_view value) { 21 | return name.size() + value.size() + kHpackEntrySizeOverhead; 22 | } 23 | size_t HpackEntry::Size() const { return Size(name(), value()); } 24 | 25 | std::string HpackEntry::GetDebugString() const { 26 | return absl::StrCat("{ name: \"", name_, "\", value: \"", value_, "\" }"); 27 | } 28 | 29 | } // namespace spdy 30 | -------------------------------------------------------------------------------- /quiche/http2/hpack/http2_hpack_constants.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/hpack/http2_hpack_constants.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "absl/strings/str_cat.h" 11 | 12 | namespace http2 { 13 | 14 | std::string HpackEntryTypeToString(HpackEntryType v) { 15 | switch (v) { 16 | case HpackEntryType::kIndexedHeader: 17 | return "kIndexedHeader"; 18 | case HpackEntryType::kDynamicTableSizeUpdate: 19 | return "kDynamicTableSizeUpdate"; 20 | case HpackEntryType::kIndexedLiteralHeader: 21 | return "kIndexedLiteralHeader"; 22 | case HpackEntryType::kUnindexedLiteralHeader: 23 | return "kUnindexedLiteralHeader"; 24 | case HpackEntryType::kNeverIndexedLiteralHeader: 25 | return "kNeverIndexedLiteralHeader"; 26 | } 27 | return absl::StrCat("UnknownHpackEntryType(", static_cast(v), ")"); 28 | } 29 | 30 | std::ostream& operator<<(std::ostream& out, HpackEntryType v) { 31 | return out << HpackEntryTypeToString(v); 32 | } 33 | 34 | } // namespace http2 35 | -------------------------------------------------------------------------------- /quiche/http2/hpack/huffman/huffman_spec_tables.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_HPACK_HUFFMAN_HUFFMAN_SPEC_TABLES_H_ 6 | #define QUICHE_HTTP2_HPACK_HUFFMAN_HUFFMAN_SPEC_TABLES_H_ 7 | 8 | // Tables describing the Huffman encoding of bytes as specified by RFC7541. 9 | 10 | #include 11 | 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | 14 | namespace http2 { 15 | 16 | struct QUICHE_EXPORT HuffmanSpecTables { 17 | // Number of bits in the encoding of each symbol (byte). 18 | static const uint8_t kCodeLengths[257]; 19 | 20 | // The encoding of each symbol, right justified (as printed), which means that 21 | // the last bit of the encoding is the low-order bit of the uint32. 22 | static const uint32_t kRightCodes[257]; 23 | 24 | // The encoding of each symbol, left justified (as printed), which means that 25 | // the first bit of the encoding is the high-order bit of the uint32. 26 | static const uint32_t kLeftCodes[257]; 27 | }; 28 | 29 | } // namespace http2 30 | 31 | #endif // QUICHE_HTTP2_HPACK_HUFFMAN_HUFFMAN_SPEC_TABLES_H_ 32 | -------------------------------------------------------------------------------- /quiche/http2/hpack/varint/hpack_varint_encoder.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_ 6 | #define QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_ 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | 14 | namespace http2 { 15 | 16 | // HPACK integer encoder class with single static method implementing variable 17 | // length integer representation defined in RFC7541, Section 5.1: 18 | // https://httpwg.org/specs/rfc7541.html#integer.representation 19 | class QUICHE_EXPORT HpackVarintEncoder { 20 | public: 21 | // Encode |varint|, appending encoded data to |*output|. 22 | // Appends between 1 and 11 bytes in total. 23 | static void Encode(uint8_t high_bits, uint8_t prefix_length, uint64_t varint, 24 | std::string* output); 25 | }; 26 | 27 | } // namespace http2 28 | 29 | #endif // QUICHE_HTTP2_HPACK_VARINT_HPACK_VARINT_ENCODER_H_ 30 | -------------------------------------------------------------------------------- /quiche/http2/test_tools/hpack_example.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_TEST_TOOLS_HPACK_EXAMPLE_H_ 6 | #define QUICHE_HTTP2_TEST_TOOLS_HPACK_EXAMPLE_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | 12 | // Parses HPACK examples in the format seen in the HPACK specification, 13 | // RFC 7541. For example: 14 | // 15 | // 10 | == Literal never indexed == 16 | // 08 | Literal name (len = 8) 17 | // 7061 7373 776f 7264 | password 18 | // 06 | Literal value (len = 6) 19 | // 7365 6372 6574 | secret 20 | // | -> password: secret 21 | // 22 | // (excluding the leading "//"). 23 | 24 | namespace http2 { 25 | namespace test { 26 | 27 | std::string HpackExampleToStringOrDie(absl::string_view example); 28 | 29 | } // namespace test 30 | } // namespace http2 31 | 32 | #endif // QUICHE_HTTP2_TEST_TOOLS_HPACK_EXAMPLE_H_ 33 | -------------------------------------------------------------------------------- /quiche/http2/test_tools/http2_structure_decoder_test_util.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/test_tools/http2_structure_decoder_test_util.h" 6 | 7 | #include 8 | 9 | namespace http2 { 10 | namespace test { 11 | 12 | // static 13 | void Http2StructureDecoderPeer::Randomize(Http2StructureDecoder* p, 14 | Http2Random* rng) { 15 | p->offset_ = rng->Rand32(); 16 | for (size_t i = 0; i < sizeof p->buffer_; ++i) { 17 | p->buffer_[i] = rng->Rand8(); 18 | } 19 | } 20 | 21 | } // namespace test 22 | } // namespace http2 23 | -------------------------------------------------------------------------------- /quiche/http2/test_tools/http2_structure_decoder_test_util.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_TEST_TOOLS_HTTP2_STRUCTURE_DECODER_TEST_UTIL_H_ 6 | #define QUICHE_HTTP2_TEST_TOOLS_HTTP2_STRUCTURE_DECODER_TEST_UTIL_H_ 7 | 8 | #include "quiche/http2/decoder/http2_structure_decoder.h" 9 | #include "quiche/http2/test_tools/http2_random.h" 10 | #include "quiche/common/platform/api/quiche_export.h" 11 | 12 | namespace http2 { 13 | namespace test { 14 | 15 | class QUICHE_NO_EXPORT Http2StructureDecoderPeer { 16 | public: 17 | // Overwrite the Http2StructureDecoder instance with random values. 18 | static void Randomize(Http2StructureDecoder* p, Http2Random* rng); 19 | }; 20 | 21 | } // namespace test 22 | } // namespace http2 23 | 24 | #endif // QUICHE_HTTP2_TEST_TOOLS_HTTP2_STRUCTURE_DECODER_TEST_UTIL_H_ 25 | -------------------------------------------------------------------------------- /quiche/http2/test_tools/mock_spdy_framer_visitor.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/http2/test_tools/mock_spdy_framer_visitor.h" 6 | 7 | namespace spdy { 8 | 9 | namespace test { 10 | 11 | MockSpdyFramerVisitor::MockSpdyFramerVisitor() { DelegateHeaderHandling(); } 12 | 13 | MockSpdyFramerVisitor::~MockSpdyFramerVisitor() = default; 14 | 15 | } // namespace test 16 | 17 | } // namespace spdy 18 | -------------------------------------------------------------------------------- /quiche/http2/test_tools/random_util.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_HTTP2_TEST_TOOLS_RANDOM_UTIL_H_ 6 | #define QUICHE_HTTP2_TEST_TOOLS_RANDOM_UTIL_H_ 7 | 8 | #include 9 | 10 | #include 11 | 12 | #include "quiche/http2/test_tools/http2_random.h" 13 | 14 | namespace http2 { 15 | namespace test { 16 | 17 | // Generate a string with the allowed character set for HTTP/2 / HPACK header 18 | // names. 19 | std::string GenerateHttp2HeaderName(size_t len, Http2Random* rng); 20 | 21 | // Generate a string with the web-safe string character set of specified len. 22 | std::string GenerateWebSafeString(size_t len, Http2Random* rng); 23 | 24 | // Generate a string with the web-safe string character set of length [lo, hi). 25 | std::string GenerateWebSafeString(size_t lo, size_t hi, Http2Random* rng); 26 | 27 | } // namespace test 28 | } // namespace http2 29 | 30 | #endif // QUICHE_HTTP2_TEST_TOOLS_RANDOM_UTIL_H_ 31 | -------------------------------------------------------------------------------- /quiche/quic/core/batch_writer/quic_sendmmsg_batch_writer_test.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/batch_writer/quic_sendmmsg_batch_writer.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | namespace { 10 | 11 | // Add tests here. 12 | 13 | } // namespace 14 | } // namespace test 15 | } // namespace quic 16 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_128_gcm_12_decrypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/aes_128_gcm_12_decrypter.h" 6 | 7 | #include "openssl/aead.h" 8 | #include "openssl/tls1.h" 9 | 10 | namespace quic { 11 | 12 | namespace { 13 | 14 | const size_t kKeySize = 16; 15 | const size_t kNonceSize = 12; 16 | 17 | } // namespace 18 | 19 | Aes128Gcm12Decrypter::Aes128Gcm12Decrypter() 20 | : AesBaseDecrypter(EVP_aead_aes_128_gcm(), kKeySize, kAuthTagSize, 21 | kNonceSize, 22 | /* use_ietf_nonce_construction */ false) { 23 | static_assert(kKeySize <= kMaxKeySize, "key size too big"); 24 | static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big"); 25 | } 26 | 27 | Aes128Gcm12Decrypter::~Aes128Gcm12Decrypter() {} 28 | 29 | uint32_t Aes128Gcm12Decrypter::cipher_id() const { 30 | return TLS1_CK_AES_128_GCM_SHA256; 31 | } 32 | 33 | } // namespace quic 34 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_128_gcm_12_encrypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/aes_128_gcm_12_encrypter.h" 6 | 7 | #include "openssl/evp.h" 8 | 9 | namespace quic { 10 | 11 | namespace { 12 | 13 | const size_t kKeySize = 16; 14 | const size_t kNonceSize = 12; 15 | 16 | } // namespace 17 | 18 | Aes128Gcm12Encrypter::Aes128Gcm12Encrypter() 19 | : AesBaseEncrypter(EVP_aead_aes_128_gcm(), kKeySize, kAuthTagSize, 20 | kNonceSize, 21 | /* use_ietf_nonce_construction */ false) { 22 | static_assert(kKeySize <= kMaxKeySize, "key size too big"); 23 | static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big"); 24 | } 25 | 26 | Aes128Gcm12Encrypter::~Aes128Gcm12Encrypter() {} 27 | 28 | } // namespace quic 29 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_128_gcm_decrypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/aes_128_gcm_decrypter.h" 6 | 7 | #include "openssl/aead.h" 8 | #include "openssl/tls1.h" 9 | #include "quiche/quic/platform/api/quic_flag_utils.h" 10 | #include "quiche/quic/platform/api/quic_flags.h" 11 | 12 | namespace quic { 13 | 14 | namespace { 15 | 16 | const size_t kKeySize = 16; 17 | const size_t kNonceSize = 12; 18 | 19 | } // namespace 20 | 21 | Aes128GcmDecrypter::Aes128GcmDecrypter() 22 | : AesBaseDecrypter(EVP_aead_aes_128_gcm(), kKeySize, kAuthTagSize, 23 | kNonceSize, 24 | /* use_ietf_nonce_construction */ true) { 25 | static_assert(kKeySize <= kMaxKeySize, "key size too big"); 26 | static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big"); 27 | } 28 | 29 | Aes128GcmDecrypter::~Aes128GcmDecrypter() {} 30 | 31 | uint32_t Aes128GcmDecrypter::cipher_id() const { 32 | return TLS1_CK_AES_128_GCM_SHA256; 33 | } 34 | 35 | } // namespace quic 36 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_128_gcm_encrypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/aes_128_gcm_encrypter.h" 6 | 7 | #include "openssl/evp.h" 8 | 9 | namespace quic { 10 | 11 | namespace { 12 | 13 | const size_t kKeySize = 16; 14 | const size_t kNonceSize = 12; 15 | 16 | } // namespace 17 | 18 | Aes128GcmEncrypter::Aes128GcmEncrypter() 19 | : AesBaseEncrypter(EVP_aead_aes_128_gcm(), kKeySize, kAuthTagSize, 20 | kNonceSize, 21 | /* use_ietf_nonce_construction */ true) { 22 | static_assert(kKeySize <= kMaxKeySize, "key size too big"); 23 | static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big"); 24 | } 25 | 26 | Aes128GcmEncrypter::~Aes128GcmEncrypter() {} 27 | 28 | } // namespace quic 29 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_128_gcm_encrypter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_AES_128_GCM_ENCRYPTER_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_AES_128_GCM_ENCRYPTER_H_ 7 | 8 | #include "quiche/quic/core/crypto/aes_base_encrypter.h" 9 | #include "quiche/quic/platform/api/quic_export.h" 10 | 11 | namespace quic { 12 | 13 | // An Aes128GcmEncrypter is a QuicEncrypter that implements the 14 | // AEAD_AES_128_GCM algorithm specified in RFC 5116 for use in IETF QUIC. 15 | // 16 | // It uses an authentication tag of 16 bytes (128 bits). It uses a 12 byte IV 17 | // that is XOR'd with the packet number to compute the nonce. 18 | class QUICHE_EXPORT Aes128GcmEncrypter : public AesBaseEncrypter { 19 | public: 20 | enum { 21 | kAuthTagSize = 16, 22 | }; 23 | 24 | Aes128GcmEncrypter(); 25 | Aes128GcmEncrypter(const Aes128GcmEncrypter&) = delete; 26 | Aes128GcmEncrypter& operator=(const Aes128GcmEncrypter&) = delete; 27 | ~Aes128GcmEncrypter() override; 28 | }; 29 | 30 | } // namespace quic 31 | 32 | #endif // QUICHE_QUIC_CORE_CRYPTO_AES_128_GCM_ENCRYPTER_H_ 33 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_256_gcm_decrypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/aes_256_gcm_decrypter.h" 6 | 7 | #include "openssl/aead.h" 8 | #include "openssl/tls1.h" 9 | #include "quiche/quic/platform/api/quic_flag_utils.h" 10 | #include "quiche/quic/platform/api/quic_flags.h" 11 | 12 | namespace quic { 13 | 14 | namespace { 15 | 16 | const size_t kKeySize = 32; 17 | const size_t kNonceSize = 12; 18 | 19 | } // namespace 20 | 21 | Aes256GcmDecrypter::Aes256GcmDecrypter() 22 | : AesBaseDecrypter(EVP_aead_aes_256_gcm(), kKeySize, kAuthTagSize, 23 | kNonceSize, 24 | /* use_ietf_nonce_construction */ true) { 25 | static_assert(kKeySize <= kMaxKeySize, "key size too big"); 26 | static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big"); 27 | } 28 | 29 | Aes256GcmDecrypter::~Aes256GcmDecrypter() {} 30 | 31 | uint32_t Aes256GcmDecrypter::cipher_id() const { 32 | return TLS1_CK_AES_256_GCM_SHA384; 33 | } 34 | 35 | } // namespace quic 36 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_256_gcm_encrypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/aes_256_gcm_encrypter.h" 6 | 7 | #include "openssl/evp.h" 8 | 9 | namespace quic { 10 | 11 | namespace { 12 | 13 | const size_t kKeySize = 32; 14 | const size_t kNonceSize = 12; 15 | 16 | } // namespace 17 | 18 | Aes256GcmEncrypter::Aes256GcmEncrypter() 19 | : AesBaseEncrypter(EVP_aead_aes_256_gcm(), kKeySize, kAuthTagSize, 20 | kNonceSize, 21 | /* use_ietf_nonce_construction */ true) { 22 | static_assert(kKeySize <= kMaxKeySize, "key size too big"); 23 | static_assert(kNonceSize <= kMaxNonceSize, "nonce size too big"); 24 | } 25 | 26 | Aes256GcmEncrypter::~Aes256GcmEncrypter() {} 27 | 28 | } // namespace quic 29 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_256_gcm_encrypter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_AES_256_GCM_ENCRYPTER_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_AES_256_GCM_ENCRYPTER_H_ 7 | 8 | #include "quiche/quic/core/crypto/aes_base_encrypter.h" 9 | #include "quiche/quic/platform/api/quic_export.h" 10 | 11 | namespace quic { 12 | 13 | // An Aes256GcmEncrypter is a QuicEncrypter that implements the 14 | // AEAD_AES_256_GCM algorithm specified in RFC 5116 for use in IETF QUIC. 15 | // 16 | // It uses an authentication tag of 16 bytes (128 bits). It uses a 12 byte IV 17 | // that is XOR'd with the packet number to compute the nonce. 18 | class QUICHE_EXPORT Aes256GcmEncrypter : public AesBaseEncrypter { 19 | public: 20 | enum { 21 | kAuthTagSize = 16, 22 | }; 23 | 24 | Aes256GcmEncrypter(); 25 | Aes256GcmEncrypter(const Aes256GcmEncrypter&) = delete; 26 | Aes256GcmEncrypter& operator=(const Aes256GcmEncrypter&) = delete; 27 | ~Aes256GcmEncrypter() override; 28 | }; 29 | 30 | } // namespace quic 31 | 32 | #endif // QUICHE_QUIC_CORE_CRYPTO_AES_256_GCM_ENCRYPTER_H_ 33 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_base_decrypter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_AES_BASE_DECRYPTER_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_AES_BASE_DECRYPTER_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "openssl/aes.h" 12 | #include "quiche/quic/core/crypto/aead_base_decrypter.h" 13 | #include "quiche/quic/platform/api/quic_export.h" 14 | 15 | namespace quic { 16 | 17 | class QUICHE_EXPORT AesBaseDecrypter : public AeadBaseDecrypter { 18 | public: 19 | using AeadBaseDecrypter::AeadBaseDecrypter; 20 | 21 | bool SetHeaderProtectionKey(absl::string_view key) override; 22 | std::string GenerateHeaderProtectionMask( 23 | QuicDataReader* sample_reader) override; 24 | QuicPacketCount GetIntegrityLimit() const override; 25 | 26 | private: 27 | // The key used for packet number encryption. 28 | AES_KEY pne_key_; 29 | }; 30 | 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_CORE_CRYPTO_AES_BASE_DECRYPTER_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/aes_base_encrypter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_AES_BASE_ENCRYPTER_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_AES_BASE_ENCRYPTER_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "openssl/aes.h" 12 | #include "quiche/quic/core/crypto/aead_base_encrypter.h" 13 | #include "quiche/quic/platform/api/quic_export.h" 14 | 15 | namespace quic { 16 | 17 | class QUICHE_EXPORT AesBaseEncrypter : public AeadBaseEncrypter { 18 | public: 19 | using AeadBaseEncrypter::AeadBaseEncrypter; 20 | 21 | bool SetHeaderProtectionKey(absl::string_view key) override; 22 | std::string GenerateHeaderProtectionMask(absl::string_view sample) override; 23 | QuicPacketCount GetConfidentialityLimit() const override; 24 | 25 | private: 26 | // The key used for packet number encryption. 27 | AES_KEY pne_key_; 28 | }; 29 | 30 | } // namespace quic 31 | 32 | #endif // QUICHE_QUIC_CORE_CRYPTO_AES_BASE_ENCRYPTER_H_ 33 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/boring_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_BORING_UTILS_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_BORING_UTILS_H_ 7 | 8 | #include "absl/strings/string_view.h" 9 | #include "openssl/bytestring.h" 10 | #include "quiche/quic/platform/api/quic_export.h" 11 | 12 | namespace quic { 13 | 14 | inline QUICHE_EXPORT absl::string_view CbsToStringPiece(CBS cbs) { 15 | return absl::string_view(reinterpret_cast(CBS_data(&cbs)), 16 | CBS_len(&cbs)); 17 | } 18 | 19 | inline QUICHE_EXPORT CBS StringPieceToCbs(absl::string_view piece) { 20 | CBS result; 21 | CBS_init(&result, reinterpret_cast(piece.data()), 22 | piece.size()); 23 | return result; 24 | } 25 | 26 | inline QUICHE_EXPORT bool AddStringToCbb(CBB* cbb, absl::string_view piece) { 27 | return 1 == CBB_add_bytes(cbb, reinterpret_cast(piece.data()), 28 | piece.size()); 29 | } 30 | 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_CORE_CRYPTO_BORING_UTILS_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/certificate_view_der_fuzzer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include 6 | #include 7 | 8 | #include "quiche/quic/core/crypto/certificate_view.h" 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 11 | std::string input(reinterpret_cast(data), size); 12 | 13 | std::unique_ptr view = 14 | quic::CertificateView::ParseSingleCertificate(input); 15 | if (view != nullptr) { 16 | view->GetHumanReadableSubject(); 17 | } 18 | quic::CertificatePrivateKey::LoadFromDer(input); 19 | return 0; 20 | } 21 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/certificate_view_pem_fuzzer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include 6 | #include 7 | 8 | #include "quiche/quic/core/crypto/certificate_view.h" 9 | 10 | extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { 11 | std::string input(reinterpret_cast(data), size); 12 | std::stringstream stream(input); 13 | 14 | quic::CertificateView::LoadPemFromStream(&stream); 15 | stream.seekg(0); 16 | quic::CertificatePrivateKey::LoadPemFromStream(&stream); 17 | return 0; 18 | } 19 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/chacha_base_decrypter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_CHACHA_BASE_DECRYPTER_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_CHACHA_BASE_DECRYPTER_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "quiche/quic/core/crypto/aead_base_decrypter.h" 12 | #include "quiche/quic/platform/api/quic_export.h" 13 | 14 | namespace quic { 15 | 16 | class QUICHE_EXPORT ChaChaBaseDecrypter : public AeadBaseDecrypter { 17 | public: 18 | using AeadBaseDecrypter::AeadBaseDecrypter; 19 | 20 | bool SetHeaderProtectionKey(absl::string_view key) override; 21 | std::string GenerateHeaderProtectionMask( 22 | QuicDataReader* sample_reader) override; 23 | 24 | private: 25 | // The key used for packet number encryption. 26 | unsigned char pne_key_[kMaxKeySize]; 27 | }; 28 | 29 | } // namespace quic 30 | 31 | #endif // QUICHE_QUIC_CORE_CRYPTO_CHACHA_BASE_DECRYPTER_H_ 32 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/chacha_base_encrypter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_CHACHA_BASE_ENCRYPTER_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_CHACHA_BASE_ENCRYPTER_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "quiche/quic/core/crypto/aead_base_encrypter.h" 12 | #include "quiche/quic/platform/api/quic_export.h" 13 | 14 | namespace quic { 15 | 16 | class QUICHE_EXPORT ChaChaBaseEncrypter : public AeadBaseEncrypter { 17 | public: 18 | using AeadBaseEncrypter::AeadBaseEncrypter; 19 | 20 | bool SetHeaderProtectionKey(absl::string_view key) override; 21 | std::string GenerateHeaderProtectionMask(absl::string_view sample) override; 22 | 23 | private: 24 | // The key used for packet number encryption. 25 | unsigned char pne_key_[kMaxKeySize]; 26 | }; 27 | 28 | } // namespace quic 29 | 30 | #endif // QUICHE_QUIC_CORE_CRYPTO_CHACHA_BASE_ENCRYPTER_H_ 31 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/quic_crypter.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/quic_crypter.h" 6 | 7 | #include "absl/strings/string_view.h" 8 | 9 | namespace quic { 10 | 11 | bool QuicCrypter::SetNoncePrefixOrIV(const ParsedQuicVersion& version, 12 | absl::string_view nonce_prefix_or_iv) { 13 | if (version.UsesInitialObfuscators()) { 14 | return SetIV(nonce_prefix_or_iv); 15 | } 16 | return SetNoncePrefix(nonce_prefix_or_iv); 17 | } 18 | 19 | } // namespace quic 20 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/quic_crypto_proof.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/crypto/quic_crypto_proof.h" 6 | 7 | namespace quic { 8 | 9 | QuicCryptoProof::QuicCryptoProof() 10 | : send_expect_ct_header(false), cert_matched_sni(false) {} 11 | 12 | } // namespace quic 13 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/quic_crypto_proof.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_QUIC_CRYPTO_PROOF_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_QUIC_CRYPTO_PROOF_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/platform/api/quic_export.h" 11 | 12 | namespace quic { 13 | 14 | // Contains the crypto-related data provided by ProofSource 15 | struct QUICHE_EXPORT QuicCryptoProof { 16 | QuicCryptoProof(); 17 | 18 | // Signature generated by ProofSource 19 | std::string signature; 20 | // SCTList (RFC6962) to be sent to the client, if it supports receiving it. 21 | std::string leaf_cert_scts; 22 | // Should the Expect-CT header be sent on the connection where the 23 | // certificate is used. 24 | bool send_expect_ct_header; 25 | // Did the selected leaf certificate contain a SubjectAltName that included 26 | // the requested SNI. 27 | bool cert_matched_sni; 28 | }; 29 | 30 | } // namespace quic 31 | 32 | #endif // QUICHE_QUIC_CORE_CRYPTO_QUIC_CRYPTO_PROOF_H_ 33 | -------------------------------------------------------------------------------- /quiche/quic/core/crypto/quic_random.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_CRYPTO_QUIC_RANDOM_H_ 6 | #define QUICHE_QUIC_CORE_CRYPTO_QUIC_RANDOM_H_ 7 | 8 | #include "quiche/common/quiche_random.h" 9 | 10 | namespace quic { 11 | 12 | using QuicRandom = quiche::QuicheRandom; 13 | 14 | } // namespace quic 15 | 16 | #endif // QUICHE_QUIC_CORE_CRYPTO_QUIC_RANDOM_H_ 17 | -------------------------------------------------------------------------------- /quiche/quic/core/flow_label.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2024 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_QUIC_FLOW_LABEL_H_ 6 | #define QUICHE_QUIC_CORE_QUIC_FLOW_LABEL_H_ 7 | 8 | #include 9 | 10 | #if defined(__linux__) 11 | #include 12 | #include 13 | 14 | #ifndef IPV6_FLOWLABEL 15 | #define IPV6_FLOWINFO 11 16 | #define IPV6_FLOWINFO_FLOWLABEL 0x000fffff 17 | #endif 18 | 19 | static constexpr int kCmsgSpaceForFlowLabel = CMSG_SPACE(sizeof(uint32_t)); 20 | 21 | #endif 22 | 23 | #endif // QUICHE_QUIC_CORE_QUIC_FLOW_LABEL_H_ 24 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_handshake_done_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_handshake_done_frame.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | QuicHandshakeDoneFrame::QuicHandshakeDoneFrame() 12 | : QuicInlinedFrame(HANDSHAKE_DONE_FRAME) {} 13 | 14 | QuicHandshakeDoneFrame::QuicHandshakeDoneFrame( 15 | QuicControlFrameId control_frame_id) 16 | : QuicInlinedFrame(HANDSHAKE_DONE_FRAME), 17 | control_frame_id(control_frame_id) {} 18 | 19 | std::ostream& operator<<(std::ostream& os, 20 | const QuicHandshakeDoneFrame& handshake_done_frame) { 21 | os << "{ control_frame_id: " << handshake_done_frame.control_frame_id 22 | << " }\n"; 23 | return os; 24 | } 25 | 26 | } // namespace quic 27 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_immediate_ack_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_immediate_ack_frame.h" 6 | 7 | #include 8 | 9 | #include "quiche/quic/core/frames/quic_inlined_frame.h" 10 | #include "quiche/quic/core/quic_types.h" 11 | 12 | namespace quic { 13 | 14 | QuicImmediateAckFrame::QuicImmediateAckFrame() 15 | : QuicInlinedFrame(IMMEDIATE_ACK_FRAME) {} 16 | 17 | std::ostream& operator<<(std::ostream& os, 18 | const QuicImmediateAckFrame& /*immediate_ack_frame*/) { 19 | os << "{ }\n"; 20 | return os; 21 | } 22 | 23 | } // namespace quic 24 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_immediate_ack_frame.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2025 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_IMMEDIATE_ACK_FRAME_H_ 6 | #define QUICHE_QUIC_CORE_FRAMES_QUIC_IMMEDIATE_ACK_FRAME_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/frames/quic_inlined_frame.h" 11 | #include "quiche/quic/core/quic_types.h" 12 | #include "quiche/common/platform/api/quiche_export.h" 13 | 14 | namespace quic { 15 | 16 | // A frame that allows the sender to request an immediate ack from the receiver. 17 | // Not a retransmittable frame. 18 | struct QUICHE_EXPORT QuicImmediateAckFrame 19 | : QuicInlinedFrame { 20 | QuicImmediateAckFrame(); 21 | 22 | friend QUICHE_EXPORT std::ostream& operator<<( 23 | std::ostream& os, const QuicImmediateAckFrame& immediate_ack_frame); 24 | 25 | QuicFrameType type; 26 | }; 27 | 28 | } // namespace quic 29 | 30 | #endif // QUICHE_QUIC_CORE_FRAMES_QUIC_IMMEDIATE_ACK_FRAME_H_ 31 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_max_streams_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_max_streams_frame.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | QuicMaxStreamsFrame::QuicMaxStreamsFrame() 12 | : QuicInlinedFrame(MAX_STREAMS_FRAME) {} 13 | 14 | QuicMaxStreamsFrame::QuicMaxStreamsFrame(QuicControlFrameId control_frame_id, 15 | QuicStreamCount stream_count, 16 | bool unidirectional) 17 | : QuicInlinedFrame(MAX_STREAMS_FRAME), 18 | control_frame_id(control_frame_id), 19 | stream_count(stream_count), 20 | unidirectional(unidirectional) {} 21 | 22 | std::ostream& operator<<(std::ostream& os, const QuicMaxStreamsFrame& frame) { 23 | os << "{ control_frame_id: " << frame.control_frame_id 24 | << ", stream_count: " << frame.stream_count 25 | << ((frame.unidirectional) ? ", unidirectional }\n" 26 | : ", bidirectional }\n"); 27 | return os; 28 | } 29 | 30 | } // namespace quic 31 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_mtu_discovery_frame.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_MTU_DISCOVERY_FRAME_H_ 6 | #define QUICHE_QUIC_CORE_FRAMES_QUIC_MTU_DISCOVERY_FRAME_H_ 7 | 8 | #include "quiche/quic/core/frames/quic_inlined_frame.h" 9 | #include "quiche/quic/core/quic_types.h" 10 | #include "quiche/quic/platform/api/quic_export.h" 11 | 12 | namespace quic { 13 | 14 | // A path MTU discovery frame contains no payload and is serialized as a ping 15 | // frame. 16 | struct QUICHE_EXPORT QuicMtuDiscoveryFrame 17 | : public QuicInlinedFrame { 18 | QuicMtuDiscoveryFrame() : QuicInlinedFrame(MTU_DISCOVERY_FRAME) {} 19 | 20 | QuicFrameType type; 21 | }; 22 | 23 | } // namespace quic 24 | 25 | #endif // QUICHE_QUIC_CORE_FRAMES_QUIC_MTU_DISCOVERY_FRAME_H_ 26 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_new_token_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_new_token_frame.h" 6 | 7 | #include 8 | 9 | #include "absl/strings/escaping.h" 10 | #include "quiche/quic/platform/api/quic_logging.h" 11 | 12 | namespace quic { 13 | 14 | QuicNewTokenFrame::QuicNewTokenFrame(QuicControlFrameId control_frame_id, 15 | absl::string_view token) 16 | : control_frame_id(control_frame_id), 17 | token(std::string(token.data(), token.length())) {} 18 | 19 | std::ostream& operator<<(std::ostream& os, const QuicNewTokenFrame& s) { 20 | os << "{ control_frame_id: " << s.control_frame_id 21 | << ", token: " << absl::BytesToHexString(s.token) << " }\n"; 22 | return os; 23 | } 24 | 25 | } // namespace quic 26 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_padding_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_padding_frame.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | std::ostream& operator<<(std::ostream& os, 12 | const QuicPaddingFrame& padding_frame) { 13 | os << "{ num_padding_bytes: " << padding_frame.num_padding_bytes << " }\n"; 14 | return os; 15 | } 16 | 17 | } // namespace quic 18 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_ping_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_ping_frame.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | QuicPingFrame::QuicPingFrame() : QuicInlinedFrame(PING_FRAME) {} 12 | 13 | QuicPingFrame::QuicPingFrame(QuicControlFrameId control_frame_id) 14 | : QuicInlinedFrame(PING_FRAME), control_frame_id(control_frame_id) {} 15 | 16 | std::ostream& operator<<(std::ostream& os, const QuicPingFrame& ping_frame) { 17 | os << "{ control_frame_id: " << ping_frame.control_frame_id << " }\n"; 18 | return os; 19 | } 20 | 21 | } // namespace quic 22 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_retire_connection_id_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_retire_connection_id_frame.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | QuicRetireConnectionIdFrame::QuicRetireConnectionIdFrame( 12 | QuicControlFrameId control_frame_id, 13 | QuicConnectionIdSequenceNumber sequence_number) 14 | : control_frame_id(control_frame_id), sequence_number(sequence_number) {} 15 | 16 | std::ostream& operator<<(std::ostream& os, 17 | const QuicRetireConnectionIdFrame& frame) { 18 | os << "{ control_frame_id: " << frame.control_frame_id 19 | << ", sequence_number: " << frame.sequence_number << " }\n"; 20 | return os; 21 | } 22 | 23 | } // namespace quic 24 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_stop_waiting_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_stop_waiting_frame.h" 6 | 7 | #include 8 | 9 | #include "quiche/quic/core/quic_constants.h" 10 | 11 | namespace quic { 12 | 13 | QuicStopWaitingFrame::QuicStopWaitingFrame() 14 | : QuicInlinedFrame(STOP_WAITING_FRAME) {} 15 | 16 | std::ostream& operator<<(std::ostream& os, 17 | const QuicStopWaitingFrame& sent_info) { 18 | os << "{ least_unacked: " << sent_info.least_unacked << " }\n"; 19 | return os; 20 | } 21 | 22 | } // namespace quic 23 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_stop_waiting_frame.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_FRAMES_QUIC_STOP_WAITING_FRAME_H_ 6 | #define QUICHE_QUIC_CORE_FRAMES_QUIC_STOP_WAITING_FRAME_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/frames/quic_inlined_frame.h" 11 | #include "quiche/quic/core/quic_types.h" 12 | #include "quiche/quic/platform/api/quic_export.h" 13 | 14 | namespace quic { 15 | 16 | struct QUICHE_EXPORT QuicStopWaitingFrame 17 | : public QuicInlinedFrame { 18 | QuicStopWaitingFrame(); 19 | 20 | friend QUICHE_EXPORT std::ostream& operator<<(std::ostream& os, 21 | const QuicStopWaitingFrame& s); 22 | 23 | QuicFrameType type; 24 | 25 | // The lowest packet we've sent which is unacked, and we expect an ack for. 26 | QuicPacketNumber least_unacked; 27 | }; 28 | 29 | } // namespace quic 30 | 31 | #endif // QUICHE_QUIC_CORE_FRAMES_QUIC_STOP_WAITING_FRAME_H_ 32 | -------------------------------------------------------------------------------- /quiche/quic/core/frames/quic_streams_blocked_frame.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/frames/quic_streams_blocked_frame.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | QuicStreamsBlockedFrame::QuicStreamsBlockedFrame() 12 | : QuicInlinedFrame(STREAMS_BLOCKED_FRAME) {} 13 | 14 | QuicStreamsBlockedFrame::QuicStreamsBlockedFrame( 15 | QuicControlFrameId control_frame_id, QuicStreamCount stream_count, 16 | bool unidirectional) 17 | : QuicInlinedFrame(STREAMS_BLOCKED_FRAME), 18 | control_frame_id(control_frame_id), 19 | stream_count(stream_count), 20 | unidirectional(unidirectional) {} 21 | 22 | std::ostream& operator<<(std::ostream& os, 23 | const QuicStreamsBlockedFrame& frame) { 24 | os << "{ control_frame_id: " << frame.control_frame_id 25 | << ", stream count: " << frame.stream_count 26 | << ((frame.unidirectional) ? ", unidirectional }\n" 27 | : ", bidirectional }\n"); 28 | 29 | return os; 30 | } 31 | 32 | } // namespace quic 33 | -------------------------------------------------------------------------------- /quiche/quic/core/io/quic_default_event_loop.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_IO_QUIC_DEFAULT_EVENT_LOOP_H_ 6 | #define QUICHE_QUIC_CORE_IO_QUIC_DEFAULT_EVENT_LOOP_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/io/quic_event_loop.h" 11 | 12 | namespace quic { 13 | 14 | // Returns the default implementation of QuicheEventLoop. The embedders can 15 | // override this using the platform API. The factory pointer returned is an 16 | // unowned static variable. 17 | QuicEventLoopFactory* GetDefaultEventLoop(); 18 | 19 | // Returns the factory objects for all event loops. This is particularly useful 20 | // for the unit tests. The factory pointers returned are unowned static 21 | // variables. 22 | std::vector GetAllSupportedEventLoops(); 23 | 24 | } // namespace quic 25 | 26 | #endif // QUICHE_QUIC_CORE_IO_QUIC_DEFAULT_EVENT_LOOP_H_ 27 | -------------------------------------------------------------------------------- /quiche/quic/core/proto/cached_network_parameters_proto.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_PROTO_CACHED_NETWORK_PARAMETERS_PROTO_H_ 6 | #define QUICHE_QUIC_CORE_PROTO_CACHED_NETWORK_PARAMETERS_PROTO_H_ 7 | 8 | #include "quiche/quic/core/proto/cached_network_parameters.pb.h" 9 | 10 | #endif // QUICHE_QUIC_CORE_PROTO_CACHED_NETWORK_PARAMETERS_PROTO_H_ 11 | -------------------------------------------------------------------------------- /quiche/quic/core/proto/crypto_server_config_proto.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_PROTO_CRYPTO_SERVER_CONFIG_PROTO_H_ 6 | #define QUICHE_QUIC_CORE_PROTO_CRYPTO_SERVER_CONFIG_PROTO_H_ 7 | 8 | #include "quiche/quic/core/proto/crypto_server_config.pb.h" 9 | 10 | #endif // QUICHE_QUIC_CORE_PROTO_CRYPTO_SERVER_CONFIG_PROTO_H_ 11 | -------------------------------------------------------------------------------- /quiche/quic/core/proto/source_address_token_proto.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_PROTO_SOURCE_ADDRESS_TOKEN_PROTO_H_ 6 | #define QUICHE_QUIC_CORE_PROTO_SOURCE_ADDRESS_TOKEN_PROTO_H_ 7 | 8 | #include "quiche/quic/core/proto/source_address_token.pb.h" 9 | 10 | #endif // QUICHE_QUIC_CORE_PROTO_SOURCE_ADDRESS_TOKEN_PROTO_H_ 11 | -------------------------------------------------------------------------------- /quiche/quic/core/qpack/qpack_static_table.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_QPACK_QPACK_STATIC_TABLE_H_ 6 | #define QUICHE_QUIC_CORE_QPACK_QPACK_STATIC_TABLE_H_ 7 | 8 | #include 9 | 10 | #include "quiche/http2/hpack/hpack_constants.h" 11 | #include "quiche/http2/hpack/hpack_static_table.h" 12 | #include "quiche/quic/platform/api/quic_export.h" 13 | 14 | namespace quic { 15 | 16 | using QpackStaticEntry = spdy::HpackStaticEntry; 17 | using QpackStaticTable = spdy::HpackStaticTable; 18 | 19 | // QPACK static table defined at 20 | // https://rfc-editor.org/rfc/rfc9204.html#section-3.1. 21 | QUICHE_EXPORT const std::vector& QpackStaticTableVector(); 22 | 23 | // Returns a QpackStaticTable instance initialized with kQpackStaticTable. 24 | // The instance is read-only, has static lifetime, and is safe to share amoung 25 | // threads. This function is thread-safe. 26 | QUICHE_EXPORT const QpackStaticTable& ObtainQpackStaticTable(); 27 | 28 | } // namespace quic 29 | 30 | #endif // QUICHE_QUIC_CORE_QPACK_QPACK_STATIC_TABLE_H_ 31 | -------------------------------------------------------------------------------- /quiche/quic/core/qpack/qpack_stream_receiver.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_RECEIVER_H_ 6 | #define QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_RECEIVER_H_ 7 | 8 | #include "absl/strings/string_view.h" 9 | #include "quiche/quic/platform/api/quic_export.h" 10 | 11 | namespace quic { 12 | 13 | // This interface decodes QPACK data that are received on a QpackReceiveStream. 14 | class QUICHE_EXPORT QpackStreamReceiver { 15 | public: 16 | virtual ~QpackStreamReceiver() = default; 17 | 18 | // Decode data. 19 | virtual void Decode(absl::string_view data) = 0; 20 | }; 21 | 22 | } // namespace quic 23 | 24 | #endif // QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_RECEIVER_H_ 25 | -------------------------------------------------------------------------------- /quiche/quic/core/qpack/qpack_stream_sender_delegate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_SENDER_DELEGATE_H_ 6 | #define QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_SENDER_DELEGATE_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "quiche/quic/platform/api/quic_export.h" 12 | 13 | namespace quic { 14 | 15 | // This interface writes encoder/decoder data to peer. 16 | class QUICHE_EXPORT QpackStreamSenderDelegate { 17 | public: 18 | virtual ~QpackStreamSenderDelegate() = default; 19 | 20 | // Write data on the unidirectional stream. 21 | virtual void WriteStreamData(absl::string_view data) = 0; 22 | 23 | // Return the number of bytes buffered due to underlying stream being blocked. 24 | virtual uint64_t NumBytesBuffered() const = 0; 25 | }; 26 | 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_CORE_QPACK_QPACK_STREAM_SENDER_DELEGATE_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_ack_listener_interface.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/quic_ack_listener_interface.h" 6 | 7 | namespace quic { 8 | 9 | QuicAckListenerInterface::~QuicAckListenerInterface() {} 10 | 11 | } // namespace quic 12 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_blocked_writer_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // This is an interface for all objects that want to be notified that 6 | // the underlying UDP socket is available for writing (not write blocked 7 | // anymore). 8 | 9 | #ifndef QUICHE_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_ 10 | #define QUICHE_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_ 11 | 12 | #include "quiche/quic/platform/api/quic_export.h" 13 | 14 | namespace quic { 15 | 16 | class QUICHE_EXPORT QuicBlockedWriterInterface { 17 | public: 18 | virtual ~QuicBlockedWriterInterface() {} 19 | 20 | // Called by the PacketWriter when the underlying socket becomes writable 21 | // so that the BlockedWriter can go ahead and try writing. 22 | virtual void OnBlockedWriterCanWrite() = 0; 23 | 24 | virtual bool IsWriterBlocked() const = 0; 25 | }; 26 | 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_CORE_QUIC_BLOCKED_WRITER_INTERFACE_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_connection_context.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/quic_connection_context.h" 6 | 7 | #include "absl/base/attributes.h" 8 | 9 | namespace quic { 10 | namespace { 11 | ABSL_CONST_INIT thread_local QuicConnectionContext* current_context = nullptr; 12 | } // namespace 13 | 14 | // static 15 | QuicConnectionContext* QuicConnectionContext::Current() { 16 | return current_context; 17 | } 18 | 19 | QuicConnectionContextSwitcher::QuicConnectionContextSwitcher( 20 | QuicConnectionContext* new_context) 21 | : old_context_(QuicConnectionContext::Current()) { 22 | current_context = new_context; 23 | if (new_context && new_context->listener) { 24 | new_context->listener->Activate(); 25 | } 26 | } 27 | 28 | QuicConnectionContextSwitcher::~QuicConnectionContextSwitcher() { 29 | QuicConnectionContext* current = QuicConnectionContext::Current(); 30 | if (current && current->listener) { 31 | current->listener->Deactivate(); 32 | } 33 | current_context = old_context_; 34 | } 35 | 36 | } // namespace quic 37 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_default_clock.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/quic_default_clock.h" 6 | 7 | #include "absl/time/clock.h" 8 | 9 | namespace quic { 10 | 11 | QuicDefaultClock* QuicDefaultClock::Get() { 12 | static QuicDefaultClock* clock = new QuicDefaultClock(); 13 | return clock; 14 | } 15 | 16 | QuicTime QuicDefaultClock::ApproximateNow() const { return Now(); } 17 | 18 | QuicTime QuicDefaultClock::Now() const { 19 | return CreateTimeFromMicroseconds(absl::GetCurrentTimeNanos() / 1000); 20 | } 21 | 22 | QuicWallTime QuicDefaultClock::WallNow() const { 23 | return QuicWallTime::FromUNIXMicroseconds(absl::GetCurrentTimeNanos() / 1000); 24 | } 25 | 26 | } // namespace quic 27 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_default_clock.h: -------------------------------------------------------------------------------- 1 | // Copyright 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_QUIC_DEFAULT_CLOCK_H_ 6 | #define QUICHE_QUIC_CORE_QUIC_DEFAULT_CLOCK_H_ 7 | 8 | #include "quiche/quic/core/quic_clock.h" 9 | #include "quiche/quic/core/quic_time.h" 10 | #include "quiche/quic/platform/api/quic_export.h" 11 | 12 | namespace quic { 13 | 14 | // A QuicClock based on Abseil time API. Thread-safe. 15 | class QUICHE_EXPORT QuicDefaultClock : public QuicClock { 16 | public: 17 | // Provides a single default stateless instance of QuicDefaultClock. 18 | static QuicDefaultClock* Get(); 19 | 20 | explicit QuicDefaultClock() = default; 21 | QuicDefaultClock(const QuicDefaultClock&) = delete; 22 | QuicDefaultClock& operator=(const QuicDefaultClock&) = delete; 23 | 24 | // QuicClock implementation. 25 | QuicTime ApproximateNow() const override; 26 | QuicTime Now() const override; 27 | QuicWallTime WallNow() const override; 28 | }; 29 | 30 | } // namespace quic 31 | 32 | #endif // QUICHE_QUIC_CORE_QUIC_DEFAULT_CLOCK_H_ 33 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_dispatcher_stats.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/core/quic_dispatcher_stats.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | std::ostream& operator<<(std::ostream& os, const QuicDispatcherStats& s) { 12 | os << "{ packets_processed: " << s.packets_processed; 13 | os << ", packets_processed_with_unknown_cid: " 14 | << s.packets_processed_with_unknown_cid; 15 | os << ", packets_processed_with_replaced_cid_in_store: " 16 | << s.packets_processed_with_replaced_cid_in_store; 17 | os << ", packets_enqueued_early: " << s.packets_enqueued_early; 18 | os << ", packets_enqueued_chlo: " << s.packets_enqueued_chlo; 19 | os << ", packets_sent: " << s.packets_sent; 20 | os << ", sessions_created: " << s.sessions_created; 21 | os << " }"; 22 | 23 | return os; 24 | } 25 | 26 | } // namespace quic 27 | -------------------------------------------------------------------------------- /quiche/quic/core/quic_process_packet_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_QUIC_PROCESS_PACKET_INTERFACE_H_ 6 | #define QUICHE_QUIC_CORE_QUIC_PROCESS_PACKET_INTERFACE_H_ 7 | 8 | #include "quiche/quic/core/quic_packets.h" 9 | #include "quiche/quic/platform/api/quic_socket_address.h" 10 | 11 | namespace quic { 12 | 13 | // A class to process each incoming packet. 14 | class QUICHE_EXPORT ProcessPacketInterface { 15 | public: 16 | virtual ~ProcessPacketInterface() {} 17 | virtual void ProcessPacket(const QuicSocketAddress& self_address, 18 | const QuicSocketAddress& peer_address, 19 | const QuicReceivedPacket& packet) = 0; 20 | }; 21 | 22 | } // namespace quic 23 | 24 | #endif // QUICHE_QUIC_CORE_QUIC_PROCESS_PACKET_INTERFACE_H_ 25 | -------------------------------------------------------------------------------- /quiche/quic/core/web_transport_stats.h: -------------------------------------------------------------------------------- 1 | // Copyright 2023 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_CORE_WEB_TRANSPORT_STATS_H_ 6 | #define QUICHE_QUIC_CORE_WEB_TRANSPORT_STATS_H_ 7 | 8 | #include "quiche/quic/core/quic_session.h" 9 | #include "quiche/common/platform/api/quiche_export.h" 10 | #include "quiche/web_transport/web_transport.h" 11 | 12 | namespace quic { 13 | 14 | QUICHE_EXPORT webtransport::DatagramStats 15 | WebTransportDatagramStatsForQuicSession(const QuicSession& session); 16 | 17 | QUICHE_EXPORT webtransport::SessionStats WebTransportStatsForQuicSession( 18 | const QuicSession& session); 19 | 20 | } // namespace quic 21 | 22 | #endif // QUICHE_QUIC_CORE_WEB_TRANSPORT_STATS_H_ 23 | -------------------------------------------------------------------------------- /quiche/quic/masque/README.md: -------------------------------------------------------------------------------- 1 | # MASQUE 2 | 3 | The files in this directory contain a prototype implementation of various 4 | [MASQUE documents](https://datatracker.ietf.org/wg/masque/documents/). This 5 | prototype is not ready for production use. 6 | -------------------------------------------------------------------------------- /quiche/quic/masque/masque_server.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_MASQUE_MASQUE_SERVER_H_ 6 | #define QUICHE_QUIC_MASQUE_MASQUE_SERVER_H_ 7 | 8 | #include "quiche/quic/masque/masque_server_backend.h" 9 | #include "quiche/quic/masque/masque_utils.h" 10 | #include "quiche/quic/platform/api/quic_export.h" 11 | #include "quiche/quic/tools/quic_server.h" 12 | 13 | namespace quic { 14 | 15 | // QUIC server that implements MASQUE. 16 | class QUIC_NO_EXPORT MasqueServer : public QuicServer { 17 | public: 18 | explicit MasqueServer(MasqueMode masque_mode, 19 | MasqueServerBackend* masque_server_backend); 20 | 21 | // Disallow copy and assign. 22 | MasqueServer(const MasqueServer&) = delete; 23 | MasqueServer& operator=(const MasqueServer&) = delete; 24 | 25 | // From QuicServer. 26 | QuicDispatcher* CreateQuicDispatcher() override; 27 | 28 | private: 29 | MasqueMode masque_mode_; 30 | MasqueServerBackend* masque_server_backend_; // Unowned. 31 | }; 32 | 33 | } // namespace quic 34 | 35 | #endif // QUICHE_QUIC_MASQUE_MASQUE_SERVER_H_ 36 | -------------------------------------------------------------------------------- /quiche/quic/moqt/moqt_cached_object.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/moqt/moqt_cached_object.h" 6 | 7 | #include "absl/strings/string_view.h" 8 | #include "quiche/quic/moqt/moqt_publisher.h" 9 | #include "quiche/common/quiche_mem_slice.h" 10 | 11 | namespace moqt { 12 | 13 | moqt::PublishedObject CachedObjectToPublishedObject( 14 | const CachedObject& object) { 15 | PublishedObject result; 16 | result.sequence = object.sequence; 17 | result.status = object.status; 18 | result.publisher_priority = object.publisher_priority; 19 | if (object.payload != nullptr && !object.payload->empty()) { 20 | result.payload = quiche::QuicheMemSlice( 21 | object.payload->data(), object.payload->length(), 22 | [retained_pointer = object.payload](absl::string_view) {}); 23 | } 24 | result.arrival_time = object.arrival_time; 25 | result.fin_after_this = object.fin_after_this; 26 | return result; 27 | } 28 | 29 | } // namespace moqt 30 | -------------------------------------------------------------------------------- /quiche/quic/moqt/moqt_cached_object.h: -------------------------------------------------------------------------------- 1 | // Copyright 2024 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_MOQT_MOQT_CACHED_OBJECT_H_ 6 | #define QUICHE_QUIC_MOQT_MOQT_CACHED_OBJECT_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/quic_time.h" 11 | #include "quiche/quic/moqt/moqt_messages.h" 12 | #include "quiche/quic/moqt/moqt_priority.h" 13 | #include "quiche/quic/moqt/moqt_publisher.h" 14 | #include "quiche/common/quiche_mem_slice.h" 15 | 16 | namespace moqt { 17 | 18 | // CachedObject is a version of PublishedObject with a reference counted 19 | // payload. 20 | struct CachedObject { 21 | Location sequence; 22 | MoqtObjectStatus status; 23 | MoqtPriority publisher_priority; 24 | std::shared_ptr payload; 25 | quic::QuicTime arrival_time; 26 | bool fin_after_this; // This is the last object before FIN. 27 | }; 28 | 29 | // Transforms a CachedObject into a PublishedObject. 30 | PublishedObject CachedObjectToPublishedObject(const CachedObject& object); 31 | 32 | } // namespace moqt 33 | 34 | #endif // QUICHE_QUIC_MOQT_MOQT_CACHED_OBJECT_H_ 35 | -------------------------------------------------------------------------------- /quiche/quic/platform/README.md: -------------------------------------------------------------------------------- 1 | # QUIC platform 2 | 3 | The QUICHE mechanism for defining embedder-specific implementations for common 4 | APIs resides in `quiche/common/platform`. This directory is vestigial, and only 5 | provides includes and aliases to `quiche/common/platform`. 6 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_bug_tracker.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_bug_tracker.h" 9 | 10 | #define QUIC_BUG QUICHE_BUG 11 | #define QUIC_BUG_IF QUICHE_BUG_IF 12 | #define QUIC_PEER_BUG QUICHE_PEER_BUG 13 | #define QUIC_PEER_BUG_IF QUICHE_PEER_BUG_IF 14 | 15 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_BUG_TRACKER_H_ 16 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_expect_bug.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_EXPECT_BUG_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_EXPECT_BUG_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_expect_bug.h" 9 | 10 | #define EXPECT_QUIC_BUG EXPECT_QUICHE_BUG 11 | #define EXPECT_QUIC_PEER_BUG(statement, regex) \ 12 | EXPECT_QUICHE_PEER_BUG(statement, regex) 13 | 14 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_EXPECT_BUG_H_ 15 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_export.h: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_EXPORT_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_EXPORT_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_export.h" 9 | 10 | // QUIC_EXPORT is not meant to be used. 11 | #define QUIC_EXPORT QUICHE_EXPORT 12 | 13 | // QUIC_EXPORT_PRIVATE is meant for QUIC functionality that is built in Chromium 14 | // as part of //net, and not fully contained in headers. 15 | #define QUIC_EXPORT_PRIVATE QUICHE_EXPORT 16 | 17 | // QUIC_NO_EXPORT is meant for QUIC functionality that is either fully defined 18 | // in a header, or is built in Chromium as part of tests or tools. 19 | #define QUIC_NO_EXPORT QUICHE_NO_EXPORT 20 | 21 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_EXPORT_H_ 22 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_flag_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_FLAG_UTILS_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_FLAG_UTILS_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_flag_utils.h" 9 | 10 | #define QUIC_RELOADABLE_FLAG_COUNT QUICHE_RELOADABLE_FLAG_COUNT 11 | #define QUIC_RELOADABLE_FLAG_COUNT_N QUICHE_RELOADABLE_FLAG_COUNT_N 12 | 13 | #define QUIC_RESTART_FLAG_COUNT QUICHE_RESTART_FLAG_COUNT 14 | #define QUIC_RESTART_FLAG_COUNT_N QUICHE_RESTART_FLAG_COUNT_N 15 | 16 | #define QUIC_CODE_COUNT QUICHE_CODE_COUNT 17 | #define QUIC_CODE_COUNT_N QUICHE_CODE_COUNT_N 18 | 19 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_FLAG_UTILS_H_ 20 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_flags.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_FLAGS_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_FLAGS_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include "quiche/common/platform/api/quiche_flags.h" 12 | 13 | #define GetQuicReloadableFlag(flag) GetQuicheReloadableFlag(flag) 14 | #define SetQuicReloadableFlag(flag, value) SetQuicheReloadableFlag(flag, value) 15 | #define GetQuicRestartFlag(flag) GetQuicheRestartFlag(flag) 16 | #define SetQuicRestartFlag(flag, value) SetQuicheRestartFlag(flag, value) 17 | #define GetQuicFlag(flag) GetQuicheFlag(flag) 18 | #define SetQuicFlag(flag, value) SetQuicheFlag(flag, value) 19 | 20 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_FLAGS_H_ 21 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_hostname_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_HOSTNAME_UTILS_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_HOSTNAME_UTILS_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_hostname_utils.h" 9 | 10 | namespace quic { 11 | 12 | using QuicHostnameUtils = quiche::QuicheHostnameUtils; 13 | 14 | } // namespace quic 15 | 16 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_HOSTNAME_UTILS_H_ 17 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_ip_address.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ 7 | 8 | #include "quiche/common/quiche_ip_address.h" 9 | 10 | namespace quic { 11 | 12 | using QuicIpAddress = ::quiche::QuicheIpAddress; 13 | 14 | } // namespace quic 15 | 16 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_H_ 17 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_ip_address_family.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_FAMILY_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_FAMILY_H_ 7 | 8 | #include "quiche/common/quiche_ip_address_family.h" 9 | 10 | namespace quic { 11 | 12 | using IpAddressFamily = ::quiche::IpAddressFamily; 13 | 14 | } // namespace quic 15 | 16 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_IP_ADDRESS_FAMILY_H_ 17 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_socket_address.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_ip_address.h" 9 | #include "quiche/common/quiche_socket_address.h" 10 | 11 | namespace quic { 12 | 13 | using QuicSocketAddress = ::quiche::QuicheSocketAddress; 14 | using QuicSocketAddressHash = ::quiche::QuicheSocketAddressHash; 15 | 16 | } // namespace quic 17 | 18 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_SOCKET_ADDRESS_H_ 19 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_stack_trace.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_STACK_TRACE_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_STACK_TRACE_H_ 7 | 8 | #include 9 | 10 | #include "quiche/common/platform/api/quiche_stack_trace.h" 11 | 12 | namespace quic { 13 | 14 | inline std::string QuicStackTrace() { return quiche::QuicheStackTrace(); } 15 | 16 | } // namespace quic 17 | 18 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_STACK_TRACE_H_ 19 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_test.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_logging.h" 9 | #include "quiche/common/platform/api/quiche_test.h" 10 | 11 | namespace quic::test { 12 | 13 | using QuicFlagSaver = quiche::test::QuicheFlagSaver; 14 | 15 | // Defines the base classes to be used in QUIC tests. 16 | using QuicTest = quiche::test::QuicheTest; 17 | template 18 | using QuicTestWithParam = quiche::test::QuicheTestWithParam; 19 | 20 | } // namespace quic::test 21 | 22 | #define QUIC_TEST_DISABLED_IN_CHROME(name) QUICHE_TEST_DISABLED_IN_CHROME(name) 23 | 24 | #define QUIC_SLOW_TEST(test) QUICHE_SLOW_TEST(test) 25 | 26 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_TEST_H_ 27 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_test_output.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_TEST_OUTPUT_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_TEST_OUTPUT_H_ 7 | 8 | #include "absl/strings/string_view.h" 9 | #include "quiche/common/platform/api/quiche_test_output.h" 10 | 11 | namespace quic { 12 | 13 | inline void QuicSaveTestOutput(absl::string_view filename, 14 | absl::string_view data) { 15 | quiche::QuicheSaveTestOutput(filename, data); 16 | } 17 | 18 | inline bool QuicLoadTestOutput(absl::string_view filename, std::string* data) { 19 | return quiche::QuicheLoadTestOutput(filename, data); 20 | } 21 | 22 | inline void QuicRecordTrace(absl::string_view identifier, 23 | absl::string_view data) { 24 | quiche::QuicheRecordTrace(identifier, data); 25 | } 26 | 27 | } // namespace quic 28 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_TEST_OUTPUT_H_ 29 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_testvalue.h: -------------------------------------------------------------------------------- 1 | // Copyright 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // TODO(b/178613777): Remove this file. 6 | 7 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_TESTVALUE_H_ 8 | #define QUICHE_QUIC_PLATFORM_API_QUIC_TESTVALUE_H_ 9 | 10 | #include "absl/strings/string_view.h" 11 | #include "quiche/common/platform/api/quiche_testvalue.h" 12 | 13 | namespace quic { 14 | 15 | template 16 | void AdjustTestValue(absl::string_view label, T* var) { 17 | quiche::AdjustTestValue(label, var); 18 | } 19 | 20 | } // namespace quic 21 | 22 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_TESTVALUE_H_ 23 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_thread.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_THREAD_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_THREAD_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_thread.h" 9 | 10 | namespace quic { 11 | 12 | using QuicThread = quiche::QuicheThread; 13 | 14 | } // namespace quic 15 | 16 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_THREAD_H_ 17 | -------------------------------------------------------------------------------- /quiche/quic/platform/api/quic_udp_socket_platform_api.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_PLATFORM_API_QUIC_UDP_SOCKET_PLATFORM_API_H_ 6 | #define QUICHE_QUIC_PLATFORM_API_QUIC_UDP_SOCKET_PLATFORM_API_H_ 7 | 8 | #include "quiche/common/platform/api/quiche_udp_socket_platform_api.h" 9 | 10 | namespace quic { 11 | 12 | const size_t kCmsgSpaceForGooglePacketHeader = 13 | quiche::kCmsgSpaceForGooglePacketHeader; 14 | 15 | inline bool GetGooglePacketHeadersFromControlMessage( 16 | struct ::cmsghdr* cmsg, char** packet_headers, size_t* packet_headers_len) { 17 | return quiche::GetGooglePacketHeadersFromControlMessage(cmsg, packet_headers, 18 | packet_headers_len); 19 | } 20 | 21 | inline void SetGoogleSocketOptions(int fd) { 22 | quiche::SetGoogleSocketOptions(fd); 23 | } 24 | 25 | } // namespace quic 26 | 27 | #endif // QUICHE_QUIC_PLATFORM_API_QUIC_UDP_SOCKET_PLATFORM_API_H_ 28 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/icmp_reachable_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_BONNET_ICMP_REACHABLE_INTERFACE_H_ 6 | #define QUICHE_QUIC_QBONE_BONNET_ICMP_REACHABLE_INTERFACE_H_ 7 | 8 | namespace quic { 9 | 10 | class IcmpReachableInterface { 11 | public: 12 | IcmpReachableInterface() = default; 13 | virtual ~IcmpReachableInterface() = default; 14 | 15 | IcmpReachableInterface(const IcmpReachableInterface&) = delete; 16 | IcmpReachableInterface& operator=(const IcmpReachableInterface&) = delete; 17 | 18 | IcmpReachableInterface(IcmpReachableInterface&&) = delete; 19 | IcmpReachableInterface& operator=(IcmpReachableInterface&&) = delete; 20 | 21 | // Initializes this reachability probe. 22 | virtual bool Init() = 0; 23 | }; 24 | 25 | } // namespace quic 26 | 27 | #endif // QUICHE_QUIC_QBONE_BONNET_ICMP_REACHABLE_INTERFACE_H_ 28 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/mock_icmp_reachable.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_BONNET_MOCK_ICMP_REACHABLE_H_ 6 | #define QUICHE_QUIC_QBONE_BONNET_MOCK_ICMP_REACHABLE_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_test.h" 9 | #include "quiche/quic/qbone/bonnet/icmp_reachable_interface.h" 10 | 11 | namespace quic { 12 | 13 | class MockIcmpReachable : public IcmpReachableInterface { 14 | public: 15 | MOCK_METHOD(bool, Init, (), (override)); 16 | }; 17 | 18 | } // namespace quic 19 | 20 | #endif // QUICHE_QUIC_QBONE_BONNET_MOCK_ICMP_REACHABLE_H_ 21 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/mock_packet_exchanger_stats_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_BONNET_MOCK_PACKET_EXCHANGER_STATS_INTERFACE_H_ 6 | #define QUICHE_QUIC_QBONE_BONNET_MOCK_PACKET_EXCHANGER_STATS_INTERFACE_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_test.h" 9 | #include "quiche/quic/qbone/bonnet/tun_device_packet_exchanger.h" 10 | 11 | namespace quic { 12 | 13 | class MockPacketExchangerStatsInterface 14 | : public TunDevicePacketExchanger::StatsInterface { 15 | public: 16 | MOCK_METHOD(void, OnPacketRead, (size_t), (override)); 17 | MOCK_METHOD(void, OnPacketWritten, (size_t), (override)); 18 | MOCK_METHOD(void, OnReadError, (std::string*), (override)); 19 | MOCK_METHOD(void, OnWriteError, (std::string*), (override)); 20 | 21 | MOCK_METHOD(int64_t, PacketsRead, (), (const, override)); 22 | MOCK_METHOD(int64_t, PacketsWritten, (), (const, override)); 23 | }; 24 | 25 | } // namespace quic 26 | 27 | #endif // QUICHE_QUIC_QBONE_BONNET_MOCK_PACKET_EXCHANGER_STATS_INTERFACE_H_ 28 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/mock_tun_device.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_BONNET_MOCK_TUN_DEVICE_H_ 6 | #define QUICHE_QUIC_QBONE_BONNET_MOCK_TUN_DEVICE_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_test.h" 9 | #include "quiche/quic/qbone/bonnet/tun_device_interface.h" 10 | 11 | namespace quic { 12 | 13 | class MockTunDevice : public TunDeviceInterface { 14 | public: 15 | MOCK_METHOD(bool, Init, (), (override)); 16 | 17 | MOCK_METHOD(bool, Up, (), (override)); 18 | 19 | MOCK_METHOD(bool, Down, (), (override)); 20 | 21 | MOCK_METHOD(void, CloseDevice, (), (override)); 22 | 23 | MOCK_METHOD(int, GetFileDescriptor, (), (const, override)); 24 | }; 25 | 26 | } // namespace quic 27 | 28 | #endif // QUICHE_QUIC_QBONE_BONNET_MOCK_TUN_DEVICE_H_ 29 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/mock_tun_device_controller.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_BONNET_MOCK_TUN_DEVICE_CONTROLLER_H_ 6 | #define QUICHE_QUIC_QBONE_BONNET_MOCK_TUN_DEVICE_CONTROLLER_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_test.h" 9 | #include "quiche/quic/qbone/bonnet/tun_device_controller.h" 10 | 11 | namespace quic { 12 | 13 | class MockTunDeviceController : public TunDeviceController { 14 | public: 15 | MockTunDeviceController() : TunDeviceController("", true, nullptr) {} 16 | 17 | MOCK_METHOD(bool, UpdateAddress, (const IpRange&), (override)); 18 | 19 | MOCK_METHOD(bool, UpdateRoutes, (const IpRange&, const std::vector&), 20 | (override)); 21 | 22 | MOCK_METHOD(QuicIpAddress, current_address, (), (override)); 23 | }; 24 | 25 | } // namespace quic 26 | 27 | #endif // QUICHE_QUIC_QBONE_BONNET_MOCK_TUN_DEVICE_CONTROLLER_H_ 28 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/qbone_tunnel_info.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/qbone/bonnet/qbone_tunnel_info.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | 11 | QuicIpAddress QboneTunnelInfo::GetAddress() { 12 | QuicIpAddress no_address; 13 | 14 | NetlinkInterface::LinkInfo link_info{}; 15 | if (!netlink_->GetLinkInfo(ifname_, &link_info)) { 16 | return no_address; 17 | } 18 | 19 | std::vector addresses; 20 | if (!netlink_->GetAddresses(link_info.index, 0, &addresses, nullptr)) { 21 | return no_address; 22 | } 23 | 24 | quic::QuicIpAddress link_local_subnet; 25 | if (!link_local_subnet.FromString("FE80::")) { 26 | return no_address; 27 | } 28 | 29 | for (const auto& address : addresses) { 30 | if (address.interface_address.IsInitialized() && 31 | !link_local_subnet.InSameSubnet(address.interface_address, 10)) { 32 | return address.interface_address; 33 | } 34 | } 35 | 36 | return no_address; 37 | } 38 | 39 | } // namespace quic 40 | -------------------------------------------------------------------------------- /quiche/quic/qbone/bonnet/qbone_tunnel_info.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_BONNET_QBONE_TUNNEL_INFO_H_ 6 | #define QUICHE_QUIC_QBONE_BONNET_QBONE_TUNNEL_INFO_H_ 7 | 8 | #include "quiche/quic/platform/api/quic_ip_address.h" 9 | #include "quiche/quic/qbone/platform/netlink_interface.h" 10 | 11 | namespace quic { 12 | 13 | class QboneTunnelInfo { 14 | public: 15 | QboneTunnelInfo(std::string ifname, NetlinkInterface* netlink) 16 | : ifname_(std::move(ifname)), netlink_(netlink) {} 17 | 18 | // Returns the current QBONE tunnel address. Callers must use IsInitialized() 19 | // to ensure the returned address is valid. 20 | QuicIpAddress GetAddress(); 21 | 22 | private: 23 | const std::string ifname_; 24 | NetlinkInterface* netlink_; 25 | }; 26 | 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_QBONE_BONNET_QBONE_TUNNEL_INFO_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/qbone/mock_qbone_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_MOCK_QBONE_CLIENT_H_ 6 | #define QUICHE_QUIC_QBONE_MOCK_QBONE_CLIENT_H_ 7 | 8 | #include "absl/strings/string_view.h" 9 | #include "quiche/quic/platform/api/quic_test.h" 10 | #include "quiche/quic/qbone/qbone_client_interface.h" 11 | 12 | namespace quic { 13 | 14 | class MockQboneClient : public QboneClientInterface { 15 | public: 16 | MOCK_METHOD(void, ProcessPacketFromNetwork, (absl::string_view packet), 17 | (override)); 18 | }; 19 | 20 | } // namespace quic 21 | 22 | #endif // QUICHE_QUIC_QBONE_MOCK_QBONE_CLIENT_H_ 23 | -------------------------------------------------------------------------------- /quiche/quic/qbone/platform/icmp_packet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_PLATFORM_ICMP_PACKET_H_ 6 | #define QUICHE_QUIC_QBONE_PLATFORM_ICMP_PACKET_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "absl/strings/string_view.h" 14 | #include "quiche/quic/platform/api/quic_ip_address.h" 15 | #include "quiche/common/quiche_callbacks.h" 16 | 17 | namespace quic { 18 | 19 | // Creates an ICMPv6 packet, returning a packed string representation of the 20 | // packet to |cb|. The resulting packet is given to a callback because it's 21 | // stack allocated inside CreateIcmpPacket. 22 | void CreateIcmpPacket(in6_addr src, in6_addr dst, const icmp6_hdr& icmp_header, 23 | absl::string_view body, 24 | quiche::UnretainedCallback cb); 25 | 26 | } // namespace quic 27 | 28 | #endif // QUICHE_QUIC_QBONE_PLATFORM_ICMP_PACKET_H_ 29 | -------------------------------------------------------------------------------- /quiche/quic/qbone/platform/tcp_packet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_PLATFORM_TCP_PACKET_H_ 6 | #define QUICHE_QUIC_QBONE_PLATFORM_TCP_PACKET_H_ 7 | 8 | #include 9 | #include 10 | 11 | #include 12 | 13 | #include "absl/strings/string_view.h" 14 | #include "quiche/quic/platform/api/quic_ip_address.h" 15 | #include "quiche/common/quiche_callbacks.h" 16 | 17 | namespace quic { 18 | 19 | // Creates an TCPv6 RST packet, returning a packed string representation of the 20 | // packet to |cb|. 21 | void CreateTcpResetPacket( 22 | absl::string_view original_packet, 23 | quiche::UnretainedCallback cb); 24 | 25 | } // namespace quic 26 | 27 | #endif // QUICHE_QUIC_QBONE_PLATFORM_TCP_PACKET_H_ 28 | -------------------------------------------------------------------------------- /quiche/quic/qbone/qbone_client_interface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_QBONE_CLIENT_INTERFACE_H_ 6 | #define QUICHE_QUIC_QBONE_QBONE_CLIENT_INTERFACE_H_ 7 | 8 | #include 9 | 10 | #include "absl/strings/string_view.h" 11 | 12 | namespace quic { 13 | 14 | // An interface that includes methods to interact with a QBONE client. 15 | class QboneClientInterface { 16 | public: 17 | virtual ~QboneClientInterface() {} 18 | // Accepts a given packet from the network and sends the packet down to the 19 | // QBONE connection. 20 | virtual void ProcessPacketFromNetwork(absl::string_view packet) = 0; 21 | }; 22 | 23 | } // namespace quic 24 | 25 | #endif // QUICHE_QUIC_QBONE_QBONE_CLIENT_INTERFACE_H_ 26 | -------------------------------------------------------------------------------- /quiche/quic/qbone/qbone_control.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option optimize_for = LITE_RUNTIME; 4 | 5 | package quic; 6 | 7 | message QboneServerRequest { 8 | extensions 1000 to max; 9 | }; 10 | 11 | message QboneClientRequest { 12 | extensions 1000 to max; 13 | }; 14 | -------------------------------------------------------------------------------- /quiche/quic/qbone/qbone_control_placeholder.proto: -------------------------------------------------------------------------------- 1 | syntax = "proto2"; 2 | 3 | option optimize_for = LITE_RUNTIME; 4 | 5 | package quic; 6 | 7 | import "quiche/quic/qbone/qbone_control.proto"; 8 | 9 | // These provide fields for QboneServerRequest and QboneClientRequest that are 10 | // used to test the control channel. Once the control channel actually has real 11 | // data to pass they can be removed. 12 | // TODO(b/62139999): Remove this file in favor of testing actual configuration. 13 | 14 | extend QboneServerRequest { 15 | optional string server_placeholder = 179838467; 16 | } 17 | 18 | extend QboneClientRequest { 19 | optional string client_placeholder = 179838467; 20 | } 21 | -------------------------------------------------------------------------------- /quiche/quic/qbone/qbone_packet_writer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_QBONE_QBONE_PACKET_WRITER_H_ 6 | #define QUICHE_QUIC_QBONE_QBONE_PACKET_WRITER_H_ 7 | 8 | #include 9 | 10 | namespace quic { 11 | 12 | // QbonePacketWriter expects only one function to be defined, 13 | // WritePacketToNetwork, which is called when a packet is received via QUIC 14 | // and should be sent out on the network. This is the complete packet, 15 | // and not just a fragment. 16 | class QbonePacketWriter { 17 | public: 18 | virtual ~QbonePacketWriter() {} 19 | virtual void WritePacketToNetwork(const char* packet, size_t size) = 0; 20 | }; 21 | 22 | } // namespace quic 23 | 24 | #endif // QUICHE_QUIC_QBONE_QBONE_PACKET_WRITER_H_ 25 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/fuzzing/README.md: -------------------------------------------------------------------------------- 1 | This directory contains several fuzz tests for QUIC code: 2 | 3 | - quic_framer_fuzzer: A test for CryptoFramer::ParseMessage and 4 | QuicFramer::ProcessPacket using random packet data. 5 | - quic_framer_process_data_packet_fuzzer: A test for QuicFramer::ProcessPacket 6 | where the packet has a valid public header, is decryptable, and contains 7 | random QUIC payload. 8 | 9 | To build and run the fuzz tests, using quic_framer_fuzzer as an example: 10 | 11 | ```sh 12 | $ blaze build --config=asan-fuzzer //gfe/quic/test_tools/fuzzing/... 13 | $ CORPUS_DIR=`mktemp -d` && echo ${CORPUS_DIR} 14 | $ ./blaze-bin/gfe/quic/test_tools/fuzzing/quic_framer_fuzzer ${CORPUS_DIR} -use_counters=0 15 | ``` 16 | 17 | By default this fuzzes with 64 byte chunks, to test the framer with more 18 | realistic size input, try 1350 (max payload size of a QUIC packet): 19 | 20 | ```sh 21 | $ ./blaze-bin/gfe/quic/test_tools/fuzzing/quic_framer_fuzzer ${CORPUS_DIR} -use_counters=0 -max_len=1350 22 | ``` 23 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/limited_mtu_test_writer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/limited_mtu_test_writer.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | 10 | LimitedMtuTestWriter::LimitedMtuTestWriter(QuicByteCount mtu) : mtu_(mtu) {} 11 | 12 | LimitedMtuTestWriter::~LimitedMtuTestWriter() = default; 13 | 14 | WriteResult LimitedMtuTestWriter::WritePacket( 15 | const char* buffer, size_t buf_len, const QuicIpAddress& self_address, 16 | const QuicSocketAddress& peer_address, PerPacketOptions* options, 17 | const QuicPacketWriterParams& params) { 18 | if (buf_len > mtu_) { 19 | // Drop the packet. 20 | return WriteResult(WRITE_STATUS_OK, buf_len); 21 | } 22 | 23 | return QuicPacketWriterWrapper::WritePacket(buffer, buf_len, self_address, 24 | peer_address, options, params); 25 | } 26 | 27 | } // namespace test 28 | } // namespace quic 29 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_clock.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/mock_clock.h" 6 | 7 | namespace quic { 8 | 9 | MockClock::MockClock() : now_(QuicTime::Zero()) {} 10 | 11 | MockClock::~MockClock() {} 12 | 13 | void MockClock::AdvanceTime(QuicTime::Delta delta) { now_ = now_ + delta; } 14 | 15 | void MockClock::Reset() { now_ = QuicTime::Zero(); } 16 | 17 | QuicTime MockClock::Now() const { return now_; } 18 | 19 | QuicTime MockClock::ApproximateNow() const { return now_; } 20 | 21 | QuicWallTime MockClock::WallNow() const { 22 | return QuicWallTime::FromUNIXSeconds((now_ - QuicTime::Zero()).ToSeconds()); 23 | } 24 | 25 | } // namespace quic 26 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_clock.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_MOCK_CLOCK_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_MOCK_CLOCK_H_ 7 | 8 | #include "quiche/quic/core/quic_clock.h" 9 | #include "quiche/quic/core/quic_time.h" 10 | 11 | namespace quic { 12 | 13 | class MockClock : public QuicClock { 14 | public: 15 | MockClock(); 16 | MockClock(const MockClock&) = delete; 17 | MockClock& operator=(const MockClock&) = delete; 18 | ~MockClock() override; 19 | 20 | // QuicClock implementation: 21 | QuicTime Now() const override; 22 | QuicTime ApproximateNow() const override; 23 | QuicWallTime WallNow() const override; 24 | 25 | // Advances the current time by |delta|, which may be negative. 26 | void AdvanceTime(QuicTime::Delta delta); 27 | // Resets time back to zero. 28 | void Reset(); 29 | 30 | private: 31 | QuicTime now_; 32 | }; 33 | 34 | } // namespace quic 35 | 36 | #endif // QUICHE_QUIC_TEST_TOOLS_MOCK_CLOCK_H_ 37 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_connection_id_generator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_MOCK_CONNECTION_ID_GENERATOR_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_MOCK_CONNECTION_ID_GENERATOR_H_ 7 | 8 | #include "quiche/quic/core/connection_id_generator.h" 9 | #include "quiche/quic/platform/api/quic_test.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | class MockConnectionIdGenerator : public quic::ConnectionIdGeneratorInterface { 15 | public: 16 | MOCK_METHOD(std::optional, GenerateNextConnectionId, 17 | (const quic::QuicConnectionId& original), (override)); 18 | 19 | MOCK_METHOD(std::optional, MaybeReplaceConnectionId, 20 | (const quic::QuicConnectionId& original, 21 | const quic::ParsedQuicVersion& version), 22 | (override)); 23 | 24 | MOCK_METHOD(uint8_t, ConnectionIdLength, (uint8_t first_byte), 25 | (const, override)); 26 | }; 27 | 28 | } // namespace test 29 | } // namespace quic 30 | 31 | #endif // QUICHE_QUIC_TEST_TOOLS_MOCK_CONNECTION_ID_GENERATOR_H_ 32 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_quic_session_visitor.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/mock_quic_session_visitor.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | 10 | MockQuicSessionVisitor::MockQuicSessionVisitor() = default; 11 | 12 | MockQuicSessionVisitor::~MockQuicSessionVisitor() = default; 13 | 14 | MockQuicCryptoServerStreamHelper::MockQuicCryptoServerStreamHelper() = default; 15 | 16 | MockQuicCryptoServerStreamHelper::~MockQuicCryptoServerStreamHelper() = default; 17 | 18 | } // namespace test 19 | } // namespace quic 20 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_quic_spdy_client_stream.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/mock_quic_spdy_client_stream.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | 10 | MockQuicSpdyClientStream::MockQuicSpdyClientStream( 11 | QuicStreamId id, QuicSpdyClientSession* session, StreamType type) 12 | : QuicSpdyClientStream(id, session, type) {} 13 | 14 | MockQuicSpdyClientStream::~MockQuicSpdyClientStream() {} 15 | 16 | } // namespace test 17 | } // namespace quic 18 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_quic_spdy_client_stream.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_MOCK_QUIC_SPDY_CLIENT_STREAM_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_MOCK_QUIC_SPDY_CLIENT_STREAM_H_ 7 | 8 | #include "quiche/quic/core/http/quic_header_list.h" 9 | #include "quiche/quic/core/http/quic_spdy_client_stream.h" 10 | #include "quiche/quic/core/quic_packets.h" 11 | #include "quiche/quic/platform/api/quic_test.h" 12 | 13 | namespace quic { 14 | namespace test { 15 | 16 | class MockQuicSpdyClientStream : public QuicSpdyClientStream { 17 | public: 18 | MockQuicSpdyClientStream(QuicStreamId id, QuicSpdyClientSession* session, 19 | StreamType type); 20 | ~MockQuicSpdyClientStream() override; 21 | 22 | MOCK_METHOD(void, OnStreamFrame, (const QuicStreamFrame& frame), (override)); 23 | MOCK_METHOD(void, OnDataAvailable, (), (override)); 24 | }; 25 | 26 | } // namespace test 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_TEST_TOOLS_MOCK_QUIC_SPDY_CLIENT_STREAM_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/mock_quic_time_wait_list_manager.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/mock_quic_time_wait_list_manager.h" 6 | 7 | using testing::_; 8 | using testing::Invoke; 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | MockTimeWaitListManager::MockTimeWaitListManager( 14 | QuicPacketWriter* writer, Visitor* visitor, const QuicClock* clock, 15 | QuicAlarmFactory* alarm_factory) 16 | : QuicTimeWaitListManager(writer, visitor, clock, alarm_factory) { 17 | // Though AddConnectionIdToTimeWait is mocked, we want to retain its 18 | // functionality. 19 | EXPECT_CALL(*this, AddConnectionIdToTimeWait(_, _)) 20 | .Times(testing::AnyNumber()); 21 | ON_CALL(*this, AddConnectionIdToTimeWait(_, _)) 22 | .WillByDefault( 23 | Invoke(this, &MockTimeWaitListManager:: 24 | QuicTimeWaitListManager_AddConnectionIdToTimeWait)); 25 | } 26 | 27 | MockTimeWaitListManager::~MockTimeWaitListManager() = default; 28 | 29 | } // namespace test 30 | } // namespace quic 31 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/qpack/qpack_encoder_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/qpack/qpack_encoder_peer.h" 6 | 7 | #include "quiche/quic/core/qpack/qpack_encoder.h" 8 | 9 | namespace quic { 10 | namespace test { 11 | 12 | // static 13 | QpackEncoderHeaderTable* QpackEncoderPeer::header_table(QpackEncoder* encoder) { 14 | return &encoder->header_table_; 15 | } 16 | 17 | // static 18 | uint64_t QpackEncoderPeer::maximum_blocked_streams( 19 | const QpackEncoder* encoder) { 20 | return encoder->maximum_blocked_streams_; 21 | } 22 | 23 | // static 24 | uint64_t QpackEncoderPeer::smallest_blocking_index( 25 | const QpackEncoder* encoder) { 26 | return encoder->blocking_manager_.smallest_blocking_index(); 27 | } 28 | 29 | } // namespace test 30 | } // namespace quic 31 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/qpack/qpack_encoder_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QPACK_QPACK_ENCODER_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QPACK_QPACK_ENCODER_PEER_H_ 7 | 8 | #include 9 | 10 | namespace quic { 11 | 12 | class QpackEncoder; 13 | class QpackEncoderHeaderTable; 14 | 15 | namespace test { 16 | 17 | class QpackEncoderPeer { 18 | public: 19 | QpackEncoderPeer() = delete; 20 | 21 | static QpackEncoderHeaderTable* header_table(QpackEncoder* encoder); 22 | static uint64_t maximum_blocked_streams(const QpackEncoder* encoder); 23 | static uint64_t smallest_blocking_index(const QpackEncoder* encoder); 24 | }; 25 | 26 | } // namespace test 27 | 28 | } // namespace quic 29 | 30 | #endif // QUICHE_QUIC_TEST_TOOLS_QPACK_QPACK_ENCODER_PEER_H_ 31 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/qpack/qpack_test_utils.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/qpack/qpack_test_utils.h" 6 | 7 | #include 8 | 9 | #include "quiche/quic/platform/api/quic_bug_tracker.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | FragmentSizeGenerator FragmentModeToFragmentSizeGenerator( 15 | FragmentMode fragment_mode) { 16 | switch (fragment_mode) { 17 | case FragmentMode::kSingleChunk: 18 | return []() { return std::numeric_limits::max(); }; 19 | case FragmentMode::kOctetByOctet: 20 | return []() { return 1; }; 21 | } 22 | QUIC_BUG(quic_bug_10259_1) 23 | << "Unknown FragmentMode " << static_cast(fragment_mode); 24 | return []() { return 0; }; 25 | } 26 | 27 | } // namespace test 28 | } // namespace quic 29 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_buffered_packet_store_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2016 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/quic_buffered_packet_store_peer.h" 6 | 7 | #include "quiche/quic/core/quic_buffered_packet_store.h" 8 | 9 | namespace quic { 10 | namespace test { 11 | 12 | QuicAlarm* QuicBufferedPacketStorePeer::expiration_alarm( 13 | QuicBufferedPacketStore* store) { 14 | return store->expiration_alarm_.get(); 15 | } 16 | 17 | void QuicBufferedPacketStorePeer::set_clock(QuicBufferedPacketStore* store, 18 | const QuicClock* clock) { 19 | store->clock_ = clock; 20 | } 21 | 22 | const QuicBufferedPacketStore::BufferedPacketList* 23 | QuicBufferedPacketStorePeer::FindBufferedPackets( 24 | const QuicBufferedPacketStore* store, QuicConnectionId connection_id) { 25 | auto it = store->buffered_session_map_.find(connection_id); 26 | if (it == store->buffered_session_map_.end()) { 27 | return nullptr; 28 | } 29 | return it->second.get(); 30 | } 31 | 32 | } // namespace test 33 | } // namespace quic 34 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_client_session_cache_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_CLIENT_SESSION_CACHE_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_CLIENT_SESSION_CACHE_PEER_H_ 7 | 8 | #include "quiche/quic/core/crypto/quic_client_session_cache.h" 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | class QuicClientSessionCachePeer { 14 | public: 15 | static std::string GetToken(QuicClientSessionCache* cache, 16 | const QuicServerId& server_id) { 17 | auto iter = cache->cache_.Lookup(server_id.cache_key()); 18 | if (iter == cache->cache_.end()) { 19 | return {}; 20 | } 21 | return iter->second->token; 22 | } 23 | 24 | static bool HasEntry(QuicClientSessionCache* cache, 25 | const QuicServerId& server_id) { 26 | return cache->cache_.Lookup(server_id.cache_key()) != cache->cache_.end(); 27 | } 28 | }; 29 | 30 | } // namespace test 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_CLIENT_SESSION_CACHE_PEER_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_coalesced_packet_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/quic_coalesced_packet_peer.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | namespace test { 11 | 12 | // static 13 | void QuicCoalescedPacketPeer::SetMaxPacketLength( 14 | QuicCoalescedPacket& coalesced_packet, QuicPacketLength length) { 15 | coalesced_packet.max_packet_length_ = length; 16 | } 17 | 18 | // static 19 | std::string* QuicCoalescedPacketPeer::GetMutableEncryptedBuffer( 20 | QuicCoalescedPacket& coalesced_packet, EncryptionLevel encryption_level) { 21 | return &coalesced_packet.encrypted_buffers_[encryption_level]; 22 | } 23 | 24 | } // namespace test 25 | } // namespace quic 26 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_coalesced_packet_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2022 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_COALESCED_PACKET_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_COALESCED_PACKET_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_coalesced_packet.h" 9 | #include "quiche/quic/core/quic_types.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | class QuicCoalescedPacketPeer { 15 | public: 16 | static void SetMaxPacketLength(QuicCoalescedPacket& coalesced_packet, 17 | QuicPacketLength length); 18 | 19 | static std::string* GetMutableEncryptedBuffer( 20 | QuicCoalescedPacket& coalesced_packet, EncryptionLevel encryption_level); 21 | }; 22 | 23 | } // namespace test 24 | } // namespace quic 25 | 26 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_COALESCED_PACKET_PEER_H_ 27 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_connection_id_manager_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_CONNECTION_ID_MANAGER_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_CONNECTION_ID_MANAGER_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_connection_id_manager.h" 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | class QuicConnectionIdManagerPeer { 14 | public: 15 | static QuicAlarm* GetRetirePeerIssuedConnectionIdAlarm( 16 | QuicPeerIssuedConnectionIdManager* manager) { 17 | return manager->retire_connection_id_alarm_.get(); 18 | } 19 | 20 | static QuicAlarm* GetRetireSelfIssuedConnectionIdAlarm( 21 | QuicSelfIssuedConnectionIdManager* manager) { 22 | return manager->retire_connection_id_alarm_.get(); 23 | } 24 | }; 25 | 26 | } // namespace test 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_CONNECTION_ID_MANAGER_PEER_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_interval_deque_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_interval_deque.h" 9 | 10 | namespace quic { 11 | 12 | namespace test { 13 | 14 | class QuicIntervalDequePeer { 15 | public: 16 | template 17 | static int32_t GetCachedIndex(QuicIntervalDeque* interval_deque) { 18 | if (!interval_deque->cached_index_.has_value()) { 19 | return -1; 20 | } 21 | return interval_deque->cached_index_.value(); 22 | } 23 | 24 | template 25 | static T* GetItem(QuicIntervalDeque* interval_deque, 26 | const std::size_t index) { 27 | return &interval_deque->container_[index]; 28 | } 29 | }; 30 | 31 | } // namespace test 32 | 33 | } // namespace quic 34 | 35 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_INTERVAL_DEQUE_PEER_H_ 36 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_mock_syscall_wrapper.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/quic_mock_syscall_wrapper.h" 6 | 7 | using testing::_; 8 | using testing::Invoke; 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | MockQuicSyscallWrapper::MockQuicSyscallWrapper(QuicSyscallWrapper* delegate) { 14 | ON_CALL(*this, Sendmsg(_, _, _)) 15 | .WillByDefault(Invoke(delegate, &QuicSyscallWrapper::Sendmsg)); 16 | 17 | ON_CALL(*this, Sendmmsg(_, _, _, _)) 18 | .WillByDefault(Invoke(delegate, &QuicSyscallWrapper::Sendmmsg)); 19 | } 20 | 21 | } // namespace test 22 | } // namespace quic 23 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_mock_syscall_wrapper.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_MOCK_SYSCALL_WRAPPER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_MOCK_SYSCALL_WRAPPER_H_ 7 | 8 | #include "quiche/quic/core/quic_syscall_wrapper.h" 9 | #include "quiche/quic/platform/api/quic_test.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | class MockQuicSyscallWrapper : public QuicSyscallWrapper { 15 | public: 16 | // Create a standard mock object. 17 | MockQuicSyscallWrapper() = default; 18 | 19 | // Create a 'mockable' object that delegates everything to |delegate| by 20 | // default. 21 | explicit MockQuicSyscallWrapper(QuicSyscallWrapper* delegate); 22 | 23 | MOCK_METHOD(ssize_t, Sendmsg, (int sockfd, const msghdr*, int flags), 24 | (override)); 25 | 26 | MOCK_METHOD(int, Sendmmsg, 27 | (int sockfd, mmsghdr*, unsigned int vlen, int flags), (override)); 28 | }; 29 | 30 | } // namespace test 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_MOCK_SYSCALL_WRAPPER_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_path_validator_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/quic_path_validator_peer.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | // static 10 | QuicAlarm* QuicPathValidatorPeer::retry_timer(QuicPathValidator* validator) { 11 | return validator->retry_timer_.get(); 12 | } 13 | 14 | } // namespace test 15 | } // namespace quic 16 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_path_validator_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_PATH_VALIDATOR_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_PATH_VALIDATOR_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_path_validator.h" 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | class QuicPathValidatorPeer { 14 | public: 15 | static QuicAlarm* retry_timer(QuicPathValidator* validator); 16 | }; 17 | 18 | } // namespace test 19 | } // namespace quic 20 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_PATH_VALIDATOR_PEER_H_ 21 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_server_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/quic_server_peer.h" 6 | 7 | #include "absl/memory/memory.h" 8 | #include "quiche/quic/core/quic_dispatcher.h" 9 | #include "quiche/quic/core/quic_packet_reader.h" 10 | #include "quiche/quic/tools/quic_server.h" 11 | 12 | namespace quic { 13 | namespace test { 14 | 15 | // static 16 | bool QuicServerPeer::SetSmallSocket(QuicServer* server) { 17 | int size = 1024 * 10; 18 | return setsockopt(server->fd_, SOL_SOCKET, SO_RCVBUF, 19 | reinterpret_cast(&size), sizeof(size)) != -1; 20 | } 21 | 22 | // static 23 | QuicDispatcher* QuicServerPeer::GetDispatcher(QuicServer* server) { 24 | return server->dispatcher_.get(); 25 | } 26 | 27 | // static 28 | void QuicServerPeer::SetReader(QuicServer* server, QuicPacketReader* reader) { 29 | server->io_->OverridePacketReaderForTests(absl::WrapUnique(reader)); 30 | } 31 | 32 | } // namespace test 33 | } // namespace quic 34 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_server_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_SERVER_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_SERVER_PEER_H_ 7 | 8 | namespace quic { 9 | 10 | class QuicDispatcher; 11 | class QuicServer; 12 | class QuicPacketReader; 13 | 14 | namespace test { 15 | 16 | class QuicServerPeer { 17 | public: 18 | QuicServerPeer() = delete; 19 | 20 | static bool SetSmallSocket(QuicServer* server); 21 | static QuicDispatcher* GetDispatcher(QuicServer* server); 22 | static void SetReader(QuicServer* server, QuicPacketReader* reader); 23 | }; 24 | 25 | } // namespace test 26 | } // namespace quic 27 | 28 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_SERVER_PEER_H_ 29 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_server_session_base_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2018 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_SERVER_SESSION_BASE_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_SERVER_SESSION_BASE_PEER_H_ 7 | 8 | #include "quiche/quic/core/http/quic_server_session_base.h" 9 | #include "quiche/quic/core/quic_utils.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | class QuicServerSessionBasePeer { 15 | public: 16 | static QuicStream* GetOrCreateStream(QuicServerSessionBase* s, 17 | QuicStreamId id) { 18 | return s->GetOrCreateStream(id); 19 | } 20 | static void SetCryptoStream(QuicServerSessionBase* s, 21 | QuicCryptoServerStreamBase* crypto_stream) { 22 | s->crypto_stream_.reset(crypto_stream); 23 | } 24 | static bool IsBandwidthResumptionEnabled(QuicServerSessionBase* s) { 25 | return s->bandwidth_resumption_enabled_; 26 | } 27 | }; 28 | 29 | } // namespace test 30 | 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_SERVER_SESSION_BASE_PEER_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_stream_send_buffer_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2017 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEND_BUFFER_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEND_BUFFER_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_stream_send_buffer.h" 9 | 10 | namespace quic { 11 | 12 | namespace test { 13 | 14 | class QuicStreamSendBufferPeer { 15 | public: 16 | static void SetStreamOffset(QuicStreamSendBuffer* send_buffer, 17 | QuicStreamOffset stream_offset); 18 | 19 | static const BufferedSlice* CurrentWriteSlice( 20 | QuicStreamSendBuffer* send_buffer); 21 | 22 | static QuicByteCount TotalLength(QuicStreamSendBufferBase* send_buffer); 23 | 24 | static int32_t write_index(QuicStreamSendBuffer* send_buffer); 25 | }; 26 | 27 | } // namespace test 28 | 29 | } // namespace quic 30 | 31 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEND_BUFFER_PEER_H_ 32 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_stream_sequencer_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_packets.h" 9 | 10 | namespace quic { 11 | 12 | class QuicStreamSequencer; 13 | 14 | namespace test { 15 | 16 | class QuicStreamSequencerPeer { 17 | public: 18 | QuicStreamSequencerPeer() = delete; 19 | 20 | static size_t GetNumBufferedBytes(QuicStreamSequencer* sequencer); 21 | 22 | static QuicStreamOffset GetCloseOffset(QuicStreamSequencer* sequencer); 23 | 24 | static bool IsUnderlyingBufferAllocated(QuicStreamSequencer* sequencer); 25 | 26 | static void SetFrameBufferTotalBytesRead(QuicStreamSequencer* sequencer, 27 | QuicStreamOffset total_bytes_read); 28 | }; 29 | 30 | } // namespace test 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_STREAM_SEQUENCER_PEER_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_sustained_bandwidth_recorder_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_SUSTAINED_BANDWIDTH_RECORDER_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_SUSTAINED_BANDWIDTH_RECORDER_PEER_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/quic_packets.h" 11 | 12 | namespace quic { 13 | 14 | class QuicSustainedBandwidthRecorder; 15 | 16 | namespace test { 17 | 18 | class QuicSustainedBandwidthRecorderPeer { 19 | public: 20 | QuicSustainedBandwidthRecorderPeer() = delete; 21 | 22 | static void SetBandwidthEstimate( 23 | QuicSustainedBandwidthRecorder* bandwidth_recorder, 24 | int32_t bandwidth_estimate_kbytes_per_second); 25 | 26 | static void SetMaxBandwidthEstimate( 27 | QuicSustainedBandwidthRecorder* bandwidth_recorder, 28 | int32_t max_bandwidth_estimate_kbytes_per_second, 29 | int32_t max_bandwidth_timestamp); 30 | }; 31 | 32 | } // namespace test 33 | } // namespace quic 34 | 35 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_SUSTAINED_BANDWIDTH_RECORDER_PEER_H_ 36 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_unacked_packet_map_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/quic_unacked_packet_map_peer.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | 10 | const QuicStreamFrame& QuicUnackedPacketMapPeer::GetAggregatedStreamFrame( 11 | const QuicUnackedPacketMap& unacked_packets) { 12 | return unacked_packets.aggregated_stream_frame_; 13 | } 14 | 15 | void QuicUnackedPacketMapPeer::SetPerspective( 16 | QuicUnackedPacketMap* unacked_packets, Perspective perspective) { 17 | *const_cast(&unacked_packets->perspective_) = perspective; 18 | } 19 | 20 | size_t QuicUnackedPacketMapPeer::GetCapacity( 21 | const QuicUnackedPacketMap& unacked_packets) { 22 | return unacked_packets.unacked_packets_.capacity(); 23 | } 24 | 25 | size_t QuicUnackedPacketMapPeer::GetSize( 26 | const QuicUnackedPacketMap& unacked_packets) { 27 | return unacked_packets.unacked_packets_.size(); 28 | } 29 | 30 | } // namespace test 31 | } // namespace quic 32 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/quic_unacked_packet_map_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_QUIC_UNACKED_PACKET_MAP_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_QUIC_UNACKED_PACKET_MAP_PEER_H_ 7 | 8 | #include "quiche/quic/core/quic_unacked_packet_map.h" 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | class QuicUnackedPacketMapPeer { 14 | public: 15 | static const QuicStreamFrame& GetAggregatedStreamFrame( 16 | const QuicUnackedPacketMap& unacked_packets); 17 | 18 | static void SetPerspective(QuicUnackedPacketMap* unacked_packets, 19 | Perspective perspective); 20 | 21 | static size_t GetCapacity(const QuicUnackedPacketMap& unacked_packets); 22 | 23 | static size_t GetSize(const QuicUnackedPacketMap& unacked_packets); 24 | }; 25 | 26 | } // namespace test 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_TEST_TOOLS_QUIC_UNACKED_PACKET_MAP_PEER_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/rtt_stats_peer.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/rtt_stats_peer.h" 6 | 7 | namespace quic { 8 | namespace test { 9 | 10 | // static 11 | void RttStatsPeer::SetSmoothedRtt(RttStats* rtt_stats, QuicTime::Delta rtt_ms) { 12 | rtt_stats->smoothed_rtt_ = rtt_ms; 13 | } 14 | 15 | // static 16 | void RttStatsPeer::SetMinRtt(RttStats* rtt_stats, QuicTime::Delta rtt_ms) { 17 | rtt_stats->min_rtt_ = rtt_ms; 18 | } 19 | 20 | } // namespace test 21 | } // namespace quic 22 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/rtt_stats_peer.h: -------------------------------------------------------------------------------- 1 | // Copyright 2015 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_RTT_STATS_PEER_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_RTT_STATS_PEER_H_ 7 | 8 | #include "quiche/quic/core/congestion_control/rtt_stats.h" 9 | #include "quiche/quic/core/quic_time.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | class RttStatsPeer { 15 | public: 16 | RttStatsPeer() = delete; 17 | 18 | static void SetSmoothedRtt(RttStats* rtt_stats, QuicTime::Delta rtt_ms); 19 | 20 | static void SetMinRtt(RttStats* rtt_stats, QuicTime::Delta rtt_ms); 21 | }; 22 | 23 | } // namespace test 24 | } // namespace quic 25 | 26 | #endif // QUICHE_QUIC_TEST_TOOLS_RTT_STATS_PEER_H_ 27 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/send_algorithm_test_result.proto: -------------------------------------------------------------------------------- 1 | // Copyright 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | syntax = "proto2"; 6 | 7 | option optimize_for = LITE_RUNTIME; 8 | 9 | package quic; 10 | 11 | message SendAlgorithmTestResult { 12 | optional string test_name = 1; 13 | optional uint64 random_seed = 2; 14 | optional int64 simulated_duration_micros = 3; 15 | } 16 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/send_algorithm_test_utils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_SEND_ALGORITHM_TEST_UTILS_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_SEND_ALGORITHM_TEST_UTILS_H_ 7 | 8 | #include "quiche/quic/test_tools/send_algorithm_test_result.pb.h" 9 | 10 | namespace quic { 11 | namespace test { 12 | 13 | bool LoadSendAlgorithmTestResult(SendAlgorithmTestResult* result); 14 | 15 | void RecordSendAlgorithmTestResult(uint64_t random_seed, 16 | int64_t simulated_duration_micros); 17 | 18 | // Load the expected test result with LoadSendAlgorithmTestResult(), and compare 19 | // it with the actual results provided in the arguments. 20 | void CompareSendAlgorithmTestResult(int64_t actual_simulated_duration_micros); 21 | 22 | std::string GetFullSendAlgorithmTestName(); 23 | 24 | std::string GetSendAlgorithmTestResultFilename(); 25 | 26 | } // namespace test 27 | } // namespace quic 28 | 29 | #endif // QUICHE_QUIC_TEST_TOOLS_SEND_ALGORITHM_TEST_UTILS_H_ 30 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/simulator/actor.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/simulator/actor.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "quiche/quic/test_tools/simulator/simulator.h" 11 | 12 | namespace quic { 13 | namespace simulator { 14 | 15 | Actor::Actor(Simulator* simulator, std::string name) 16 | : simulator_(simulator), 17 | clock_(simulator->GetClock()), 18 | name_(std::move(name)) { 19 | simulator_->AddActor(this); 20 | } 21 | 22 | Actor::~Actor() { simulator_->RemoveActor(this); } 23 | 24 | void Actor::Schedule(QuicTime next_tick) { 25 | simulator_->Schedule(this, next_tick); 26 | } 27 | 28 | void Actor::Unschedule() { simulator_->Unschedule(this); } 29 | 30 | } // namespace simulator 31 | } // namespace quic 32 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/simulator/port.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/test_tools/simulator/port.h" 6 | 7 | #include 8 | 9 | namespace quic { 10 | namespace simulator { 11 | 12 | Packet::Packet() 13 | : source(), destination(), tx_timestamp(QuicTime::Zero()), size(0) {} 14 | 15 | Packet::~Packet() {} 16 | 17 | Packet::Packet(const Packet& packet) = default; 18 | 19 | Endpoint::Endpoint(Simulator* simulator, std::string name) 20 | : Actor(simulator, name) {} 21 | 22 | } // namespace simulator 23 | } // namespace quic 24 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/web_transport_resets_backend.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2021 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_WEB_TRANSPORT_RESETS_BACKEND_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_WEB_TRANSPORT_RESETS_BACKEND_H_ 7 | 8 | #include "quiche/quic/test_tools/quic_test_backend.h" 9 | #include "quiche/common/http/http_header_block.h" 10 | 11 | namespace quic { 12 | namespace test { 13 | 14 | // A backend for testing RESET_STREAM/STOP_SENDING behavior. Provides 15 | // bidirectional echo streams; whenever one of those receives RESET_STREAM or 16 | // STOP_SENDING, a log message is sent as a unidirectional stream. 17 | QuicSimpleServerBackend::WebTransportResponse WebTransportResetsBackend( 18 | const quiche::HttpHeaderBlock& request_headers, 19 | WebTransportSession* session); 20 | 21 | } // namespace test 22 | } // namespace quic 23 | 24 | #endif // QUICHE_QUIC_TEST_TOOLS_WEB_TRANSPORT_RESETS_BACKEND_H_ 25 | -------------------------------------------------------------------------------- /quiche/quic/test_tools/web_transport_test_tools.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TEST_TOOLS_WEB_TRANSPORT_TEST_TOOLS_H_ 6 | #define QUICHE_QUIC_TEST_TOOLS_WEB_TRANSPORT_TEST_TOOLS_H_ 7 | 8 | #include "quiche/web_transport/test_tools/mock_web_transport.h" 9 | 10 | namespace quic::test { 11 | 12 | using MockWebTransportSessionVisitor = ::webtransport::test::MockSessionVisitor; 13 | using MockWebTransportStreamVisitor = ::webtransport::test::MockStreamVisitor; 14 | 15 | } // namespace quic::test 16 | 17 | #endif // QUICHE_QUIC_TEST_TOOLS_WEB_TRANSPORT_TEST_TOOLS_H_ 18 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_backend_response.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/tools/quic_backend_response.h" 6 | 7 | namespace quic { 8 | 9 | QuicBackendResponse::QuicBackendResponse() 10 | : response_type_(REGULAR_RESPONSE), delay_(QuicTime::Delta::Zero()) {} 11 | 12 | QuicBackendResponse::~QuicBackendResponse() = default; 13 | 14 | } // namespace quic 15 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_epoll_client_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TOOLS_QUIC_EPOLL_CLIENT_FACTORY_H_ 6 | #define QUICHE_QUIC_TOOLS_QUIC_EPOLL_CLIENT_FACTORY_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/core/io/quic_event_loop.h" 11 | #include "quiche/quic/tools/quic_client_factory.h" 12 | 13 | namespace quic { 14 | 15 | // Factory creating QuicClient instances. 16 | class QuicEpollClientFactory : public ClientFactoryInterface { 17 | public: 18 | QuicEpollClientFactory(); 19 | 20 | std::unique_ptr CreateClient( 21 | std::string host_for_handshake, std::string host_for_lookup, 22 | int address_family_for_lookup, uint16_t port, 23 | ParsedQuicVersionVector versions, const QuicConfig& config, 24 | std::unique_ptr verifier, 25 | std::unique_ptr session_cache) override; 26 | 27 | private: 28 | std::unique_ptr event_loop_; 29 | }; 30 | 31 | } // namespace quic 32 | 33 | #endif // QUICHE_QUIC_TOOLS_QUIC_EPOLL_CLIENT_FACTORY_H_ 34 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_name_lookup.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TOOLS_QUIC_NAME_LOOKUP_H_ 6 | #define QUICHE_QUIC_TOOLS_QUIC_NAME_LOOKUP_H_ 7 | 8 | #include 9 | 10 | #include "quiche/quic/platform/api/quic_socket_address.h" 11 | 12 | namespace quic { 13 | 14 | class QuicServerId; 15 | 16 | namespace tools { 17 | 18 | quic::QuicSocketAddress LookupAddress(int address_family_for_lookup, 19 | std::string host, std::string port); 20 | 21 | quic::QuicSocketAddress LookupAddress(int address_family_for_lookup, 22 | const QuicServerId& server_id); 23 | 24 | inline QuicSocketAddress LookupAddress(std::string host, std::string port) { 25 | return LookupAddress(0, host, port); 26 | } 27 | 28 | inline QuicSocketAddress LookupAddress(const QuicServerId& server_id) { 29 | return LookupAddress(0, server_id); 30 | } 31 | 32 | } // namespace tools 33 | } // namespace quic 34 | 35 | #endif // QUICHE_QUIC_TOOLS_QUIC_NAME_LOOKUP_H_ 36 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_server_bin.cc: -------------------------------------------------------------------------------- 1 | // Copyright 2014 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // A binary wrapper for QuicServer. It listens forever on --port 6 | // (default 6121) until it's killed or ctrl-cd to death. 7 | 8 | #include 9 | #include 10 | 11 | #include "quiche/quic/tools/quic_server_factory.h" 12 | #include "quiche/quic/tools/quic_toy_server.h" 13 | #include "quiche/common/platform/api/quiche_command_line_flags.h" 14 | #include "quiche/common/platform/api/quiche_system_event_loop.h" 15 | 16 | int main(int argc, char* argv[]) { 17 | quiche::QuicheSystemEventLoop event_loop("quic_server"); 18 | const char* usage = "Usage: quic_server [options]"; 19 | std::vector non_option_args = 20 | quiche::QuicheParseCommandLineFlags(usage, argc, argv); 21 | if (!non_option_args.empty()) { 22 | quiche::QuichePrintCommandLineFlagHelp(usage); 23 | exit(0); 24 | } 25 | 26 | quic::QuicToyServer::MemoryCacheBackendFactory backend_factory; 27 | quic::QuicServerFactory server_factory; 28 | quic::QuicToyServer server(&backend_factory, &server_factory); 29 | return server.Start(); 30 | } 31 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_server_factory.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/tools/quic_server_factory.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "quiche/quic/tools/quic_server.h" 11 | 12 | namespace quic { 13 | 14 | std::unique_ptr QuicServerFactory::CreateServer( 15 | quic::QuicSimpleServerBackend* backend, 16 | std::unique_ptr proof_source, 17 | const quic::ParsedQuicVersionVector& supported_versions) { 18 | return std::make_unique(std::move(proof_source), backend, 19 | supported_versions); 20 | } 21 | 22 | } // namespace quic 23 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_server_factory.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2019 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #ifndef QUICHE_QUIC_TOOLS_QUIC_SERVER_FACTORY_H_ 6 | #define QUICHE_QUIC_TOOLS_QUIC_SERVER_FACTORY_H_ 7 | 8 | #include "quiche/quic/tools/quic_toy_server.h" 9 | 10 | namespace quic { 11 | 12 | // Factory creating QuicServer instances. 13 | class QuicServerFactory : public QuicToyServer::ServerFactory { 14 | public: 15 | std::unique_ptr CreateServer( 16 | QuicSimpleServerBackend* backend, 17 | std::unique_ptr proof_source, 18 | const quic::ParsedQuicVersionVector& supported_versions) override; 19 | }; 20 | 21 | } // namespace quic 22 | 23 | #endif // QUICHE_QUIC_TOOLS_QUIC_SERVER_FACTORY_H_ 24 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_simple_crypto_server_stream_helper.cc: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | #include "quiche/quic/tools/quic_simple_crypto_server_stream_helper.h" 6 | 7 | #include 8 | 9 | #include "quiche/quic/core/quic_utils.h" 10 | 11 | namespace quic { 12 | 13 | QuicSimpleCryptoServerStreamHelper::QuicSimpleCryptoServerStreamHelper() = 14 | default; 15 | 16 | QuicSimpleCryptoServerStreamHelper::~QuicSimpleCryptoServerStreamHelper() = 17 | default; 18 | 19 | bool QuicSimpleCryptoServerStreamHelper::CanAcceptClientHello( 20 | const CryptoHandshakeMessage& /*message*/, 21 | const QuicSocketAddress& /*client_address*/, 22 | const QuicSocketAddress& /*peer_address*/, 23 | const QuicSocketAddress& /*self_address*/, 24 | std::string* /*error_details*/) const { 25 | return true; 26 | } 27 | 28 | } // namespace quic 29 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_spdy_server_base.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // A toy server, which connects to a specified port and sends QUIC 6 | // requests to that endpoint. 7 | 8 | #ifndef QUICHE_QUIC_TOOLS_QUIC_SPDY_SERVER_BASE_H_ 9 | #define QUICHE_QUIC_TOOLS_QUIC_SPDY_SERVER_BASE_H_ 10 | 11 | #include "quiche/quic/platform/api/quic_socket_address.h" 12 | 13 | namespace quic { 14 | 15 | // Base class for service instances to be used with QuicToyServer. 16 | class QuicSpdyServerBase { 17 | public: 18 | virtual ~QuicSpdyServerBase() = default; 19 | 20 | // Creates a UDP socket and listens on |address|. Returns true on success 21 | // and false otherwise. 22 | virtual bool CreateUDPSocketAndListen(const QuicSocketAddress& address) = 0; 23 | 24 | // Handles incoming requests. Does not return. 25 | virtual void HandleEventsForever() = 0; 26 | }; 27 | 28 | } // namespace quic 29 | 30 | #endif // QUICHE_QUIC_TOOLS_QUIC_SPDY_SERVER_BASE_H_ 31 | -------------------------------------------------------------------------------- /quiche/quic/tools/quic_toy_client.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 | // Use of this source code is governed by a BSD-style license that can be 3 | // found in the LICENSE file. 4 | 5 | // A toy client, which connects to a specified port and sends QUIC 6 | // requests to that endpoint. 7 | 8 | #ifndef QUICHE_QUIC_TOOLS_QUIC_TOY_CLIENT_H_ 9 | #define QUICHE_QUIC_TOOLS_QUIC_TOY_CLIENT_H_ 10 | 11 | #include "quiche/quic/tools/quic_client_factory.h" 12 | 13 | namespace quic { 14 | 15 | class QuicToyClient { 16 | public: 17 | // Constructs a new toy client that will use |client_factory| to create the 18 | // actual QuicSpdyClientBase instance. 19 | QuicToyClient(ClientFactoryInterface* client_factory); 20 | 21 | // Connects to the QUIC server based on the various flags defined in the 22 | // .cc file, sends requests and prints the responses. Returns 0 on success 23 | // and non-zero otherwise. 24 | int SendRequestsAndPrintResponses(std::vector urls); 25 | 26 | // Compatibility alias 27 | using ClientFactory = ClientFactoryInterface; 28 | 29 | private: 30 | ClientFactoryInterface* client_factory_; // Unowned. 31 | }; 32 | 33 | } // namespace quic 34 | 35 | #endif // QUICHE_QUIC_TOOLS_QUIC_TOY_CLIENT_H_ 36 | --------------------------------------------------------------------------------