From 810dde21ee65653c15606917b19566cfbaaf165e Mon Sep 17 00:00:00 2001 From: Uros Majstorovic Date: Tue, 9 Aug 2022 21:54:45 +0200 Subject: ecp server added --- ecp/test/vc_server.c | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) (limited to 'ecp/test/vc_server.c') diff --git a/ecp/test/vc_server.c b/ecp/test/vc_server.c index de7f275..548b52d 100644 --- a/ecp/test/vc_server.c +++ b/ecp/test/vc_server.c @@ -3,16 +3,20 @@ #include #include -#include -#include +#include +#include #include +#include "init_vconn.h" + ECPContext ctx; ECPSocket sock; ECPConnHandler handler; +ECPConnHandler vconn_handler; +ECPConnHandler vlink_handler; ECPConnection conn; -ECPConnection vconn[3]; +ECPVConnOutb vconn[3]; #define CTYPE_TEST 0 #define MTYPE_MSG 0 @@ -46,11 +50,11 @@ int main(int argc, char *argv[]) { if ((argc < 4) || (argc > 7)) usage(argv[0]); - rv = ecp_init(&ctx); + 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_ctx_set_handler(&ctx, &handler, CTYPE_TEST); + ecp_ctx_set_handler(&ctx, CTYPE_TEST, &handler); rv = ecp_util_load_key(&key_perma.public, &key_perma.private, argv[1]); printf("ecp_util_load_key RV:%d\n", rv); @@ -65,29 +69,29 @@ int main(int argc, char *argv[]) { rv = ecp_start_receiver(&sock); printf("ecp_start_receiver RV:%d\n", rv); - rv = ecp_vlink_create(&conn, &sock); - printf("ecp_vlink_create RV:%d\n", rv); + rv = ecp_util_load_pub(&node_pub, argv[argc-1]); + printf("ecp_util_load_pub RV:%d\n", rv); + ecp_node_init(&node, &node_pub, NULL); + rv = ecp_node_set_addr(&node, argv[2]); + printf("ecp_node_set_addr RV:%d\n", rv); + + ecp_vlink_init(&conn, &sock); if (argc > 4) { - ecp_ecdh_public_t vconn_key[3]; + ecp_ecdh_public_t vconn_pub[3]; for (i=3; i