From 7a0e44998f426752c58975ae686d8e88aa131195 Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Sat, 11 May 2024 15:58:48 +0200 Subject: added error handler per connection type; improved handlers API and error reporting --- ecp/test/basic.c | 4 ++-- ecp/test/client.c | 2 +- ecp/test/init.c | 2 +- ecp/test/init_vconn.c | 2 +- ecp/test/server.c | 2 +- ecp/test/vc_client.c | 2 +- ecp/test/vc_inb.c | 4 ++-- ecp/test/vc_outb.c | 4 ++-- ecp/test/vc_server.c | 2 +- 9 files changed, 12 insertions(+), 12 deletions(-) (limited to 'ecp/test') diff --git a/ecp/test/basic.c b/ecp/test/basic.c index 637a829..2e6bfd0 100644 --- a/ecp/test/basic.c +++ b/ecp/test/basic.c @@ -55,7 +55,7 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx_s); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&handler_s, handle_msg_s, NULL, NULL, NULL); + ecp_conn_handler_init(&handler_s, NULL, NULL, handle_msg_s, NULL); ecp_ctx_set_handler(&ctx_s, CTYPE_TEST, &handler_s); rv = ecp_dhkey_gen(&key_perma_s); @@ -77,7 +77,7 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx_c); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&handler_c, handle_msg_c, handle_open_c, NULL, NULL); + ecp_conn_handler_init(&handler_c, handle_open_c, NULL, handle_msg_c, NULL); ecp_ctx_set_handler(&ctx_c, CTYPE_TEST, &handler_c); rv = ecp_dhkey_gen(&key_perma_c); diff --git a/ecp/test/client.c b/ecp/test/client.c index af905d5..0236f97 100644 --- a/ecp/test/client.c +++ b/ecp/test/client.c @@ -49,7 +49,7 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&handler, handle_msg, handle_open, NULL, NULL); + ecp_conn_handler_init(&handler, handle_open, NULL, handle_msg, NULL); ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_dhkey_gen(&key_perma); diff --git a/ecp/test/init.c b/ecp/test/init.c index 79c1098..fbf17c6 100644 --- a/ecp/test/init.c +++ b/ecp/test/init.c @@ -26,6 +26,6 @@ static void conn_free(ECPConnection *conn) { int ecp_init(ECPContext *ctx) { int rv; - rv = ecp_ctx_init(ctx, handle_err, conn_new, conn_free, NULL); + rv = ecp_ctx_init(ctx, NULL, conn_new, conn_free, handle_err); return rv; } diff --git a/ecp/test/init_vconn.c b/ecp/test/init_vconn.c index 3393a16..ba72c01 100644 --- a/ecp/test/init_vconn.c +++ b/ecp/test/init_vconn.c @@ -51,7 +51,7 @@ static void conn_free(ECPConnection *conn) { int ecp_init(ECPContext *ctx, ECPConnHandler *vconn_handler, ECPConnHandler *vlink_handler) { int rv; - rv = ecp_ctx_init(ctx, handle_err, conn_new, conn_free, NULL); + rv = ecp_ctx_init(ctx, NULL, conn_new, conn_free, handle_err); if (rv) return rv; rv = ecp_vconn_handler_init(ctx, vconn_handler); diff --git a/ecp/test/server.c b/ecp/test/server.c index 003e3b3..0af41c6 100644 --- a/ecp/test/server.c +++ b/ecp/test/server.c @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&handler, handle_msg, NULL, NULL, NULL); + ecp_conn_handler_init(&handler, NULL, NULL, handle_msg, NULL); ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_util_load_key(argv[2], &key_perma.public, &key_perma.private); diff --git a/ecp/test/vc_client.c b/ecp/test/vc_client.c index af4a3cd..d157081 100644 --- a/ecp/test/vc_client.c +++ b/ecp/test/vc_client.c @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx, &vconn_handler, &vlink_handler); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&handler, handle_msg, handle_open, NULL, NULL); + ecp_conn_handler_init(&handler, handle_open, NULL, handle_msg, NULL); ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_dhkey_gen(&key_perma); diff --git a/ecp/test/vc_inb.c b/ecp/test/vc_inb.c index 825d948..0c75c5d 100644 --- a/ecp/test/vc_inb.c +++ b/ecp/test/vc_inb.c @@ -87,10 +87,10 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx, &vconn_handler, &vlink_handler); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&dir_handler, handle_dir_msg, ecp_dir_handle_open, NULL, NULL); + ecp_conn_handler_init(&dir_handler, ecp_dir_handle_open, NULL, handle_dir_msg, NULL); ecp_ctx_set_handler(&ctx, ECP_CTYPE_DIR, &dir_handler); - ecp_conn_handler_init(&handler, handle_msg, handle_open, NULL, NULL); + ecp_conn_handler_init(&handler, handle_open, NULL, handle_msg, NULL); ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_util_load_key(argv[1], &key_perma.public, &key_perma.private); diff --git a/ecp/test/vc_outb.c b/ecp/test/vc_outb.c index cc772d5..4b14244 100644 --- a/ecp/test/vc_outb.c +++ b/ecp/test/vc_outb.c @@ -89,10 +89,10 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx, &vconn_handler, &vlink_handler); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&dir_handler, handle_dir_msg, ecp_dir_handle_open, NULL, NULL); + ecp_conn_handler_init(&dir_handler, ecp_dir_handle_open, NULL, handle_dir_msg, NULL); ecp_ctx_set_handler(&ctx, ECP_CTYPE_DIR, &dir_handler); - ecp_conn_handler_init(&handler, handle_msg, handle_open, NULL, NULL); + ecp_conn_handler_init(&handler, handle_open, NULL, handle_msg, NULL); ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_dhkey_gen(&key_perma); diff --git a/ecp/test/vc_server.c b/ecp/test/vc_server.c index daf35f8..b664a1c 100644 --- a/ecp/test/vc_server.c +++ b/ecp/test/vc_server.c @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) { rv = ecp_init(&ctx, &vconn_handler, &vlink_handler); printf("ecp_init RV:%d\n", rv); - ecp_conn_handler_init(&handler, handle_msg, handle_open, NULL, NULL); + ecp_conn_handler_init(&handler, handle_open, NULL, handle_msg, NULL); ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_util_load_key(argv[1], &key_perma.public, &key_perma.private); -- cgit v1.2.3