summaryrefslogtreecommitdiff
path: root/code/test/vid/server.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2018-01-19 19:08:32 +0100
committerUros Majstorovic <majstor@majstor.org>2018-01-19 19:08:32 +0100
commit544f43a7e06c9b0c63df8d3994318ea72107f64e (patch)
tree5e99fc1693ca1c538eb4d0a5743d100ace60eab1 /code/test/vid/server.c
parent21d54fc77a32d76665223ae26c4262363a9222a6 (diff)
pine64 vid test update
Diffstat (limited to 'code/test/vid/server.c')
-rw-r--r--code/test/vid/server.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/code/test/vid/server.c b/code/test/vid/server.c
index 2712dee..8753a7d 100644
--- a/code/test/vid/server.c
+++ b/code/test/vid/server.c
@@ -11,12 +11,15 @@ static ECPSocket sock_s;
static ECPDHKey key_perma_s;
static ECPConnHandler handler_s;
-static ECPConnection *conn;
+static ECPConnection *conn_in;
static int is_open = 0;
#define CTYPE_TEST 0
#define MTYPE_MSG 8
+ECPNode node;
+ECPConnection conn;
+
static ssize_t handle_open(ECPConnection *c, ecp_seq_t sq, unsigned char t, unsigned char *m, ssize_t sz, ECP2Buffer *b) {
ssize_t rv = ecp_conn_handle_open(c, sq, t, m, sz, b);
if (rv < 0) return rv;
@@ -29,14 +32,14 @@ static ssize_t handle_open(ECPConnection *c, ecp_seq_t sq, unsigned char t, unsi
}
ssize_t send_frame(unsigned char *buffer, size_t size, ecp_pts_t pts) {
- return ecp_send(conn, MTYPE_MSG, buffer, size);
+ return ecp_send(conn_in, MTYPE_MSG, buffer, size);
}
int conn_is_open(void) {
return is_open;
}
-int init_server(char *address, char *key) {
+int init_server(char *address, char *my_key, char *vcs_key) {
int rv;
rv = ecp_init(&ctx_s);
@@ -59,6 +62,16 @@ int init_server(char *address, char *key) {
if (!rv) rv = ecp_start_receiver(&sock_s);
fprintf(stderr, "ecp_start_receiver RV:%d\n", rv);
+
+ if (!rv) rv = ecp_util_node_load(&ctx, &node, vcs_key);
+ printf("ecp_util_node_load RV:%d\n", rv);
+
+ if (!rv) rv = ecp_conn_create(&conn, &sock, ECP_CTYPE_VLINK);
+ printf("ecp_conn_create RV:%d\n", rv);
+
+ if (!rv) rv = ecp_conn_open(&conn, &node);
+ printf("ecp_conn_open RV:%d\n", rv);
+
return rv;
}