don't use importc / header pragmas for types to resolve type declaration conflicts; don't use header pragma at all

This commit is contained in:
Christian Ulrich 2020-11-02 23:51:47 +01:00
parent 02b9d5fb82
commit fbebb0f566
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
14 changed files with 109 additions and 113 deletions

View File

@ -10,31 +10,27 @@ from picotls import
ptls_verify_certificate_t ptls_verify_certificate_t
type type
ptls_openssl_signature_scheme_t* {.importc: "struct st_ptls_openssl_signature_scheme_t", ptls_openssl_signature_scheme_t* {.bycopy.} = object
header: "picotls/openssl.h", bycopy.} = object
scheme_id*: uint16 scheme_id*: uint16
scheme_md*: PEVP_MD scheme_md*: PEVP_MD
ptls_openssl_sign_certificate_t* {.importc, header: "picotls/openssl.h", bycopy.} = object ptls_openssl_sign_certificate_t* {.bycopy.} = object
super*: ptls_sign_certificate_t super*: ptls_sign_certificate_t
key*: EVP_PKEY key*: EVP_PKEY
schemes*: array[4, ptls_openssl_signature_scheme_t] schemes*: array[4, ptls_openssl_signature_scheme_t]
ptls_openssl_verify_certificate_t* {.importc, header: "picotls/openssl.h", bycopy.} = object ptls_openssl_verify_certificate_t* {.bycopy.} = object
super*: ptls_verify_certificate_t super*: ptls_verify_certificate_t
cert_store*: PX509_STORE cert_store*: PX509_STORE
proc ptls_openssl_random_bytes*(buf: pointer, len: csize_t) {.cdecl, importc, proc ptls_openssl_random_bytes*(buf: pointer, len: csize_t) {.cdecl, importc.}
header: "picotls/openssl.h".}
proc ptls_openssl_init_verifiy_certificate*(self: ptr ptls_openssl_verify_certificate_t, proc ptls_openssl_init_verifiy_certificate*(self: ptr ptls_openssl_verify_certificate_t,
store: PX509_STORE): cint {.cdecl, store: PX509_STORE): cint {.cdecl, importc.}
importc, header: "picotls/openssl.h".}
proc ptls_openssl_init_sign_certificate*(self: ptr ptls_openssl_sign_certificate_t, proc ptls_openssl_init_sign_certificate*(self: ptr ptls_openssl_sign_certificate_t,
key: EVP_PKEY): cint {.cdecl, importc, key: EVP_PKEY): cint {.cdecl, importc.}
header: "picotls/openssl.h".}
var ptls_openssl_cipher_suites* {.importc, header: "picotls/openssl.h".}: ptr ptr ptls_cipher_suite_t var ptls_openssl_cipher_suites* {.importc.}: ptr ptr ptls_cipher_suite_t
var ptls_openssl_key_exchanges* {.importc, header: "picotls/openssl.h".}: ptr ptr ptls_key_exchange_algorithm_t var ptls_openssl_key_exchanges* {.importc.}: ptr ptr ptls_key_exchange_algorithm_t

View File

