summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--code/TODO3
-rw-r--r--code/core.c5
-rw-r--r--code/core.h1
-rw-r--r--code/proxy.c2
4 files changed, 8 insertions, 3 deletions
diff --git a/code/TODO b/code/TODO
index 1795089..ade028d 100644
--- a/code/TODO
+++ b/code/TODO
@@ -4,8 +4,5 @@
- memzero keys after usage
- implement socket message queue
-proxy:
-- implement init
core:
- msgq marker
-- implement exec
diff --git a/code/core.c b/code/core.c
index 821487e..ed083a0 100644
--- a/code/core.c
+++ b/code/core.c
@@ -739,6 +739,11 @@ ssize_t ecp_conn_handle_kput(ECPConnection *conn, unsigned char mtype, unsigned
return ECP_ERR;
}
+ssize_t ecp_conn_handle_exec(ECPConnection *conn, unsigned char mtype, unsigned char *msg, ssize_t size) {
+ if (size < 0) return size;
+ return ecp_pkt_handle(conn->sock, NULL, conn, msg, size);
+}
+
static ssize_t _conn_send_kput(ECPConnection *conn, ECPTimerItem *ti) {
unsigned char payload[ECP_SIZE_PLD(ECP_ECDH_SIZE_KEY+1)];
unsigned char *buf = ecp_pld_get_buf(payload);
diff --git a/code/core.h b/code/core.h
index 929461f..33dd6d2 100644
--- a/code/core.h
+++ b/code/core.h
@@ -290,6 +290,7 @@ int ecp_conn_handle_new(ECPSocket *sock, ECPConnection **_conn, ECPConnection *p
ssize_t ecp_conn_handle_open(ECPConnection *conn, unsigned char mtype, unsigned char *msg, ssize_t size);
ssize_t ecp_conn_handle_kget(ECPConnection *conn, unsigned char mtype, unsigned char *msg, ssize_t size);
ssize_t ecp_conn_handle_kput(ECPConnection *conn, unsigned char mtype, unsigned char *msg, ssize_t size);
+ssize_t ecp_conn_handle_exec(ECPConnection *conn, unsigned char mtype, unsigned char *msg, ssize_t size);
int ecp_conn_dhkey_new(ECPConnection *conn);
int ecp_conn_dhkey_new_pub(ECPConnection *conn, unsigned char idx, unsigned char *public);
diff --git a/code/proxy.c b/code/proxy.c
index a55d53e..ae66318 100644
--- a/code/proxy.c
+++ b/code/proxy.c
@@ -378,6 +378,7 @@ int ecp_proxy_init(ECPContext *ctx) {
handler_f.conn_destroy = proxyf_destroy;
handler_f.conn_open = proxyf_open;
handler_f.msg[ECP_MTYPE_OPEN] = proxyf_handle_open;
+ handler_f.msg[ECP_MTYPE_EXEC] = ecp_conn_handle_exec;
handler_f.msg[ECP_MTYPE_RELAY] = proxyf_handle_relay;
ctx->handler[ECP_CTYPE_PROXYF] = &handler_f;
@@ -387,6 +388,7 @@ int ecp_proxy_init(ECPContext *ctx) {
handler_b.conn_destroy = proxyb_destroy;
handler_b.conn_open = proxyb_open;
handler_b.msg[ECP_MTYPE_OPEN] = proxyb_handle_open;
+ handler_b.msg[ECP_MTYPE_EXEC] = ecp_conn_handle_exec;
handler_b.msg[ECP_MTYPE_RELAY] = proxyb_handle_relay;
ctx->handler[ECP_CTYPE_PROXYB] = &handler_b;