Skip to content
This repository has been archived by the owner on Jul 21, 2024. It is now read-only.

Commit

Permalink
Update to latest version of lsquic
Browse files Browse the repository at this point in the history
  • Loading branch information
omarroth committed Jul 19, 2020
1 parent 5261034 commit 96a75aa
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 63 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,3 @@ client.get("/", headers: HTTP::Headers{
## Contributors

- [Omar Roth](https://github.com/omarroth) - creator and maintainer

```
```
4 changes: 2 additions & 2 deletions shard.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: lsquic
version: 0.1.9
version: 2.18.1

authors:
- Omar Roth <[email protected]>

crystal: 0.34.0
crystal: 0.35.1

license: MIT
16 changes: 14 additions & 2 deletions src/lsquic/client.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,25 @@ module QUIC
headers = [] of LibLsquic::LsxpackHeader
REQUIRED_HEADERS.each do |name|
value = stream_ctx.request.headers[name]
headers << LibLsquic::LsxpackHeader.new(name_ptr: name, name_len: name.bytesize, buf: value, val_len: value.bytesize)
headers << LibLsquic::LsxpackHeader.new(
buf: "#{name}#{value}",
name_len: name.bytesize,
name_offset: 0,
val_len: value.bytesize,
val_offset: name.bytesize
)
end

request_headers.each do |name, values|
name = name.downcase
next if REQUIRED_HEADERS.includes? name
headers << LibLsquic::LsxpackHeader.new(name_ptr: name, name_len: name.bytesize, buf: values[0], val_len: values[0].bytesize)
headers << LibLsquic::LsxpackHeader.new(
buf: "#{name}#{values[0]}",
name_len: name.bytesize,
name_offset: 0,
val_len: values[0].bytesize,
val_offset: name.bytesize
)
end

http_headers = LibLsquic::HttpHeaders.new(count: headers.size, headers: headers.to_unsafe)
Expand Down
Binary file modified src/lsquic/ext/liblsquic.a
Binary file not shown.
102 changes: 47 additions & 55 deletions src/lsquic/liblsquic.cr
Original file line number Diff line number Diff line change
@@ -1,67 +1,59 @@
@[Link(ldflags: "#{__DIR__}/ext/liblsquic.a")]
lib LibLsquic
MAX_CID_LEN = 20
QQUIC_CID_LEN = 8
LSENG_SERVER = 1
LSENG_HTTP = 2
LSENG_SERVER = 1
LSENG_HTTP = 2
LSENG_HTTP_SERVER = LSENG_SERVER | LSENG_HTTP
GLOBAL_CLIENT = 1
GLOBAL_SERVER = 2
MAJOR_VERSION = 2
MINOR_VERSION = 6
PATCH_VERSION = 1
EXPERIMENTAL_Q098 = 0
DEPRECATED_VERSIONS = 0
MIN_CFW = 16 * 1024
DF_CFCW_SERVER = 3 * 1024 * 1024 / 2
DF_CFCW_CLIENT = 15 * 1024 * 1024
DF_SFCW_SERVER = 1 * 1024 * 1024
DF_SFCW_CLIENT = 6 * 1024 * 1024
GLOBAL_CLIENT = 1
GLOBAL_SERVER = 2
MAJOR_VERSION = 2
MINOR_VERSION = 18
PATCH_VERSION = 1
EXPERIMENTAL_Q098 = 0
DEPRECATED_VERSIONS = 0
DF_MAX_STREAMS_IN = 100
DF_INIT_MAX_STREAM_DATA_BIDI_LOCAL_SERVER = 0
DF_INIT_MAX_STREAM_DATA_BIDI_REMOTE_CLIENT = 0
DF_INIT_MAX_STREAMS_UNI_CLIENT = 100
DF_INIT_MAX_STREAMS_UNI_SERVER = 3
DF_INIT_MAX_STREAM_DATA_UNI_CLIENT = 32 * 1024
DF_INIT_MAX_STREAM_DATA_UNI_SERVER = 12 * 1024
DF_IDLE_TIMEOUT = 30
DF_PING_PERIOD = 15
DF_HANDSHAKE_TO = 10 * 1000 * 1000
DF_IDLE_CONN_TO = DF_IDLE_TIMEOUT * 1000 * 1000
DF_SILENT_CLOSE = 1
DF_MAX_HEADER_LIST_SIZE = 0
DF_IDLE_TIMEOUT = 30
DF_PING_PERIOD = 15
DF_SILENT_CLOSE = 1
DF_MAX_HEADER_LIST_SIZE = 0
DF_UA = "LSQUIC"
DF_STTL = 86400
DF_MAX_INCHOATE = 1 * 1000 * 1000
DF_SUPPORT_SREJ_SERVER = 1
DF_SUPPORT_SREJ_CLIENT = 0
DF_SUPPORT_NSTP = 0
DF_SUPPORT_PUSH = 1
DF_SUPPORT_TCID0 = 1
DF_HONOR_PRST = 0
DF_SEND_PRST = 0
DF_PROGRESS_CHECK = 1000
DF_RW_ONCE = 0
DF_PROC_TIME_THRESH = 0
DF_PACE_PACKETS = 1
DF_CLOCK_GRANULARITY = 1000
DF_SCID_LEN = 8
DF_SCID_ISS_RATE = 60
DF_QPACK_DEC_MAX_BLOCKED = 100
DF_QPACK_DEC_MAX_SIZE = 4096
DF_QPACK_ENC_MAX_BLOCKED = 100
DF_QPACK_ENC_MAX_SIZE = 4096
DF_ECN = 0
DF_ALLOW_MIGRATION = 1
DF_CC_ALGO = 2
DF_SUPPORT_NSTP = 0
DF_SUPPORT_PUSH = 1
DF_SUPPORT_TCID0 = 1
DF_HONOR_PRST = 0
DF_SEND_PRST = 0
DF_PROGRESS_CHECK = 1000
DF_RW_ONCE = 0
DF_PROC_TIME_THRESH = 0
DF_PACE_PACKETS = 1
DF_CLOCK_GRANULARITY = 1000
DF_SCID_LEN = 8
DF_SCID_ISS_RATE = 60
DF_QPACK_DEC_MAX_BLOCKED = 100
DF_QPACK_DEC_MAX_SIZE = 4096
DF_QPACK_ENC_MAX_BLOCKED = 100
DF_QPACK_ENC_MAX_SIZE = 4096
DF_ECN = 0
DF_ALLOW_MIGRATION = 1
DF_QL_BITS = 2
DF_SPIN = 1
DF_DELAYED_ACKS = 0
DF_TIMESTAMPS = 1
DF_CC_ALGO = 1
DF_MAX_UDP_PAYLOAD_SIZE_RX = 0
DF_GREASE_QUIC_BIT = 1
DF_NOPROGRESS_TIMEOUT_SERVER = 60
DF_NOPROGRESS_TIMEOUT_CLIENT = 0

struct Cid
len : UintFast8T
len : UInt8
u_cid : CidUCid
end

alias UintFast8T = UInt8

union CidUCid
buf : LibC::UInt8T[20]
id : LibC::UInt64T
Expand All @@ -80,7 +72,6 @@ lib LibLsquic

struct LsxpackHeader
buf : LibC::Char*
name_ptr : LibC::Char*
name_hash : LibC::UInt32T
nameval_hash : LibC::UInt32T
name_offset : LibC::UInt16T
Expand Down Expand Up @@ -261,10 +252,11 @@ lib LibLsquic
Lsqver043 = 0
Lsqver046 = 1
Lsqver050 = 2
LsqverId25 = 3
LsqverId27 = 4
LsqverVerneg = 5
NLsqver = 6
LsqverId27 = 3
LsqverId28 = 4
LsqverId29 = 5
LsqverVerneg = 6
NLsqver = 7
end

fun engine_packet_in = lsquic_engine_packet_in(x0 : EngineT, packet_in_data : UInt8*, packet_in_size : LibC::SizeT, sa_local : Sockaddr*, sa_peer : Sockaddr*, peer_ctx : Void*, ecn : LibC::Int) : LibC::Int
Expand Down Expand Up @@ -374,5 +366,5 @@ lib LibLsquic
LsconnStPeerGoingAway = 9
end

$ver2str : LibC::Char*[6]
$lsquic_ver2str : LibC::Char*[7]
end

0 comments on commit 96a75aa

Please sign in to comment.