@ -5,7 +5,7 @@ type
list*: ptr T list*: ptr T
count*: csize_t count*: csize_t
ptls_cipher_algorithm_t* {.importc, header: "picotls.h", bycopy.} = object ptls_cipher_algorithm_t* {.bycopy.} = object
name*: cstring name*: cstring
key_size*: csize_t key_size*: csize_t
block_size*: csize_t block_size*: csize_t
@ -14,7 +14,7 @@ type
setup_crypto*: proc(ctx: ptr ptls_cipher_context_t, is_enc: cint, setup_crypto*: proc(ctx: ptr ptls_cipher_context_t, is_enc: cint,
key: pointer): cint {.cdecl.} key: pointer): cint {.cdecl.}
ptls_aead_algorithm_t* {.importc, header: "picotls.h", bycopy.} = object ptls_aead_algorithm_t* {.bycopy.} = object
name*: cstring name*: cstring
confidentiality_limit*: uint64 confidentiality_limit*: uint64
integrity_limit*: uint64 integrity_limit*: uint64
@ -27,12 +27,12 @@ type
setup_crypto*: proc(ctx: ptr ptls_aead_context_t, is_enc: cint, setup_crypto*: proc(ctx: ptr ptls_aead_context_t, is_enc: cint,
key: pointer, iv: pointer): cint {.cdecl.} key: pointer, iv: pointer): cint {.cdecl.}
ptls_hash_final_mode_t* {.importc, header: "picotls.h".} = enum ptls_hash_final_mode_t* {.bycopy.} = enum
PTLS_HASH_FINAL_MODE_FREE = 0, PTLS_HASH_FINAL_MODE_FREE = 0,
PTLS_HASH_FINAL_MODE_RESET = 1, PTLS_HASH_FINAL_MODE_RESET = 1,
PTLS_HASH_FINAL_MODE_SNAPSHOT = 2 PTLS_HASH_FINAL_MODE_SNAPSHOT = 2
ptls_hash_context_t* {.importc, header: "picotls.h", bycopy.} = object ptls_hash_context_t* {.bycopy.} = object
update*: proc(ctx: ptr ptls_hash_context_t, src: pointer, len: csize_t) update*: proc(ctx: ptr ptls_hash_context_t, src: pointer, len: csize_t)
{.cdecl.} {.cdecl.}
final*: proc(ctx: ptr ptls_hash_context_t, md: pointer, final*: proc(ctx: ptr ptls_hash_context_t, md: pointer,
@ -40,13 +40,13 @@ type
clone*: proc(src: ptr ptls_hash_context_t): ptr ptls_hash_context_t clone*: proc(src: ptr ptls_hash_context_t): ptr ptls_hash_context_t
{.cdecl.} {.cdecl.}
ptls_hash_algorithm_t* {.importc, header: "picotls.h", bycopy.} = object ptls_hash_algorithm_t* {.bycopy.} = object
block_size*: csize_t block_size*: csize_t
digest_size*: csize_t digest_size*: csize_t
create*: proc(): ptr ptls_hash_context_t {.cdecl.} create*: proc(): ptr ptls_hash_context_t {.cdecl.}
empty_digest*: array[PTLS_MAX_DIGEST_SIZE, uint8] empty_digest*: array[PTLS_MAX_DIGEST_SIZE, uint8]
ptls_cipher_suite_t* {.importc, header: "picotls.h", bycopy.} = object ptls_cipher_suite_t* {.bycopy.} = object
id*: uint16 id*: uint16
aead*: ptr ptls_aead_algorithm_t aead*: ptr ptls_aead_algorithm_t
hash*: ptr ptls_hash_algorithm_t hash*: ptr ptls_hash_algorithm_t
@ -58,9 +58,9 @@ type
VerifySignCb* = proc(verify_ctx: pointer, data: ptls_iovec_t, VerifySignCb* = proc(verify_ctx: pointer, data: ptls_iovec_t,
sign: ptls_iovec_t): cint {.cdecl.} sign: ptls_iovec_t): cint {.cdecl.}
ptls_t* {.importc, header: "picotls.h", bycopy.} = object ptls_t* {.bycopy.} = object
ptls_key_exchange_algorithm_t* {.importc, header: "picotls.h", bycopy.} = object ptls_key_exchange_algorithm_t* {.bycopy.} = object
id*: uint16 id*: uint16
create*: proc(algo: ptr ptls_key_exchange_algorithm_t, create*: proc(algo: ptr ptls_key_exchange_algorithm_t,
ctx: ptr ptr ptls_key_exchange_context_t): cint {.cdecl.} ctx: ptr ptr ptls_key_exchange_context_t): cint {.cdecl.}
@ -69,14 +69,14 @@ type
{.cdecl.} {.cdecl.}
data*: pointer data*: pointer
ptls_key_exchange_context_t* {.importc, header: "picotls.h", bycopy.} = object ptls_key_exchange_context_t* {.bycopy.} = object
algo*: ptr ptls_key_exchange_algorithm_t algo*: ptr ptls_key_exchange_algorithm_t
pubkey*: ptls_iovec_t pubkey*: ptls_iovec_t
on_exchange*: proc(keyex: ptr ptr ptls_key_exchange_context_t, release: cint, on_exchange*: proc(keyex: ptr ptr ptls_key_exchange_context_t, release: cint,
secret: ptr ptls_iovec_t, peerkey: ptls_iovec_t): cint secret: ptr ptls_iovec_t, peerkey: ptls_iovec_t): cint
{.cdecl.} {.cdecl.}
ptls_esni_context_t* {.importc, header: "picotls.h", bycopy.} = object ptls_esni_context_t* {.bycopy.} = object
key_exchanges*: ptr ptr ptls_key_exchange_context_t key_exchanges*: ptr ptr ptls_key_exchange_context_t
cipher_suites*: ptr CipherSuiteListElem cipher_suites*: ptr CipherSuiteListElem
padded_length*: uint16 padded_length*: uint16
@ -84,11 +84,11 @@ type
not_after*: uint64 not_after*: uint64
version*: uint16 version*: uint16
ptls_iovec_t* {.importc, header: "picotls.h", bycopy.} = object ptls_iovec_t* {.bycopy.} = object
base*: uint8 base*: uint8
len*: csize_t len*: csize_t
ptls_on_client_hello_parameters_t* {.importc, header: "picotls.h", bycopy.} = object ptls_on_client_hello_parameters_t* {.bycopy.} = object
server_name*: ptls_iovec_t server_name*: ptls_iovec_t
raw_message*: ptls_iovec_t raw_message*: ptls_iovec_t
negotiated_protocols*: List[ptls_iovec_t] negotiated_protocols*: List[ptls_iovec_t]
@ -98,83 +98,83 @@ type
esni* {.bitsize: 1.}: cuint esni* {.bitsize: 1.}: cuint
incompatible_version* {.bitsize: 1.}: cuint incompatible_version* {.bitsize: 1.}: cuint
ptls_traffic_protection_t* {.importc, header: "picotls.h", incompleteStruct.} = object ptls_traffic_protection_t* {.bycopy, incompleteStruct.} = object
ptls_message_emitter_t* {.importc, header: "picotls.h", bycopy.} = object ptls_message_emitter_t* {.bycopy.} = object
buf*: ptr ptls_buffer_t buf*: ptr ptls_buffer_t
enc*: ptr ptls_traffic_protection_t enc*: ptr ptls_traffic_protection_t
record_header_length*: csize_t record_header_length*: csize_t
begin_message*: proc (self: ptr ptls_message_emitter_t): cint {.cdecl.} begin_message*: proc (self: ptr ptls_message_emitter_t): cint {.cdecl.}
commit_message*: proc (self: ptr ptls_message_emitter_t): cint {.cdecl.} commit_message*: proc (self: ptr ptls_message_emitter_t): cint {.cdecl.}
ptls_key_schedule_t* {.importc, header: "picotls.h", bycopy.} = object ptls_key_schedule_t* {.bycopy.} = object
ptls_buffer_t* {.importc, header: "picotls.h", bycopy.} = object ptls_buffer_t* {.bycopy.} = object
base*: uint8 base*: uint8
capacity*: csize_t capacity*: csize_t
off*: csize_t off*: csize_t
is_allocated*: cint is_allocated*: cint
ptls_get_time_t* {.importc, header: "picotls.h", bycopy.} = object ptls_get_time_t* {.bycopy.} = object
cb: proc(self: ptr ptls_get_time_t): uint64 {.cdecl.} cb: proc(self: ptr ptls_get_time_t): uint64 {.cdecl.}
ptls_on_client_hello_t* {.importc, header: "picotls.h", bycopy.} = object ptls_on_client_hello_t* {.bycopy.} = object
cb: proc(self: ptr ptls_on_client_hello_t, tls: ptr ptls_t, cb: proc(self: ptr ptls_on_client_hello_t, tls: ptr ptls_t,
params: ptr ptls_on_client_hello_parameters_t): cint {.cdecl.} params: ptr ptls_on_client_hello_parameters_t): cint {.cdecl.}
ptls_emit_certificate_t* {.importc, header: "picotls.h", bycopy.} = object ptls_emit_certificate_t* {.bycopy.} = object
cb: proc(self: ptr ptls_emit_certificate_t, tls: ptr ptls_t, cb: proc(self: ptr ptls_emit_certificate_t, tls: ptr ptls_t,
emitter: ptr ptls_message_emitter_t, emitter: ptr ptls_message_emitter_t,
key_sched: ptr ptls_key_schedule_t, context: ptls_iovec_t, key_sched: ptr ptls_key_schedule_t, context: ptls_iovec_t,
push_status_request: cint, compress_algos: uint16, push_status_request: cint, compress_algos: uint16,
num_compress_algos: csize_t): cint {.cdecl.} num_compress_algos: csize_t): cint {.cdecl.}
ptls_sign_certificate_t* {.importc, header: "picotls.h", bycopy.} = object ptls_sign_certificate_t* {.bycopy.} = object
cb: proc(self: ptr ptls_sign_certificate_t, tls: ptr ptls_t, cb: proc(self: ptr ptls_sign_certificate_t, tls: ptr ptls_t,
selected_algorithm: uint16, output: ptr ptls_buffer_t, selected_algorithm: uint16, output: ptr ptls_buffer_t,
input: ptls_iovec_t, algorithms: uint16, input: ptls_iovec_t, algorithms: uint16,
num_algorithms: csize_t): cint {.cdecl.} num_algorithms: csize_t): cint {.cdecl.}
ptls_verify_certificate_t* {.importc, header: "picotls.h", bycopy.} = object ptls_verify_certificate_t* {.bycopy.} = object
cb: proc(self: ptr ptls_verify_certificate_t, tls: ptr ptls_t, cb: proc(self: ptr ptls_verify_certificate_t, tls: ptr ptls_t,
verify_sign: ptr VerifySignCb, verify_data: ptr pointer, verify_sign: ptr VerifySignCb, verify_data: ptr pointer,
certs: ptls_iovec_t, numCerts: csize_t): cint {.cdecl.} certs: ptls_iovec_t, numCerts: csize_t): cint {.cdecl.}
ptls_encrypt_ticket_t* {.importc, header: "picotls.h", bycopy.} = object ptls_encrypt_ticket_t* {.bycopy.} = object
cb: proc(self: ptr ptls_encrypt_ticket_t, tls: ptr ptls_t, is_encrypt: cint, cb: proc(self: ptr ptls_encrypt_ticket_t, tls: ptr ptls_t, is_encrypt: cint,
dst: ptr ptls_buffer_t, src: ptls_iovec_t): cint {.cdecl.} dst: ptr ptls_buffer_t, src: ptls_iovec_t): cint {.cdecl.}
ptls_save_ticket_t* {.importc, header: "picotls.h", bycopy.} = object ptls_save_ticket_t* {.bycopy.} = object
cb: proc(self: ptr ptls_save_ticket_t, tls: ptr ptls_t, input: ptls_iovec_t): cb: proc(self: ptr ptls_save_ticket_t, tls: ptr ptls_t, input: ptls_iovec_t):
cint {.cdecl.} cint {.cdecl.}
ptls_log_event_t* {.importc, header: "picotls.h", bycopy.} = object ptls_log_event_t* {.bycopy.} = object
cb: proc(self: ptr ptls_log_event_t, tls: ptr ptls_t, `type`: cstring, cb: proc(self: ptr ptls_log_event_t, tls: ptr ptls_t, `type`: cstring,
fmt: cstring) {.cdecl, varargs.} fmt: cstring) {.cdecl, varargs.}
ptls_update_open_count_t* {.importc, header: "picotls.h", bycopy.} = object ptls_update_open_count_t* {.bycopy.} = object
cb: proc(self: ptr ptls_update_open_count_t, delta: BiggestInt) {.cdecl.} cb: proc(self: ptr ptls_update_open_count_t, delta: BiggestInt) {.cdecl.}
ptls_update_traffic_key_t* {.importc, header: "picotls.h", bycopy.} = object ptls_update_traffic_key_t* {.bycopy.} = object
cb: proc(self: ptr ptls_update_traffic_key_t, tls: ptr ptls_t, is_enc: cint, cb: proc(self: ptr ptls_update_traffic_key_t, tls: ptr ptls_t, is_enc: cint,
epoch: csize_t, secret: pointer): cint {.cdecl.} epoch: csize_t, secret: pointer): cint {.cdecl.}
ptls_decompress_certificate_t* {.importc, header: "picotls.h", bycopy.} = object ptls_decompress_certificate_t* {.bycopy.} = object
supported_algorithms*: uint16 supported_algorithms*: uint16
cb: proc(self: ptr ptls_decompress_certificate_t, tls: ptr ptls_t, cb: proc(self: ptr ptls_decompress_certificate_t, tls: ptr ptls_t,
algorithm: uint16, output: ptls_iovec_t, input: ptls_iovec_t): cint algorithm: uint16, output: ptls_iovec_t, input: ptls_iovec_t): cint
{.cdecl.} {.cdecl.}
ptls_update_esni_key_t* {.importc, header: "picotls.h", bycopy.} = object ptls_update_esni_key_t* {.bycopy.} = object
cb: proc(self: ptr ptls_update_esni_key_t, tls: ptr ptls_t, secret: ptls_iovec_t, cb: proc(self: ptr ptls_update_esni_key_t, tls: ptr ptls_t, secret: ptls_iovec_t,
hash: ptls_hash_algorithm_t, hashed_esni_contents: pointer): cint hash: ptls_hash_algorithm_t, hashed_esni_contents: pointer): cint
{.cdecl.} {.cdecl.}
ptls_on_extension_t* {.importc, header: "picotls.h", bycopy.} = object ptls_on_extension_t* {.bycopy.} = object
cb: proc(self: ptr ptls_on_extension_t, tls: ptr ptls_t, hstype: uint8, cb: proc(self: ptr ptls_on_extension_t, tls: ptr ptls_t, hstype: uint8,
exttype: uint16, extdata: ptls_iovec_t): cint {.cdecl.} exttype: uint16, extdata: ptls_iovec_t): cint {.cdecl.}
ptls_context_t* {.importc, header: "picotls.h", bycopy.} = object ptls_context_t* {.bycopy.} = object
random_bytes*: proc (buf: pointer, len: csize_t) {.cdecl.} random_bytes*: proc (buf: pointer, len: csize_t) {.cdecl.}
get_time*: ptr ptls_get_time_t get_time*: ptr ptls_get_time_t
key_exchanges*: ptr ptr ptls_key_exchange_algorithm_t key_exchanges*: ptr ptr ptls_key_exchange_algorithm_t
@ -203,19 +203,19 @@ type
update_esni_key*: ptr ptls_update_esni_key_t update_esni_key*: ptr ptls_update_esni_key_t
on_extension*: ptr ptls_on_extension_t on_extension*: ptr ptls_on_extension_t
ptls_cipher_context_t* {.importc, header: "picotls.h", bycopy.} = object ptls_cipher_context_t* {.bycopy.} = object
algo*: ptr ptls_cipher_algorithm_t algo*: ptr ptls_cipher_algorithm_t
do_dispose*: proc(ctx: ptr ptls_cipher_context_t) {.cdecl.} do_dispose*: proc(ctx: ptr ptls_cipher_context_t) {.cdecl.}
do_init*: proc(ctx: ptr ptls_cipher_context_t, iv: pointer) {.cdecl.} do_init*: proc(ctx: ptr ptls_cipher_context_t, iv: pointer) {.cdecl.}
do_transform*: proc(ctx: ptr ptls_cipher_context_t, output: pointer, do_transform*: proc(ctx: ptr ptls_cipher_context_t, output: pointer,
input: pointer, len: csize_t) {.cdecl.} input: pointer, len: csize_t) {.cdecl.}
ptls_aead_supplementary_encryption_t* {.importc, header: "picotls.h", bycopy.} = object ptls_aead_supplementary_encryption_t* {.bycopy.} = object
ctx*: ptr ptls_cipher_context_t ctx*: ptr ptls_cipher_context_t
input*: pointer input*: pointer
output*: array[16, uint8] output*: array[16, uint8]
ptls_aead_context_t* {.importc, header: "picotls.h", bycopy.} = object ptls_aead_context_t* {.bycopy.} = object
algo*: ptr ptls_aead_algorithm_t algo*: ptr ptls_aead_algorithm_t
dispose_crypto*: proc(ctx: ptr ptls_aead_context_t) {.cdecl.} dispose_crypto*: proc(ctx: ptr ptls_aead_context_t) {.cdecl.}
do_encrypt_init*: proc(ctx: ptr ptls_aead_context_t, seq: uint64, do_encrypt_init*: proc(ctx: ptr ptls_aead_context_t, seq: uint64,
@ -255,16 +255,16 @@ type
client*: ClientProperties client*: ClientProperties
server*: ServerProperties server*: ServerProperties
ptls_raw_extension_t* {.importc, header: "picotls.h", bycopy.} = object ptls_raw_extension_t* {.bycopy.} = object
`type`*: uint16 `type`*: uint16
data*: ptls_iovec_t data*: ptls_iovec_t
ptls_early_data_acceptance_t* {.importc, header: "picotls.h".} = enum ptls_early_data_acceptance_t* {.bycopy.} = enum
PTLS_EARLY_DATA_ACCEPTANCE_UNKNOWN = 0, PTLS_EARLY_DATA_ACCEPTANCE_UNKNOWN = 0,
PTLS_EARLY_DATA_REJECTED, PTLS_EARLY_DATA_REJECTED,
PTLS_EARLY_DATA_ACCEPTED PTLS_EARLY_DATA_ACCEPTED
ptls_handshake_properties_t* {.importc, header: "picotls.h", bycopy.} = object ptls_handshake_properties_t* {.bycopy.} = object
properties*: ClientOrServer properties*: ClientOrServer
additional_extensions*: ptr ptls_raw_extension_t additional_extensions*: ptr ptls_raw_extension_t
collect_extension*: proc (tls: ptr ptls_t; collect_extension*: proc (tls: ptr ptls_t;
@ -274,7 +274,7 @@ type
properties: ptr ptls_handshake_properties_t; properties: ptr ptls_handshake_properties_t;
extensions: ptr ptls_raw_extension_t): cint {.cdecl.} extensions: ptr ptls_raw_extension_t): cint {.cdecl.}
var ptls_get_time* {.importc, header: "picotls.h".}: ptls_get_time_t var ptls_get_time* {.importc.}: ptls_get_time_t
proc ptls_load_certificates*(ctx: ptls_context_t, cert_pem_file: cstring) {.cdecl, proc ptls_load_certificates*(ctx: ptr ptls_context_t, cert_pem_file: cstring):
importc, header: "picotls.h".} cint {.cdecl, importc.}

View File

@ -1,5 +1,5 @@
type type
quicly_cc_t* {.importc, header: "quicly/cc.h", bycopy.} = enum quicly_cc_t* {.bycopy.} = enum
CC_RENO_MODIFIED, CC_RENO_MODIFIED,
#CUBIC (RFC 8312) #CUBIC (RFC 8312)
CC_CUBIC CC_CUBIC

View File

@ -1,15 +1,15 @@
type type
quicly_cid_t* {.importc, header: "quicly/cid.h", bycopy.} = object quicly_cid_t* {.bycopy.} = object
cid*: array[20, uint8] cid*: array[20, uint8]
len*: uint8 len*: uint8
quicly_cid_plaintext_t* {.importc, header: "quicly/cid.h", bycopy.} = object quicly_cid_plaintext_t* {.bycopy.} = object
master_id*: uint32 master_id*: uint32
path_id* {.bitsize: 8.}: uint32 path_id* {.bitsize: 8.}: uint32
thread_id* {.bitsize: 24.}: uint32 thread_id* {.bitsize: 24.}: uint32
node_id*: uint64 node_id*: uint64
quicly_cid_encryptor_t* {.importc, header: "quicly/cid.h", bycopy.} = object quicly_cid_encryptor_t* {.bycopy.} = object
encrypt_cid*: proc (self: ptr quicly_cid_encryptor_t; encrypt_cid*: proc (self: ptr quicly_cid_encryptor_t;
encrypted: ptr quicly_cid_t; stateless_reset_token: pointer; encrypted: ptr quicly_cid_t; stateless_reset_token: pointer;
plaintext: ptr quicly_cid_plaintext_t) {.cdecl.} plaintext: ptr quicly_cid_plaintext_t) {.cdecl.}

View File

@ -10,11 +10,11 @@ from sendstate import
quicly_sendstate_is_open quicly_sendstate_is_open
type type
quicly_stream_id_t* {.importc, header: "quicly/constants.h", bycopy.} = int64 quicly_stream_id_t* {.bycopy.} = int64
quicly_conn_t* {.importc, header: "quicly/constants.h", incompleteStruct.} = object quicly_conn_t* {.bycopy, incompleteStruct.} = object
quicly_stream_callbacks_t* {.importc, header: "quicly.h", bycopy.} = object quicly_stream_callbacks_t* {.bycopy.} = object
on_destroy*: proc(stream: ptr quicly_stream_t, err: cint) {.cdecl.} on_destroy*: proc(stream: ptr quicly_stream_t, err: cint) {.cdecl.}
on_send_shift*: proc(stream: ptr quicly_stream_t, delta: csize_t) {.cdecl.} on_send_shift*: proc(stream: ptr quicly_stream_t, delta: csize_t) {.cdecl.}
on_send_emit*: proc(stream: ptr quicly_stream_t, off: csize_t, dst: pointer, on_send_emit*: proc(stream: ptr quicly_stream_t, off: csize_t, dst: pointer,
@ -24,7 +24,7 @@ type
len: csize_t) {.cdecl.} len: csize_t) {.cdecl.}
on_receive_reset*: proc(stream: ptr quicly_stream_t, err: cint) {.cdecl.} on_receive_reset*: proc(stream: ptr quicly_stream_t, err: cint) {.cdecl.}
quicly_sender_state_t* {.importc, header: "quicly.h".} = enum quicly_sender_state_t* {.bycopy.} = enum
QUICLY_SENDER_STATE_NONE, QUICLY_SENDER_STATE_NONE,
QUICLY_SENDER_STATE_SEND, QUICLY_SENDER_STATE_SEND,
QUICLY_SENDER_STATE_UNACKED, QUICLY_SENDER_STATE_UNACKED,
@ -50,7 +50,7 @@ type
window*: uint32 window*: uint32
max_ranges*: uint32 max_ranges*: uint32
quicly_stream_t* {.importc, header: "quicly.h", bycopy.} = object quicly_stream_t* {.bycopy.} = object
conn*: ptr quicly_conn_t conn*: ptr quicly_conn_t
stream_id*: quicly_stream_id_t stream_id*: quicly_stream_id_t
callbacks*: ptr quicly_stream_callbacks_t callbacks*: ptr quicly_stream_callbacks_t

View File

@ -1,5 +1,5 @@
from quicly import quicly_context_t from quicly import quicly_context_t
var quicly_spec_context* {.importc, header: "quicly/defaults.h".}: quicly_context_t var quicly_spec_context* {.importc.}: quicly_context_t
var quicly_performant_context* {.importc, header: "quicly/defaults.h".}: quicly_context_t var quicly_performant_context* {.importc.}: quicly_context_t

View File

@ -1,4 +1,4 @@
type type
quicly_linklist_t* {.importc, header: "quicly/linklist.h", bycopy.} = object quicly_linklist_t* {.bycopy.} = object
prev*: ptr quicly_linklist_t prev*: ptr quicly_linklist_t
next*: ptr quicly_linklist_t next*: ptr quicly_linklist_t

View File

@ -1,5 +1,5 @@
type type
quicly_loss_conf_t* {.importc, header: "quicly/loss.h", bycopy.} = object quicly_loss_conf_t* {.bycopy.} = object
time_reordering_percentile*: cuint time_reordering_percentile*: cuint
min_pto*: uint32 min_pto*: uint32
default_initial_rtt*: uint32 default_initial_rtt*: uint32

View File

@ -1,10 +1,10 @@
type type
quicly_maxsender_t* {.importc, header: "quicly/maxsender.h", bycopy.} = object quicly_maxsender_t* {.bycopy.} = object
max_committed*: int64 max_committed*: int64
max_acked*: int64 max_acked*: int64
num_inflight*: csize_t num_inflight*: csize_t
force_send* {.bitsize: 1.}: cuint force_send* {.bitsize: 1.}: cuint
quicly_maxsender_sent_t* {.importc, header: "quicly/maxsender.h", bycopy.} = object quicly_maxsender_sent_t* {.bycopy.} = object
inflight* {.bitsize: 1.}: uint64 inflight* {.bitsize: 1.}: uint64
value* {.bitsize: 63.}: uint64 value* {.bitsize: 63.}: uint64

View File

@ -23,7 +23,7 @@ export
quicly_stream_id_t quicly_stream_id_t
type type
quicly_address_t* {.importc, header: "quicly.h", bycopy.} = object quicly_address_t* {.bycopy.} = object
sa: SockAddr sa: SockAddr
sin: Sockaddr_in sin: Sockaddr_in
sin6: Sockaddr_in6 sin6: Sockaddr_in6
@ -49,7 +49,7 @@ type
QUICLY_ADDRESS_TOKEN_TYPE_RETRY QUICLY_ADDRESS_TOKEN_TYPE_RETRY
QUICLY_ADDRESS_TOKEN_TYPE_RESUMPTION QUICLY_ADDRESS_TOKEN_TYPE_RESUMPTION
quicly_address_token_plaintext_t* {.importc, header: "quicly.h", bycopy.} = object quicly_address_token_plaintext_t* {.bycopy.} = object
`type`: AddressTokenType `type`: AddressTokenType
issued_at*: uint64 issued_at*: uint64
local*: quicly_address_t local*: quicly_address_t
@ -57,41 +57,41 @@ type
type_specific*: RetryOrResumption type_specific*: RetryOrResumption
appdata*: AppData appdata*: AppData
quicly_stream_open_t* {.importc, header: "quicly.h", bycopy.} = object quicly_stream_open_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_stream_open_t, stream: ptr quicly_stream_t): cint cb*: proc(self: ptr quicly_stream_open_t, stream: ptr quicly_stream_t): cint
{.cdecl.} {.cdecl.}
quicly_receive_datagram_frame_t* {.importc, header: "quicly.h", bycopy.} = object quicly_receive_datagram_frame_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_receive_datagram_frame_t, conn: ptr quicly_conn_t, cb*: proc(self: ptr quicly_receive_datagram_frame_t, conn: ptr quicly_conn_t,
payload: ptls_iovec_t) {.cdecl.} payload: ptls_iovec_t) {.cdecl.}
quicly_closed_by_remote_t* {.importc, header: "quicly.h", bycopy.} = object quicly_closed_by_remote_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_closed_by_remote_t, conn: ptr quicly_conn_t, cb*: proc(self: ptr quicly_closed_by_remote_t, conn: ptr quicly_conn_t,
err: cint, frame_type: uint64, reason: cstring, err: cint, frame_type: uint64, reason: cstring,
reason_len: csize_t) {.cdecl.} reason_len: csize_t) {.cdecl.}
quicly_now_t* {.importc, header: "quicly.h", bycopy.} = object quicly_now_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_now_t): int64 {.cdecl.} cb*: proc(self: ptr quicly_now_t): int64 {.cdecl.}
quicly_save_resumption_token_t* {.importc, header: "quicly.h", bycopy.} = object quicly_save_resumption_token_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_save_resumption_token_t, conn: ptr quicly_conn_t, cb*: proc(self: ptr quicly_save_resumption_token_t, conn: ptr quicly_conn_t,
token: ptls_iovec_t): cint {.cdecl.} token: ptls_iovec_t): cint {.cdecl.}
quicly_generate_resumption_token_t* {.importc, header: "quicly.h", bycopy.} = object quicly_generate_resumption_token_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_generate_resumption_token_t, cb*: proc(self: ptr quicly_generate_resumption_token_t,
conn: ptr quicly_conn_t, buf: ptr ptls_buffer_t, conn: ptr quicly_conn_t, buf: ptr ptls_buffer_t,
token: ptr quicly_address_token_plaintext_t): cint {.cdecl.} token: ptr quicly_address_token_plaintext_t): cint {.cdecl.}
quicly_init_cc_t* {.importc, header: "quicly.h", bycopy.} = object quicly_init_cc_t* {.bycopy.} = object
cb*: proc(self: ptr quicly_init_cc_t, cc: ptr quicly_cc_t, initcwnd: uint32, cb*: proc(self: ptr quicly_init_cc_t, cc: ptr quicly_cc_t, initcwnd: uint32,
now: int64) {.cdecl.} now: int64) {.cdecl.}
quicly_max_stream_data_t* {.importc, header: "quicly.h", bycopy.} = object quicly_max_stream_data_t* {.bycopy.} = object
bidi_local*: uint64 bidi_local*: uint64
bidi_remote*: uint64 bidi_remote*: uint64
uni*: uint64 uni*: uint64
quicly_transport_parameters_t* {.importc, header: "quicly.h", bycopy.} = object quicly_transport_parameters_t* {.bycopy.} = object
max_stream_data*: quicly_max_stream_data_t max_stream_data*: quicly_max_stream_data_t
max_data*: uint64 max_data*: uint64
max_idle_timeout*: uint64 max_idle_timeout*: uint64
@ -105,7 +105,7 @@ type
active_connection_id_limit*: uint64 active_connection_id_limit*: uint64
max_datagram_frame_size*: uint16 max_datagram_frame_size*: uint16
quicly_stream_scheduler_t* {.importc, header: "quicly.h", bycopy.} = object quicly_stream_scheduler_t* {.bycopy.} = object
can_send*: proc(sched: ptr quicly_stream_scheduler_t, can_send*: proc(sched: ptr quicly_stream_scheduler_t,
conn: ptr quicly_conn_t, conn_is_saturated: cint): cint conn: ptr quicly_conn_t, conn_is_saturated: cint): cint
{.cdecl.} {.cdecl.}
@ -114,7 +114,7 @@ type
update_state*: proc(sched: ptr quicly_stream_scheduler_t, update_state*: proc(sched: ptr quicly_stream_scheduler_t,
stream: ptr quicly_stream_t): cint {.cdecl.} stream: ptr quicly_stream_t): cint {.cdecl.}
quicly_crypto_engine_t* {.importc, header: "quicly.h", bycopy.} = object quicly_crypto_engine_t* {.bycopy.} = object
setup_cipher*: proc(engine: ptr quicly_crypto_engine_t, setup_cipher*: proc(engine: ptr quicly_crypto_engine_t,
conn: ptr quicly_conn_t, epoch: csize_t, is_enc: cint, conn: ptr quicly_conn_t, epoch: csize_t, is_enc: cint,
header_protect_ctx: ptr ptr ptls_cipher_context_t, header_protect_ctx: ptr ptr ptls_cipher_context_t,
@ -129,7 +129,7 @@ type
datagram: ptls_iovec_t, first_byte_at: csize_t) datagram: ptls_iovec_t, first_byte_at: csize_t)
{.cdecl.} {.cdecl.}
quicly_context_t* {.importc, header: "quicly.h", bycopy.} = object quicly_context_t* {.bycopy.} = object
tls*: ptr ptls_context_t tls*: ptr ptls_context_t
initial_egress_max_udp_payload_size*: uint16 initial_egress_max_udp_payload_size*: uint16
loss*: quicly_loss_conf_t loss*: quicly_loss_conf_t
@ -164,12 +164,12 @@ type
pn: uint64 pn: uint64
key_phase: uint64 key_phase: uint64
IsStatelessReset* = enum IsStatelessReset* {.bycopy.} = enum
QUICLY_DECODED_PACKET_CACHED_MAYBE_STATELESS_RESET = 0, QUICLY_DECODED_PACKET_CACHED_MAYBE_STATELESS_RESET = 0,
QUICLY_DECODED_PACKET_CACHED_IS_STATELESS_RESET, QUICLY_DECODED_PACKET_CACHED_IS_STATELESS_RESET,
QUICLY_DECODED_PACKET_CACHED_NOT_STATELESS_RESET QUICLY_DECODED_PACKET_CACHED_NOT_STATELESS_RESET
quicly_decoded_packet_t* {.importc, header: "quicly.h", bycopy.} = object quicly_decoded_packet_t* {.bycopy.} = object
octets*: ptls_iovec_t octets*: ptls_iovec_t
cid*: Cid cid*: Cid
version*: uint32 version*: uint32
@ -180,28 +180,28 @@ type
is_stateless_reset_cached: IsStatelessReset is_stateless_reset_cached: IsStatelessReset
proc quicly_get_stream*(conn: ptr quicly_conn_t, stream_id: quicly_stream_id_t): proc quicly_get_stream*(conn: ptr quicly_conn_t, stream_id: quicly_stream_id_t):
ptr quicly_stream_t {.cdecl, importc, header: "quicly.h".} ptr quicly_stream_t {.cdecl, importc.}
proc quicly_close*(conn: ptr quicly_conn_t, err: cint, reason_phrase: cstring): proc quicly_close*(conn: ptr quicly_conn_t, err: cint, reason_phrase: cstring):
cint {.cdecl, importc, header: "quicly.h".} cint {.cdecl, importc.}
proc quicly_free*(conn: ptr quicly_conn_t): cint {.cdecl, importc, header: "quicly.h".} proc quicly_free*(conn: ptr quicly_conn_t): cint {.cdecl, importc.}
proc quicly_decode_packet*(ctx: ptr quicly_context_t, proc quicly_decode_packet*(ctx: ptr quicly_context_t,
packet: ptr quicly_decoded_packet_t, packet: ptr quicly_decoded_packet_t,
datagram: ptr uint8, datagram_size: csize_t, datagram: ptr uint8, datagram_size: csize_t,
off: csize_t): csize_t off: csize_t): csize_t
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}
proc quicly_is_destination*(conn: ptr quicly_conn_t, dest_addr: ptr SockAddr, proc quicly_is_destination*(conn: ptr quicly_conn_t, dest_addr: ptr SockAddr,
src_addr: ptr SockAddr, src_addr: ptr SockAddr,
decoded: ptr quicly_decoded_packet_t): cint decoded: ptr quicly_decoded_packet_t): cint
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}
proc quicly_receive*(conn: ptr quicly_conn_t, dest_addr: ptr SockAddr, proc quicly_receive*(conn: ptr quicly_conn_t, dest_addr: ptr SockAddr,
src_addr: ptr SockAddr, src_addr: ptr SockAddr,
packet: ptr quicly_decoded_packet_t): cint packet: ptr quicly_decoded_packet_t): cint
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}
proc quicly_accept*(conn: ptr ptr quicly_conn_t, ctx: ptr quicly_context_t, proc quicly_accept*(conn: ptr ptr quicly_conn_t, ctx: ptr quicly_context_t,
dest_addr: ptr SockAddr, src_addr: ptr SockAddr, dest_addr: ptr SockAddr, src_addr: ptr SockAddr,
@ -209,7 +209,7 @@ proc quicly_accept*(conn: ptr ptr quicly_conn_t, ctx: ptr quicly_context_t,
address_token: ptr quicly_address_token_plaintext_t, address_token: ptr quicly_address_token_plaintext_t,
new_cid: ptr quicly_cid_plaintext_t, new_cid: ptr quicly_cid_plaintext_t,
handshake_properties: ptr ptls_handshake_properties_t): cint handshake_properties: ptr ptls_handshake_properties_t): cint
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}
proc quicly_connect*(conn: ptr ptr quicly_conn_t, server_name: cstring, proc quicly_connect*(conn: ptr ptr quicly_conn_t, server_name: cstring,
dest_addr: ptr SockAddr, src_addr: ptr SockAddr, dest_addr: ptr SockAddr, src_addr: ptr SockAddr,
@ -217,13 +217,13 @@ proc quicly_connect*(conn: ptr ptr quicly_conn_t, server_name: cstring,
address_token: ptr quicly_address_token_plaintext_t, address_token: ptr quicly_address_token_plaintext_t,
handshake_properties: ptr ptls_handshake_properties_t, handshake_properties: ptr ptls_handshake_properties_t,
resumed_transport_params: ptr quicly_transport_parameters_t): resumed_transport_params: ptr quicly_transport_parameters_t):
cint {.cdecl, importc, header: "quicly.h".} cint {.cdecl, importc.}
proc quicly_amend_ptls_context*(ptls: ptr ptls_context_t) proc quicly_amend_ptls_context*(ptls: ptr ptls_context_t)
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}
proc quicly_get_socklen*(sa: ptr SockAddr): SockLen proc quicly_get_socklen*(sa: ptr SockAddr): SockLen
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}
proc quicly_get_fist_timeout*(conn: ptr quicly_conn_t): int64 proc quicly_get_fist_timeout*(conn: ptr quicly_conn_t): int64
{.cdecl, importc, header: "quicly.h".} {.cdecl, importc.}

