@@ -11,7 +11,9 @@ import chronos/osdefs
1111import zlib
1212import boringssl
1313
14- type ptrdiff_t* {.importc : " ptrdiff_t" , header : " <stddef.h>" .} = int
14+ type
15+ ptrdiff_t* {.importc : " ptrdiff_t" , header : " <stddef.h>" .} = int
16+ uint_fast8_t* {.importc : " uint_fast8_t" , header : " <stdint.h>" .} = uint8
1517
1618# enums are generated manually to avoid issue described in
1719# https://github.com/PMunch/futhark/issues/152
@@ -43,6 +45,9 @@ borrowCEnumOps(enum_lsquic_conn_param)
4345borrowCEnumOps (enum_LSQUIC_CONN_STATUS)
4446
4547const
48+ MAX_CID_LEN * = 20
49+ GQUIC_CID_LEN * = 8
50+
4651 LSQVER_043 * = enum_lsquic_version (0 )
4752 LSQVER_046 * = enum_lsquic_version (1 )
4853 LSQVER_050 * = enum_lsquic_version (2 )
@@ -107,6 +112,19 @@ when defined(windows):
107112{.passc : " -I" & lshpack.}
108113{.passc : " -I" & xxhash.}
109114
115+ type
116+ struct_lsquic_cid* {.
117+ importc : " struct lsquic_cid" ,
118+ header : " lsquic_types.h" ,
119+ bycopy ,
120+ completeStruct
121+ .} = object
122+ buf* {.importc : " buf" .}: array [MAX_CID_LEN , uint8 ]
123+ len* {.importc : " len" .}: uint_fast8_t
124+ padding: array [3 , uint8 ]
125+
126+ lsquic_cid_t* = struct_lsquic_cid
127+
110128const HAVE_BORINGSSL = " -DHAVE_BORINGSSL"
111129const XXH_HEADER_NAME = " -DXXH_HEADER_NAME=\" <lsquic_xxhash.h>\" "
112130
@@ -357,14 +375,7 @@ else:
357375 " Declaration of " & " LSQUIC_DF_CFCW_CLIENT" & " already exists, not redeclaring"
358376 )
359377type
360- struct_lsquic_cid_570425834 {.pure , inheritable , bycopy .} = object
361- buf* {.align (8 'i64 ).}: array [20 'i64 , uint8 ]
362- # # Generated based on /home/r/vacp2p/nim-lsquic/libs/lsquic/include/lsquic_types.h:27:28
363- len* {.align (8 'i64 ).}: uint_fast8_t_570425837
364-
365378 uint_fast8_t_570425836 = uint8 # # Generated based on /usr/include/stdint.h:60:24
366- lsquic_cid_t_570425838 = struct_lsquic_cid_570425835
367- # # Generated based on /home/r/vacp2p/nim-lsquic/libs/lsquic/include/lsquic_types.h:32:3
368379 lsquic_stream_id_t_570425840 = uint64
369380 # # Generated based on /home/r/vacp2p/nim-lsquic/libs/lsquic/include/lsquic_types.h:40:18
370381 lsquic_engine_t_570425842 = struct_lsquic_engine
554565 pmi_return* : proc (a0: pointer , a1: pointer , a2: pointer , a3: cschar ): void {.cdecl .}
555566
556567 lsquic_cids_update_f_570425876 = proc (
557- a0: pointer , a1: ptr pointer , a2: ptr lsquic_cid_t_570425839 , a3: cuint
568+ a0: pointer , a1: ptr pointer , a2: ptr lsquic_cid_t , a3: cuint
558569 ): void {.cdecl .}
559570 # # Generated based on /home/r/vacp2p/nim-lsquic/libs/lsquic/include/lsquic.h:1307:16
560571 struct_lsquic_hset_if_570425878 {.pure , inheritable , bycopy .} = object
@@ -733,17 +744,6 @@ type
733744 else :
734745 struct_lsquic_conn_info_570425895
735746 )
736- struct_lsquic_cid_570425835 = (
737- when declared (struct_lsquic_cid):
738- when ownSizeof (struct_lsquic_cid) != ownSizeof (struct_lsquic_cid_570425834):
739- static :
740- warning (
741- " Declaration of " & " struct_lsquic_cid" & " exists but with different size"
742- )
743- struct_lsquic_cid
744- else :
745- struct_lsquic_cid_570425834
746- )
747747 lsquic_stream_id_t_570425841 = (
748748 when declared (lsquic_stream_id_t):
749749 when ownSizeof (lsquic_stream_id_t) != ownSizeof (lsquic_stream_id_t_570425840):
@@ -910,17 +910,6 @@ type
910910 else :
911911 lsquic_stream_ctx_t_570425850
912912 )
913- lsquic_cid_t_570425839 = (
914- when declared (lsquic_cid_t):
915- when ownSizeof (lsquic_cid_t) != ownSizeof (lsquic_cid_t_570425838):
916- static :
917- warning (
918- " Declaration of " & " lsquic_cid_t" & " exists but with different size"
919- )
920- lsquic_cid_t
921- else :
922- lsquic_cid_t_570425838
923- )
924913 uint_fast8_t_570425837 = (
925914 when declared (uint_fast8_t):
926915 when ownSizeof (uint_fast8_t) != ownSizeof (uint_fast8_t_570425836):
@@ -1046,11 +1035,6 @@ else:
10461035 hint (
10471036 " Declaration of " & " struct_lsquic_conn_info" & " already exists, not redeclaring"
10481037 )
1049- when not declared (struct_lsquic_cid):
1050- type struct_lsquic_cid* = struct_lsquic_cid_570425834
1051- else :
1052- static :
1053- hint (" Declaration of " & " struct_lsquic_cid" & " already exists, not redeclaring" )
10541038when not declared (lsquic_stream_id_t):
10551039 type lsquic_stream_id_t* = lsquic_stream_id_t_570425840
10561040else :
@@ -1138,11 +1122,6 @@ when not declared(lsquic_stream_ctx_t):
11381122else :
11391123 static :
11401124 hint (" Declaration of " & " lsquic_stream_ctx_t" & " already exists, not redeclaring" )
1141- when not declared (lsquic_cid_t):
1142- type lsquic_cid_t* = lsquic_cid_t_570425838
1143- else :
1144- static :
1145- hint (" Declaration of " & " lsquic_cid_t" & " already exists, not redeclaring" )
11461125when not declared (uint_fast8_t):
11471126 type uint_fast8_t* = uint_fast8_t_570425836
11481127else :
@@ -2670,7 +2649,7 @@ else:
26702649when not declared (lsquic_conn_id):
26712650 proc lsquic_conn_id * (
26722651 c: ptr lsquic_conn_t_570425845
2673- ): ptr lsquic_cid_t_570425839 {.cdecl , importc : " lsquic_conn_id" .}
2652+ ): ptr lsquic_cid_t {.cdecl , importc : " lsquic_conn_id" .}
26742653
26752654else :
26762655 static :
@@ -2968,7 +2947,7 @@ else:
29682947 )
29692948when not declared (lsquic_cid_from_packet):
29702949 proc lsquic_cid_from_packet * (
2971- a0: ptr uint8 , bufsz: csize_t , cid: ptr lsquic_cid_t_570425839
2950+ a0: ptr uint8 , bufsz: csize_t , cid: ptr lsquic_cid_t
29722951 ): cint {.cdecl , importc : " lsquic_cid_from_packet" .}
29732952
29742953else :
0 commit comments