diff options
Diffstat (limited to 'ecp/test/vcs.c')
-rw-r--r-- | ecp/test/vcs.c | 25 |
1 files changed, 16 insertions, 9 deletions
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 <unistd.h> #include <stdio.h> -#include <core.h> -#include <vconn/vconn.h> +#include <ecp/core.h> +#include <ecp/vconn/vconn.h> #include <util.h> +#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 <my addr> <my.priv> [ <node addr> <node.pub> ]\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); } |