View File

@ -1,9 +1,9 @@
type type
quicly_range_t* {.importc, header: "quicly/ranges.h", bycopy.} = object quicly_range_t* {.bycopy.} = object
start*: uint64 start*: uint64
`end`*: uint64 `end`*: uint64
quicly_ranges_t* {.importc, header: "quicly/ranges.h", bycopy.} = object quicly_ranges_t* {.bycopy.} = object
ranges*: ptr quicly_range_t ranges*: ptr quicly_range_t
num_ranges*: csize_t num_ranges*: csize_t
capacity*: csize_t capacity*: csize_t

View File

@ -1,10 +1,10 @@
from ranges import quicly_ranges_t from ranges import quicly_ranges_t
type type
quicly_recvstate_t* {.importc, header: "quicly/recvstate.h", bycopy.} = object quicly_recvstate_t* {.bycopy.} = object
received*: quicly_ranges_t received*: quicly_ranges_t
data_off*: uint64 data_off*: uint64
eos*: uint64 eos*: uint64
proc quicly_recvstate_transfer_complete*(state: ptr quicly_recvstate_t): cint proc quicly_recvstate_transfer_complete*(state: ptr quicly_recvstate_t): cint
{.cdecl, importc, header: "quicly/recvstate.h".} {.cdecl, importc.}

