make cb fields visible; add some constants

This commit is contained in:
Christian Ulrich 2020-11-08 19:09:45 +01:00
parent 490664b1f5
commit c6a0127244
No known key found for this signature in database
GPG Key ID: 8241BE099775A097
1 changed files with 35 additions and 33 deletions

View File

@ -1,4 +1,6 @@
const PTLS_MAX_DIGEST_SIZE = 64
const PTLS_MAX_DIGEST_SIZE* = 64
const PTLS_ALERT_BAD_CERTIFICATE* = 42
const PTLS_ALERT_UNKNOWN_CA* = 48
type
List*[T] = object
@ -116,63 +118,63 @@ type
is_allocated*: cint
ptls_get_time_t* {.importc, header: "picotls.h", 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
cb: proc(self: ptr ptls_on_client_hello_t, tls: ptr ptls_t,
params: ptr ptls_on_client_hello_parameters_t): cint {.cdecl.}
cb*: proc(self: ptr ptls_on_client_hello_t, tls: ptr ptls_t,
params: ptr ptls_on_client_hello_parameters_t): cint {.cdecl.}
ptls_emit_certificate_t* {.importc, header: "picotls.h", bycopy.} = object
cb: proc(self: ptr ptls_emit_certificate_t, tls: ptr ptls_t,
emitter: ptr ptls_message_emitter_t,
key_sched: ptr ptls_key_schedule_t, context: ptls_iovec_t,
push_status_request: cint, compress_algos: uint16,
num_compress_algos: csize_t): cint {.cdecl.}
cb*: proc(self: ptr ptls_emit_certificate_t, tls: ptr ptls_t,
emitter: ptr ptls_message_emitter_t,
key_sched: ptr ptls_key_schedule_t, context: ptls_iovec_t,
push_status_request: cint, compress_algos: uint16,
num_compress_algos: csize_t): cint {.cdecl.}
ptls_sign_certificate_t* {.importc, header: "picotls.h", bycopy.} = object
cb: proc(self: ptr ptls_sign_certificate_t, tls: ptr ptls_t,
selected_algorithm: uint16, output: ptr ptls_buffer_t,
input: ptls_iovec_t, algorithms: uint16,
num_algorithms: csize_t): cint {.cdecl.}
cb*: proc(self: ptr ptls_sign_certificate_t, tls: ptr ptls_t,
selected_algorithm: uint16, output: ptr ptls_buffer_t,
input: ptls_iovec_t, algorithms: uint16,
num_algorithms: csize_t): cint {.cdecl.}
ptls_verify_certificate_t* {.importc, header: "picotls.h", bycopy.} = object
cb: proc(self: ptr ptls_verify_certificate_t, tls: ptr ptls_t,
verify_sign: ptr VerifySignCb, verify_data: ptr pointer,
certs: ptls_iovec_t, numCerts: csize_t): cint {.cdecl.}
cb*: proc(self: ptr ptls_verify_certificate_t, tls: ptr ptls_t,
verify_sign: ptr VerifySignCb, verify_data: ptr pointer,
certs: ptr ptls_iovec_t, numCerts: csize_t): cint {.cdecl.}
ptls_encrypt_ticket_t* {.importc, header: "picotls.h", bycopy.} = object
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.}
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.}
ptls_save_ticket_t* {.importc, header: "picotls.h", bycopy.} = object
cb: proc(self: ptr ptls_save_ticket_t, tls: ptr ptls_t, input: ptls_iovec_t):
cint {.cdecl.}
cb*: proc(self: ptr ptls_save_ticket_t, tls: ptr ptls_t,
input: ptls_iovec_t): cint {.cdecl.}
ptls_log_event_t* {.importc, header: "picotls.h", bycopy.} = object
cb: proc(self: ptr ptls_log_event_t, tls: ptr ptls_t, `type`: cstring,
fmt: cstring) {.cdecl, varargs.}
cb*: proc(self: ptr ptls_log_event_t, tls: ptr ptls_t, `type`: cstring,
fmt: cstring) {.cdecl, varargs.}
ptls_update_open_count_t* {.importc, header: "picotls.h", 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
cb: proc(self: ptr ptls_update_traffic_key_t, tls: ptr ptls_t, is_enc: cint,
epoch: csize_t, secret: pointer): cint {.cdecl.}
cb*: proc(self: ptr ptls_update_traffic_key_t, tls: ptr ptls_t, is_enc: cint,
epoch: csize_t, secret: pointer): cint {.cdecl.}
ptls_decompress_certificate_t* {.importc, header: "picotls.h", bycopy.} = object
supported_algorithms*: uint16
cb: proc(self: ptr ptls_decompress_certificate_t, tls: ptr ptls_t,
algorithm: uint16, output: ptls_iovec_t, input: ptls_iovec_t): cint
{.cdecl.}
cb*: proc(self: ptr ptls_decompress_certificate_t, tls: ptr ptls_t,
algorithm: uint16, output: ptls_iovec_t, input: ptls_iovec_t): cint
{.cdecl.}
ptls_update_esni_key_t* {.importc, header: "picotls.h", bycopy.} = object
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
{.cdecl.}
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
{.cdecl.}
ptls_on_extension_t* {.importc, header: "picotls.h", bycopy.} = object
cb: proc(self: ptr ptls_on_extension_t, tls: ptr ptls_t, hstype: uint8,
exttype: uint16, extdata: ptls_iovec_t): cint {.cdecl.}
cb*: proc(self: ptr ptls_on_extension_t, tls: ptr ptls_t, hstype: uint8,
exttype: uint16, extdata: ptls_iovec_t): cint {.cdecl.}
ptls_context_t* {.importc, header: "picotls.h", bycopy.} = object
random_bytes*: proc (buf: pointer, len: csize_t) {.cdecl.}