Skip to content

Commit

Permalink
Release 2.2.0: server included, ID-22 supported (#76)
Browse files Browse the repository at this point in the history
  • Loading branch information
litespeedtech authored Sep 11, 2019
1 parent 8cba36d commit 5392f7a
Show file tree
Hide file tree
Showing 221 changed files with 113,763 additions and 4,565 deletions.
3 changes: 3 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@ task:
# This is so that both GQUIC and IETF branches build. Just picking
# a known good revision:
- git checkout 32e59d2d3264e4e104b355ef73663b8b79ac4093
- patch -p1 -i ../patches/boringssl-meds.patch
- cmake .
- make
- cd -
script:
- git submodule init
- git submodule update
- cmake -DBORINGSSL_DIR=$PWD/boringssl .
- make
- make test
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "src/liblsquic/ls-qpack"]
path = src/liblsquic/ls-qpack
url = https://github.com/litespeedtech/ls-qpack
branch = v0.9.13
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ before_script:
# This is so that both GQUIC and IETF branches build. Just picking
# a known good revision:
- git checkout 32e59d2d3264e4e104b355ef73663b8b79ac4093
- patch -p1 -i ../patches/boringssl-meds.patch
- cmake .
- make
- cd -
- git submodule init
- git submodule update
- cmake -DBORINGSSL_DIR=$PWD/boringssl .
script:
# Now build lsquic-client
Expand Down
3 changes: 3 additions & 0 deletions APIs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ struct lsquic_engine_settings and struct lsquic_stream_if, as well as:
- Interface for sending outgoing packets, ea_packets_out
- Interface for allocating memory for outgoing packet buffers
(optional).
- Interface for share memory hash, ea_shi
- Optional interface for reporting connections whose handshake
did not complete (ea_bad_handshake)

ea_packets_out is a pointer to a function of type lsquic_packets_out_f.
The engine calls this function when it is appropriate to send out packets
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2019-09-11
- 2.2.0
- [FEATURE] Server code is included in the library
- [FEATURE] IETF QUIC and HTTP/3 Support (ID-22)

2019-05-13
- 1.21.2
- [OPTIMIZATION] HPACK: use history to improve compression performance
Expand Down
21 changes: 16 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,37 @@ IF("${CMAKE_BUILD_TYPE}" STREQUAL "")
SET(CMAKE_BUILD_TYPE Debug)
ENDIF()


MESSAGE(STATUS "Build type: ${CMAKE_BUILD_TYPE}")


IF (NOT MSVC)

SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Wall -Wextra -Wno-unused-parameter")
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fno-omit-frame-pointer")
INCLUDE(CheckCCompilerFlag)
CHECK_C_COMPILER_FLAG(-Wno-implicit-fallthrough HAS_NO_IMPLICIT_FALLTHROUGH)
IF (HAS_NO_IMPLICIT_FALLTHROUGH)
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Wno-implicit-fallthrough")
ENDIF()

IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9.3)
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Wno-missing-field-initializers")
ENDIF()

IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -O0 -g3")
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Werror")
IF(CMAKE_C_COMPILER MATCHES "clang" AND
NOT "$ENV{TRAVIS}" MATCHES "^true$")
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -fsanitize=address")
ENDIF()
# Uncomment to enable fault injection testing via libfiu:
#SET (MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DFIU_ENABLE=1")
# Uncomment to enable cleartext protocol mode (no crypto):
#SET (MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_ENABLE_HANDSHAKE_DISABLE=1")
#SET(LIBS ${LIBS} fiu)
ELSE()
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -O3 -g0")
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DNDEBUG")
# Comment out the following line to compile out debug messages:
#SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_LOWEST_LOG_LEVEL=LSQ_LOG_INFO")
ENDIF()
Expand Down Expand Up @@ -70,7 +77,6 @@ IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
#SET(LIBS ${LIBS} fiu)
ELSE()
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -Ox")
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DNDEBUG")
# Comment out the following line to compile out debug messages:
#SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} -DLSQUIC_LOWEST_LOG_LEVEL=LSQ_LOG_INFO")
ENDIF()
Expand Down Expand Up @@ -189,19 +195,24 @@ ELSE()
MESSAGE(STATUS "libevent not found")
ENDIF()

add_executable(http_server test/http_server.c test/prog.c test/test_common.c test/test_cert.c)


SET(LIBS lsquic ${EVENT_LIB} ${BORINGSSL_LIB_ssl} ${BORINGSSL_LIB_crypto} ${ZLIB_LIB} ${LIBS})

IF (NOT MSVC)

add_executable(http_client
test/http_client.c
test/prog.c
test/test_common.c
test/test_cert.c
)
LIST(APPEND LIBS pthread m)

#MSVC
ELSE()