View File

@ -1,15 +1,15 @@
from ranges import quicly_ranges_t from ranges import quicly_ranges_t
type type
quicly_sendstate_t* {.importc, header: "quicly/sendstate.h", bycopy.} = object quicly_sendstate_t* {.bycopy.} = object
acked*: quicly_ranges_t acked*: quicly_ranges_t
pending*: quicly_ranges_t pending*: quicly_ranges_t
size_inflight*: uint64 size_inflight*: uint64
final_size*: uint64 final_size*: uint64
quicly_sendstate_sent_t* {.importc, header: "quicly/sendstate.h", bycopy.} = object quicly_sendstate_sent_t* {.bycopy.} = object
start*: uint64 start*: uint64
`end`*: uint64 `end`*: uint64
proc quicly_sendstate_is_open*(state: ptr quicly_sendstate_t): cint proc quicly_sendstate_is_open*(state: ptr quicly_sendstate_t): cint
{.cdecl, importc, header: "quicly/sendstate.h".} {.cdecl, importc.}

View File

@ -2,12 +2,12 @@ from ../picotls/picotls import ptls_buffer_t, ptls_iovec_t
from constants import quicly_stream_t from constants import quicly_stream_t
type type
quicly_streambuf_sendvec_callbacks_t* {.importc, header: "quicly/streambuf.h", bycopy.} = object quicly_streambuf_sendvec_callbacks_t* {.bycopy.} = object
flatten_vec*: proc(vec: ptr quicly_sendbuf_vec_t, dst: pointer, off: csize_t, flatten_vec*: proc(vec: ptr quicly_sendbuf_vec_t, dst: pointer, off: csize_t,
len: csize_t): cint {.cdecl.} len: csize_t): cint {.cdecl.}
discard_vec*: proc(vec: ptr quicly_sendbuf_vec_t) {.cdecl.} discard_vec*: proc(vec: ptr quicly_sendbuf_vec_t) {.cdecl.}
quicly_sendbuf_vec_t* {.importc, header: "quicly/streambuf.h", bycopy.} = object quicly_sendbuf_vec_t* {.bycopy.} = object
cb*: ptr quicly_streambuf_sendvec_callbacks_t cb*: ptr quicly_streambuf_sendvec_callbacks_t
`len`*: csize_t `len`*: csize_t
cbdata*: pointer cbdata*: pointer
@ -17,43 +17,43 @@ type
size*: csize_t size*: csize_t
capacity*: csize_t capacity*: csize_t
quicly_sendbuf_t* {.importc, header: "quicly/streambuf.h", bycopy.} = object quicly_sendbuf_t* {.bycopy.} = object
vecs*: VecList vecs*: VecList
off_in_first_vec*: csize_t off_in_first_vec*: csize_t
bytes_written*: uint64 bytes_written*: uint64
quicly_streambuf_t* {.importc, header: "quicly/streambuf.h", bycopy.} = object quicly_streambuf_t* {.bycopy.} = object
egress*: quicly_sendbuf_t egress*: quicly_sendbuf_t
ingress: ptls_buffer_t ingress: ptls_buffer_t
proc quicly_streambuf_create*(stream: ptr quicly_stream_t, sz: csize_t): cint proc quicly_streambuf_create*(stream: ptr quicly_stream_t, sz: csize_t): cint
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_destroy*(stream: ptr quicly_stream_t, err: cint) proc quicly_streambuf_destroy*(stream: ptr quicly_stream_t, err: cint)
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_egress_shutdown*(stream: ptr quicly_stream_t): cint proc quicly_streambuf_egress_shutdown*(stream: ptr quicly_stream_t): cint
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_egress_write*(stream: ptr quicly_stream_t, src: pointer, proc quicly_streambuf_egress_write*(stream: ptr quicly_stream_t, src: pointer,
len: csize_t): cint len: csize_t): cint
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_egress_emit*(stream: ptr quicly_stream_t, off: csize_t, proc quicly_streambuf_egress_emit*(stream: ptr quicly_stream_t, off: csize_t,
dst: pointer, len: csize_t, wrote_all: cint) dst: pointer, len: csize_t, wrote_all: cint)
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_egress_shift*(stream: ptr quicly_stream_t, delta: csize_t) proc quicly_streambuf_egress_shift*(stream: ptr quicly_stream_t, delta: csize_t)
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_ingress_receive*(stream: ptr quicly_stream_t, proc quicly_streambuf_ingress_receive*(stream: ptr quicly_stream_t,
off: csize_t, src: pointer, off: csize_t, src: pointer,
len: csize_t): cint len: csize_t): cint
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_ingress_get*(stream: ptr quicly_stream_t): ptls_iovec_t proc quicly_streambuf_ingress_get*(stream: ptr quicly_stream_t): ptls_iovec_t
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}
proc quicly_streambuf_ingress_shift*(stream: ptr quicly_stream_t, proc quicly_streambuf_ingress_shift*(stream: ptr quicly_stream_t,
delta: csize_t) delta: csize_t)
{.cdecl, importc, header: "quicly/streambuf.h".} {.cdecl, importc.}