diff options
Diffstat (limited to 'ecp/test/vc_client.c')
-rw-r--r-- | ecp/test/vc_client.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/ecp/test/vc_client.c b/ecp/test/vc_client.c index 89602ca..41c364d 100644 --- a/ecp/test/vc_client.c +++ b/ecp/test/vc_client.c @@ -3,16 +3,20 @@ #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; ECPConnHandler handler; +ECPConnHandler vconn_handler; +ECPConnHandler vlink_handler; ECPConnection conn; -ECPConnection vconn[3]; +ECPVConnOutb vconn[3]; #define CTYPE_TEST 0 #define MTYPE_MSG 0 @@ -47,11 +51,11 @@ int main(int argc, char *argv[]) { if ((argc < 4) || (argc > 6)) 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_dhkey_gen(&key_perma); printf("ecp_dhkey_gen RV:%d\n", rv); @@ -65,24 +69,21 @@ int main(int argc, char *argv[]) { rv = ecp_start_receiver(&sock); printf("ecp_start_receiver RV:%d\n", rv); + rv = ecp_util_load_pub(&node_pub, argv[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); + for (i=3; i<argc; i++) { rv = ecp_util_load_pub(&vconn_pub[i-3], argv[i]); printf("ecp_util_load_pub RV:%d\n", rv); } - rv = ecp_conn_create(&conn, &sock, CTYPE_TEST); - printf("ecp_conn_create RV:%d\n", rv); - - rv = ecp_vconn_create(vconn, vconn_pub, argc-3, &conn); - printf("ecp_vconn_create RV:%d\n", rv); - - rv = ecp_util_load_pub(&node_pub, argv[1]); - printf("ecp_util_load_pub RV:%d\n", rv); - - rv = ecp_node_init(&node, &node_pub, argv[2]); - printf("ecp_node_init RV:%d\n", rv); - - rv = ecp_vconn_open(&conn, &node); + ecp_conn_init(&conn, &sock, CTYPE_TEST); + ecp_vconn_init(vconn, vconn_pub, argc-3, &sock); + rv = ecp_vconn_open(vconn, &conn, &node); printf("ecp_vconn_open RV:%d\n", rv); while (1) sleep(1); |