add_executable(http_client
test/http_client.c
test/prog.c
Expand All @@ -214,13 +225,13 @@ LIST(APPEND LIBS ws2_32)
ENDIF()

TARGET_LINK_LIBRARIES(http_client ${LIBS})

TARGET_LINK_LIBRARIES(http_server ${LIBS})

add_subdirectory(src)

add_subdirectory(test)

IF(NOT (CMAKE_C_FLAGS MATCHES "-DNDEBUG"))
IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
# Our test framework relies on assertions, only compile if assertions are
# enabled.
#
Expand Down
123 changes: 121 additions & 2 deletions EXAMPLES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,18 @@
LSQUIC Examples
===============

test/http_client.c demonstrates how to use HTTP features of QUIC.
LSQUIC comes with several examples of how the library is used.

The client and server programs described below are built on a common
framework and share many options.

HTTP client and server
----------------------

See test/http_{client,server}.c

This pair of programs is to demonstrate how to use HTTP features of QUIC.
HTTP server is interoperable with proto-quic's quic_client.

Usage Examples
--------------
Expand Down Expand Up @@ -65,10 +76,41 @@ To perform load testing, it is good to mix sending and receiving data:
If you don't want to create a hundred 256-megabyte out-get.* files, use -K
flag to discard output.

Testing Large Packet Sizes
---------------------------------

IETF QUIC supports all valid UDP packet sizes. This section outlines the
environment setup and testing parameters necessary to test this feature.

Compilation
- Make sure to compile the library in DEBUG mode so that the NDEBUG
define is off.
- Build both the http_client and http_server test programs.

Running Instructions
- On the server side, define the environment variable
LSQUIC_CN_PACK_SIZE and set it to the intended packet size.
Valid sizes are up to 65507 (IPv4).
- Use the -W flag for http_client and http_server for the ability
to send packets of large size.
- On the client side, use the -z flag to specify the maximum size
of packet that the client will accept.

Example Usage
./http_client -p /file-1M -H www.litespeedtech.com -s 192.168.0.85:5443
-o version=FF000014 -z 65507 -W
./http_server -c www.litespeedtech.com,certschain,privkey
-s 0.0.0.0:5443 -W

Additional Notes
Since this feature does not have MTU discovery enabled at the time of
writing, make sure to use client and server machines that share a path
with the intended MTU.

Control QUIC Settings via -o Flag
---------------------------------

Most of the settings in struct lsquic_engine_settings can be controlled
Most of the settings in struct squic_engine_settings can be controlled
via -o flag. With exception of es_versions, which is a bit mask, other
es_* options can be mapped to corresponding -o value via s/^es_//:

Expand All @@ -77,13 +119,63 @@ es_* options can be mapped to corresponding -o value via s/^es_//:

And so on.

For example, to test version negotiation:

./http_server -c www.litespeedtech.com,certschain,privkey \
-o version=Q035 -L debug 2>server.out &
./http_client -H www.litespeedtech.com -p Makefile -L debug 2>client.out

Above, the client will start with the default, which is the highest supported
QUIC version, which the server should negotiate down. You should see it from
the log files.

The code to set options via -o flag lives in set_engine_option(). It is good
to update this function at the same time as member fields are added to struct
lsquic_engine_settings.

Control LSQUIC Behavior via Environment Variables
-------------------------------------------------

LSQUIC_PACKET_OUT_LIMIT

If set, the value of this environment variable is the maximum number
of packets that can be sent out in one shot. The limit is in the test
program framework's ea_packets_out() callback.

It is not applicable when sendmmsg(2) is used.

Note 1: sendmmsg can be enabled using -g option, if available for your
platform.

Note 2: see -m option for a related packet-out limitation.

LSQUIC_DISABLE_HANDSHAKE

If set (to anything, not any particular value), the QUIC handshake is
disabled and packets are not encrypted. This can be useful to:
a) profile functions in LSQUIC without accounting for crypto stuff,
which tends to dwarf everything else;
b) see bytes in the clear on the wire; and
c) compare throughput performance to TCP without crypto.

This functionality is compiled in if the somewhat-awkwardly named
LSQUIC_ENABLE_HANDSHAKE_DISABLE is set to 1. By default, it is enabled
in debug builds and disabled in optimized builds.

LSQUIC_LOSE_PACKETS_RE

If set, this regular expression specifies the numbers of packets which
the sender will lose on purpose. For example:

export LSQUIC_LOSE_PACKETS_RE='^(3|5|10)$'

The act of losing a packet is performed by changing its payload to
zero-filled buffer of the same size, which is almost as good as
not sending anything. The latter is difficult to implement without
negatively affecting the regular code flow.

Only available in debug builds.

LSQUIC_PACER_INTERTICK

Number of microsecods to use as constant intertick time in lieu of the
Expand All @@ -104,6 +196,21 @@ LSQUIC_RANDOM_SEND_FAILURE

Only available when compiled with -DLSQUIC_RANDOM_SEND_FAILURE=1

LSQUIC_LOG_SECRETS

If set to true value, crypto secrets will be logged. Applies to
IETF QUIC only.

LSQUIC_COALESCE

If set to false, packets are not coalesced. Defaults to true.

LSQUIC_USE_POOLS

If set to false, all memory pooling code is replaced with calls to
malloc() and free(). This facilitates debugging memory issues.
The default is true.

Control Network-Related Stuff
-----------------------------

Expand All @@ -116,9 +223,16 @@ Control Network-Related Stuff
sndbuf=12345 # Sets SO_SNDBUF
rcvbuf=12345 # Sets SO_RCVBUF

-g Use sendmmsg() to send packets. This is only compiled in
if available.

More Compilation Options
------------------------

-DLSQUIC_ENABLE_HANDSHAKE_DISABLE=1

Support disabling of handshake. See above.

-DLSQUIC_CONN_STATS=1

Track some statistics about connections -- packets in, sent, delayed,
Expand All @@ -140,6 +254,11 @@ More Compilation Options
Turn off statistics collection performed by the send controller: number
of packets sent, resent, and delayed.

-DLOG_PACKET_CHECKSUM=1

When turned on, CRC32 checksum of each sent and received packet is
logged as an event.

-DLSQUIC_LOWEST_LOG_LEVEL=LSQ_LOG_WARN

If you want to go even faster: compile out some log levels entirely.
Expand Down
Loading

0 comments on commit 5392f7a

Please sign in to comment.