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/vcs.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'ecp/test/vcs.c') diff --git a/ecp/test/vcs.c b/ecp/test/vcs.c index c4beed7..92d1eb2 100644 --- a/ecp/test/vcs.c +++ b/ecp/test/vcs.c @@ -3,14 +3,18 @@ #include #include -#include -#include +#include +#include #include +#include "init_vconn.h" + ECPContext ctx; ECPSocket sock; ECPConnection conn; +ECPConnHandler vconn_handler; +ECPConnHandler vlink_handler; static void usage(char *arg) { fprintf(stderr, "Usage: %s [ ]\n", arg); @@ -18,12 +22,13 @@ static void usage(char *arg) { } int main(int argc, char *argv[]) { + ecp_tr_addr_t addr; ECPDHKey key_perma; int rv; if ((argc < 3) || (argc > 5)) usage(argv[0]); - rv = ecp_init(&ctx); + rv = ecp_init(&ctx, &vconn_handler, &vlink_handler); printf("ecp_init RV:%d\n", rv); rv = ecp_util_load_key(&key_perma.public, &key_perma.private, argv[2]); @@ -33,7 +38,10 @@ int main(int argc, char *argv[]) { rv = ecp_sock_create(&sock, &ctx, &key_perma); printf("ecp_sock_create RV:%d\n", rv); - rv = ecp_sock_open(&sock, argv[1]); + rv = ecp_addr_init(&addr, argv[1]); + printf("ecp_addr_init RV:%d\n", rv); + + rv = ecp_sock_open(&sock, &addr); printf("ecp_sock_open RV:%d\n", rv); rv = ecp_start_receiver(&sock); @@ -43,15 +51,14 @@ int main(int argc, char *argv[]) { ECPNode node; ecp_ecdh_public_t node_pub; - rv = ecp_vlink_create(&conn, &sock); - printf("ecp_vlink_create RV:%d\n", rv); - rv = ecp_util_load_pub(&node_pub, argv[4]); printf("ecp_util_load_pub RV:%d\n", rv); - rv = ecp_node_init(&node, &node_pub, argv[3]); - printf("ecp_node_init RV:%d\n", rv); + ecp_node_init(&node, &node_pub, NULL); + rv = ecp_node_set_addr(&node, argv[3]); + printf("ecp_node_set_addr RV:%d\n", rv); + ecp_vlink_init(&conn, &sock); rv = ecp_conn_open(&conn, &node); printf("ecp_conn_open RV:%d\n", rv); } -- cgit v1.2.3