diff --git a/CMakeLists.txt b/CMakeLists.txt index 69703432142..6eefa0e894a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,14 +60,24 @@ include(CheckIncludeFiles) include(CheckIncludeFileCXX) include(CheckSymbolExists) +CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H) +CHECK_INCLUDE_FILE(arpa/nameser.h HAVE_ARPA_NAMESER_H) +CHECK_INCLUDE_FILE(arpa/nameser_compat.h HAVE_ARPA_NAMESER_COMPAT_H) CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H) +CHECK_INCLUDE_FILE(endian.h HAVE_ENDIAN_H) CHECK_INCLUDE_FILE(float.h HAVE_FLOAT_H) -CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) -CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H) -CHECK_INCLUDE_FILE(string.h HAVE_STRING_H) CHECK_INCLUDE_FILE(linux/hdreg.h HAVE_LINUX_HDREG_H) CHECK_INCLUDE_FILE(linux/major.h HAVE_LINUX_MAJOR_H) +CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H) +CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H) +CHECK_INCLUDE_FILE(netinet/in_systm.h HAVE_NETINET_IN_SYSTM_H) +CHECK_INCLUDE_FILE(netinet/tcp.h HAVE_NETINET_TCP_H) +CHECK_INCLUDE_FILE(netinet/ip_icmp.h HAVE_NETINET_IP_ICMP_H) +CHECK_INCLUDE_FILE(siginfo.h HAVE_SIGINFO_H) +CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H) +CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H) +CHECK_INCLUDE_FILE(string.h HAVE_STRING_H) CHECK_INCLUDE_FILE(sys/disk.h HAVE_SYS_DISK_H) CHECK_INCLUDE_FILE(sys/disklabel.h HAVE_SYS_DISKLABEL_H) CHECK_INCLUDE_FILE(sys/ioctl.h HAVE_SYS_IOCTL_H) @@ -80,15 +90,6 @@ CHECK_INCLUDE_FILE(sys/mman.h HAVE_SYS_MMAN_H) CHECK_INCLUDE_FILE(sys/mount.h HAVE_SYS_MOUNT_H) CHECK_INCLUDE_FILE(sys/param.h HAVE_SYS_PARAM_H) CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H) -CHECK_INCLUDE_FILE(netinet/in.h HAVE_NETINET_IN_H) -CHECK_INCLUDE_FILE(netinet/in_systm.h HAVE_NETINET_IN_SYSTM_H) -CHECK_INCLUDE_FILE(netinet/tcp.h HAVE_NETINET_TCP_H) -CHECK_INCLUDE_FILE(netinet/ip_icmp.h HAVE_NETINET_IP_ICMP_H) -CHECK_INCLUDE_FILE(netdb.h HAVE_NETDB_H) -CHECK_INCLUDE_FILE(arpa/inet.h HAVE_ARPA_INET_H) -CHECK_INCLUDE_FILE(arpa/nameser.h HAVE_ARPA_NAMESER_H) -CHECK_INCLUDE_FILE(arpa/nameser_compat.h HAVE_ARPA_NAMESER_COMPAT_H) -CHECK_INCLUDE_FILE(siginfo.h HAVE_SIGINFO_H) # Find libraries find_package(TSMallocReplacement QUIET MODULE) @@ -111,6 +112,7 @@ find_package(PCRE) include(FindOpenSSL) find_package(OpenSSL) find_package(ZLIB REQUIRED) +find_package(QUICHE) # Find ccache include(find_ccache) diff --git a/cmake/FindQUICHE.cmake b/cmake/FindQUICHE.cmake new file mode 100644 index 00000000000..ddaff587896 --- /dev/null +++ b/cmake/FindQUICHE.cmake @@ -0,0 +1,35 @@ +####################### +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor license +# agreements. See the NOTICE file distributed with this work for additional information regarding +# copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# +####################### + +set(QUICHE_INSTALL_DIR /opt/quiche) + +find_path(QUICHE_INCLUDE_DIR NAMES quiche.h HINTS ${QUICHE_INSTALL_DIR} PATH_SUFFIXES include) +find_library(QUICHE_LIBRARY NAMES quiche HINTS ${QUICHE_INSTALL_DIR} PATH_SUFFIXES lib) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(QUICHE DEFAULT_MSG QUICHE_LIBRARY QUICHE_INCLUDE_DIR) + +if(QUICHE_FOUND) + set(QUICHE_LIBRARY_DIR ${QUICHE_INSTALL_DIR}/lib) + set(QUIC_LIBRARY_DIRS ${QUICHE_LIBRARY_DIR}) + set(QUIC_LIBRARIES ${QUICHE_LIBRARY} http3 quic) + set(QUIC_INCLUDE_DIRS ${QUICHE_INCLUDE_DIR} ${CMAKE_SOURCE_DIR}/iocore/net/quic) + set(TS_HAS_QUICHE 1) + set(TS_USE_QUIC 1) +endif() + +unset(QUICHE_INSTALL_DIR) diff --git a/include/tscore/ink_config.h.cmake.in b/include/tscore/ink_config.h.cmake.in index 3efa8e8d950..86de3a15245 100644 --- a/include/tscore/ink_config.h.cmake.in +++ b/include/tscore/ink_config.h.cmake.in @@ -34,6 +34,7 @@ #cmakedefine HAVE_BROTLI_ENCODE_H 1 #cmakedefine HAVE_DLFCN_H 1 +#cmakedefine HAVE_ENDIAN_H 1 #cmakedefine HAVE_FLOAT_H 1 #cmakedefine HAVE_LZMA_H 1 #cmakedefine HAVE_STDLIB_H 1 @@ -117,6 +118,8 @@ const int DEFAULT_STACKSIZE = @DEFAULT_STACK_SIZE@; #cmakedefine01 TS_USE_SET_RBIO #cmakedefine01 TS_USE_DIAGS #cmakedefine01 TS_USE_GET_DH_2048_256 +#cmakedefine01 TS_USE_QUIC +#cmakedefine01 TS_HAS_QUICHE #define TS_BUILD_CANONICAL_HOST "@CMAKE_HOST@" diff --git a/iocore/net/CMakeLists.txt b/iocore/net/CMakeLists.txt index 5b3f0e229cc..dde8fed7cc3 100644 --- a/iocore/net/CMakeLists.txt +++ b/iocore/net/CMakeLists.txt @@ -15,6 +15,19 @@ # ####################### +add_subdirectory(quic) + +if(TS_HAS_QUICHE) + set(QUIC_SOURCES + QUICClosedConCollector.cc + QUICMultiCertConfigLoader.cc + QUICNet.cc + QUICNetProcessor_quiche.cc + QUICNetVConnection_quiche.cc + QUICNextProtocolAccept_quiche.cc + QUICPacketHandler_quiche.cc + ) +endif() add_library(inknet STATIC ALPNSupport.cc @@ -63,7 +76,9 @@ add_library(inknet STATIC UnixUDPNet.cc SSLDynlock.cc SNIActionPerformer.cc - ) + ${QUIC_SOURCES} +) + target_link_libraries(inknet inkevent records_p) target_compile_options(inknet PUBLIC -Wno-deprecated-declarations) target_include_directories(inknet PRIVATE @@ -84,7 +99,8 @@ target_include_directories(inknet PRIVATE ${CMAKE_SOURCE_DIR}/src/traffic_server ${OPENSSL_INCLUDE_DIRS} ${YAML_INCLUDE_DIRS} - ) + ${QUIC_INCLUDE_DIRS} +) # Fails to link because of circular dep with proxy (ParentSelection) # add_executable(test_net unit_tests/test_ProxyProtocol.cc) diff --git a/iocore/net/quic/CMakeLists.txt b/iocore/net/quic/CMakeLists.txt new file mode 100644 index 00000000000..cc1e25d3e34 --- /dev/null +++ b/iocore/net/quic/CMakeLists.txt @@ -0,0 +1,40 @@ +####################### +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor license +# agreements. See the NOTICE file distributed with this work for additional information regarding +# copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# +####################### + +add_library(quic STATIC + QUICApplication.cc + QUICApplicationMap.cc + QUICConfig.cc + QUICContext.cc + QUICConnectionTable.cc + QUICGlobals.cc + QUICTypes.cc + QUICIntUtil.cc + QUICStream.cc + QUICStream_quiche.cc + QUICStreamManager.cc + QUICStreamManager_quiche.cc + QUICStreamAdapter.cc + QUICStreamVCAdapter.cc +) + +target_include_directories(quic PRIVATE + ${CMAKE_SOURCE_DIR}/iocore/net + ${CMAKE_SOURCE_DIR}/iocore/net/quic + ${CMAKE_SOURCE_DIR}/iocore/eventsystem + ${QUIC_INCLUDE_DIRS} +) diff --git a/proxy/CMakeLists.txt b/proxy/CMakeLists.txt index 62083e5ee17..33fc07c4e1b 100644 --- a/proxy/CMakeLists.txt +++ b/proxy/CMakeLists.txt @@ -61,3 +61,6 @@ add_subdirectory(shared) add_subdirectory(http) add_subdirectory(http2) add_subdirectory(logging) +if (TS_USE_QUIC) + add_subdirectory(http3) +endif(TS_USE_QUIC) diff --git a/proxy/http/CMakeLists.txt b/proxy/http/CMakeLists.txt index 9605c21bbdf..652aa3a457f 100644 --- a/proxy/http/CMakeLists.txt +++ b/proxy/http/CMakeLists.txt @@ -46,5 +46,6 @@ target_include_directories(http PRIVATE ${CMAKE_SOURCE_DIR}/mgmt ${CMAKE_SOURCE_DIR}/mgmt/utils ${YAMLCPP_INCLUDE_DIR} + ${QUIC_INCLUDE_DIRS} ) -add_subdirectory(remap) \ No newline at end of file +add_subdirectory(remap) diff --git a/proxy/http3/CMakeLists.txt b/proxy/http3/CMakeLists.txt new file mode 100644 index 00000000000..6eb74427279 --- /dev/null +++ b/proxy/http3/CMakeLists.txt @@ -0,0 +1,47 @@ +####################### +# +# Licensed to the Apache Software Foundation (ASF) under one or more contributor license +# agreements. See the NOTICE file distributed with this work for additional information regarding +# copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under the License +# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express +# or implied. See the License for the specific language governing permissions and limitations under +# the License. +# +####################### + + +add_library(http3 STATIC + Http09App.cc + Http3.cc + Http3Config.cc + Http3App.cc + Http3Types.cc + Http3SessionAccept.cc + Http3Session.cc + Http3Transaction.cc + Http3DebugNames.cc + Http3Frame.cc + Http3FrameCollector.cc + Http3FrameDispatcher.cc + Http3HeaderFramer.cc + Http3DataFramer.cc + Http3HeaderVIOAdaptor.cc + Http3StreamDataVIOAdaptor.cc + QPACK.cc +) + +target_include_directories(http3 PRIVATE + ${CMAKE_SOURCE_DIR}/iocore/net + ${CMAKE_SOURCE_DIR}/iocore/net/quic + ${CMAKE_SOURCE_DIR}/iocore/eventsystem + ${CMAKE_SOURCE_DIR}/mgmt + ${IOCORE_INCLUDE_DIRS} + ${PROXY_INCLUDE_DIRS} + ${QUIC_INCLUDE_DIRS} +) diff --git a/src/traffic_server/CMakeLists.txt b/src/traffic_server/CMakeLists.txt index b730f0cf4e3..d48bf66f675 100644 --- a/src/traffic_server/CMakeLists.txt +++ b/src/traffic_server/CMakeLists.txt @@ -15,6 +15,7 @@ # ####################### + add_executable(traffic_server Crash.cc EventName.cc @@ -32,6 +33,7 @@ target_include_directories(traffic_server PRIVATE ${PROXY_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR}/mgmt ${CMAKE_SOURCE_DIR}/mgmt/utils + ${QUIC_INCLUDE_DIRS} ) target_link_libraries(traffic_server http @@ -59,7 +61,8 @@ target_link_libraries(traffic_server jsonrpc_protocol jsonrpc_server rpcpublichandlers - ) + ${QUIC_LIBRARIES} +) if (TS_USE_LINUX_IO_URING) target_link_libraries(traffic_server inkuring uring)