diff options
| author | Uros Majstorovic <majstor@majstor.org> | 2017-05-23 04:12:25 +0200 | 
|---|---|---|
| committer | Uros Majstorovic <majstor@majstor.org> | 2017-05-23 04:12:25 +0200 | 
| commit | 922e8313f2b3f6157a61b3c867fdc3832bb92a68 (patch) | |
| tree | e139071e3d012eb70627e83e314e1f02eab5e1db /code | |
| parent | db066407cbcc5905c21314000acbe34e5d6968ef (diff) | |
implemented exec
Diffstat (limited to 'code')
| -rw-r--r-- | code/TODO | 3 | ||||
| -rw-r--r-- | code/core.c | 5 | ||||
| -rw-r--r-- | code/core.h | 1 | ||||
| -rw-r--r-- | code/proxy.c | 2 | 
4 files changed, 8 insertions, 3 deletions
@@ -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;  | 
