5 Commits

Author SHA1 Message Date
Richard Ramos
9456daa178 fix: no inline on windows 2025-03-24 21:02:14 -04:00
Richard Ramos
eb04494047 chore: v0.36.0 2025-03-11 17:01:36 -04:00
vladopajic
525d9cfe25 chore: remove absolute path prefix from comments (#16) 2025-03-11 11:15:45 -04:00
richΛrd
95412ee90a chore: add DNGTCP2_STATICLIB and expose unexported anon structs (#13) 2025-03-11 11:00:18 -04:00
vladopajic
98372a266e chore(docs): improved instructions for generating new version (#14) 2025-03-11 14:56:31 +01:00
6 changed files with 58 additions and 14 deletions

View File

@@ -16,7 +16,8 @@ Updating to a newer version
Follow these steps when updating the wrapper to a newer version of ngtcp2:
1. update the git submodule in `sources/` to point to the new version
2. run `build.sh` (requires Nim and CMake to be installed)
3. update the version in `ngtcp2.nimble`
4. commit the changes
- update the git submodule in `libs/` to point to the new version
- `git submodule update --init --recursive`
- run `build.sh` (requires Nim, CMake and clang to be installed)
- increase the `version` property in the `ngtcp2.nimble` file
- commit the changes

View File

@@ -26,14 +26,26 @@ for file in `ls "${root}/build/lib"/*.c`; do
toCompile+=("$file")
done
# futhark is required by generate_ngtcp2.nim
nimble install futhark@0.15.0
nim c --maxLoopIterationsVM:100000000 generate_ngtcp2.nim
# add prelude
cat "${root}/prelude.nim" > ngtcp2.nim
echo >> ngtcp2.nim # linebreak
for file in "${toCompile[@]}"; do
echo "{.compile: \"$file\".}" >> ngtcp2.nim
done
# removes absolute path prefix from comments "Generated based on"
sed -i 's/Generated based on.*\/nim-ngtcp2\/libs\//Generated based on \/nim-ngtcp2\/libs\//g' tmp_ngtcp2.nim
cat tmp_ngtcp2.nim >> ngtcp2.nim
echo >> ngtcp2.nim # linebreak
cat "${root}/extras.nim" >> ngtcp2.nim
rm -f tmp_ngtcp2.nim

14
extras.nim Normal file
View File

@@ -0,0 +1,14 @@
type
ptls_handshake_properties_t_anon0_t* = struct_st_ptls_handshake_properties_t_anon0_t
ptls_handshake_properties_t_anon0_t_client_t* =
struct_st_ptls_handshake_properties_t_anon0_t_client_t
ptls_handshake_properties_t_anon0_t_client_t_negotiated_protocols_t* =
struct_st_ptls_handshake_properties_t_anon0_t_client_t_negotiated_protocols_t
ptls_handshake_properties_t_anon0_t_client_t_ech_t* =
struct_st_ptls_handshake_properties_t_anon0_t_client_t_ech_t
ptls_handshake_properties_t_anon0_t_server_t* =
struct_st_ptls_handshake_properties_t_anon0_t_server_t
ptls_handshake_properties_t_anon0_t_server_t_selected_psk_binder_t* =
struct_st_ptls_handshake_properties_t_anon0_t_server_t_selected_psk_binder_t
ptls_handshake_properties_t_anon0_t_server_t_cookie_t* =
struct_st_ptls_handshake_properties_t_anon0_t_server_t_cookie_t

View File

@@ -9,6 +9,7 @@ import nativesockets
when defined(windows):
{.passl: "-lws2_32".}
{.passc: "-D_WINDOWS".}
{.passc: "-D__CRT__NO_INLINE".}
else:
{.passc: "-DHAVE_UNISTD_H".}
@@ -4799,21 +4800,21 @@ else:
hint("Declaration of " & "struct_ngtcp2_version_info" &
" already exists, not redeclaring")
when not declared(NGTCP2_VERSION):
when "1.6.0" is static:
when "1.11.0-DEV" is static:
const
NGTCP2_VERSION* = "1.6.0" ## Generated based on /home/r/vacp2p/nim-ngtcp2/build/lib/includes/ngtcp2/version.h:39:9
NGTCP2_VERSION* = "1.11.0-DEV" ## Generated based on /home/r/vacp2p/nim-ngtcp2/libs/ngtcp2/lib/includes/ngtcp2/version.h:39:9
else:
let NGTCP2_VERSION* = "1.6.0" ## Generated based on /home/r/vacp2p/nim-ngtcp2/build/lib/includes/ngtcp2/version.h:39:9
let NGTCP2_VERSION* = "1.11.0-DEV" ## Generated based on /home/r/vacp2p/nim-ngtcp2/libs/ngtcp2/lib/includes/ngtcp2/version.h:39:9
else:
static :
hint("Declaration of " & "NGTCP2_VERSION" &
" already exists, not redeclaring")
when not declared(NGTCP2_VERSION_NUM):
when 67072 is static:
when 68352 is static:
const
NGTCP2_VERSION_NUM* = 67072 ## Generated based on /home/r/vacp2p/nim-ngtcp2/build/lib/includes/ngtcp2/version.h:49:9
NGTCP2_VERSION_NUM* = 68352 ## Generated based on /home/r/vacp2p/nim-ngtcp2/libs/ngtcp2/lib/includes/ngtcp2/version.h:49:9
else:
let NGTCP2_VERSION_NUM* = 67072 ## Generated based on /home/r/vacp2p/nim-ngtcp2/build/lib/includes/ngtcp2/version.h:49:9
let NGTCP2_VERSION_NUM* = 68352 ## Generated based on /home/r/vacp2p/nim-ngtcp2/libs/ngtcp2/lib/includes/ngtcp2/version.h:49:9
else:
static :
hint("Declaration of " & "NGTCP2_VERSION_NUM" &
@@ -10412,4 +10413,18 @@ when not declared(PF_INET6):
let PF_INET6* = 10 ## Generated based on /usr/include/x86_64-linux-gnu/bits/socket.h:53:9
else:
static :
hint("Declaration of " & "PF_INET6" & " already exists, not redeclaring")
hint("Declaration of " & "PF_INET6" & " already exists, not redeclaring")
type
ptls_handshake_properties_t_anon0_t* = struct_st_ptls_handshake_properties_t_anon0_t
ptls_handshake_properties_t_anon0_t_client_t* =
struct_st_ptls_handshake_properties_t_anon0_t_client_t
ptls_handshake_properties_t_anon0_t_client_t_negotiated_protocols_t* =
struct_st_ptls_handshake_properties_t_anon0_t_client_t_negotiated_protocols_t
ptls_handshake_properties_t_anon0_t_client_t_ech_t* =
struct_st_ptls_handshake_properties_t_anon0_t_client_t_ech_t
ptls_handshake_properties_t_anon0_t_server_t* =
struct_st_ptls_handshake_properties_t_anon0_t_server_t
ptls_handshake_properties_t_anon0_t_server_t_selected_psk_binder_t* =
struct_st_ptls_handshake_properties_t_anon0_t_server_t_selected_psk_binder_t
ptls_handshake_properties_t_anon0_t_server_t_cookie_t* =
struct_st_ptls_handshake_properties_t_anon0_t_server_t_cookie_t

View File

@@ -1,5 +1,5 @@
packageName = "ngtcp2"
version = "0.35.0"
version = "0.36.1"
author = "Status Research & Development GmbH"
description = "Nim wrapper around the ngtcp2 library"
license = "MIT"

View File

@@ -4,9 +4,12 @@ import strformat
# Socket definitions
import nativesockets
{.passc: "-DNGTCP2_STATICLIB".}
when defined(windows):
{.passl: "-lws2_32".}
{.passc: "-D_WINDOWS".}
{.passc: "-D__CRT__NO_INLINE".}
else:
{.passc: "-DHAVE_UNISTD_H".}
@@ -30,4 +33,3 @@ const picotlsInclude = root/"libs"/"picotls"/"include"
{.passc: fmt"-I{ngtcp2Lib}".}
{.passc: fmt"-I{ngtcp2LibIncludes}".}
{.passc: fmt"-I{picotlsInclude}".}