diff options
author | Uros Majstorovic <majstor@majstor.org> | 2017-05-23 17:28:12 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2017-05-23 17:28:12 +0200 |
commit | ab0325ae7906230f1ea82f08b27c72b075e9a13d (patch) | |
tree | 5a292826fdea4db2c86b2d82b80fa489c6c131c7 /code/proxy | |
parent | 3ef6719f47b734b12c0b11c725b7f12e3fb3c08a (diff) |
build fixed; added lib util
Diffstat (limited to 'code/proxy')
-rw-r--r-- | code/proxy/Makefile | 13 | ||||
-rw-r--r-- | code/proxy/proxy.c | 21 | ||||
-rw-r--r-- | code/proxy/proxy.h | 4 |
3 files changed, 35 insertions, 3 deletions
diff --git a/code/proxy/Makefile b/code/proxy/Makefile new file mode 100644 index 0000000..9a8490c --- /dev/null +++ b/code/proxy/Makefile @@ -0,0 +1,13 @@ +CFLAGS = -I../core -pthread -O3 $(PIC) + +obj = proxy.o + + +%.o: %.c %.h + $(CC) $(CFLAGS) -c $< + +all: $(obj) + $(AR) rcs libecpproxy.a $(obj) + +clean: + rm -f *.o *.a
\ No newline at end of file diff --git a/code/proxy/proxy.c b/code/proxy/proxy.c index ae66318..3d6ffec 100644 --- a/code/proxy/proxy.c +++ b/code/proxy/proxy.c @@ -1,4 +1,4 @@ -#include "core.h" +#include <core.h> #include "proxy.h" #ifdef ECP_WITH_PTHREAD @@ -409,7 +409,8 @@ int ecp_proxy_init(ECPContext *ctx) { return ECP_OK; } -int ecp_conn_proxy_init(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *proxy[], ECPNode *proxy_node[], int size, ECPSocket *sock) { +int ecp_conn_proxy_init(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *proxy[], ECPNode *proxy_node[], int size) { + ECPSocket *sock = conn->sock; int i, rv; rv = ecp_conn_init(conn, conn_node); @@ -438,3 +439,19 @@ int ecp_conn_proxy_init(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *p return ECP_OK; } +static ssize_t _proxy_send_kget(ECPConnection *conn, ECPTimerItem *ti) { + unsigned char payload[ECP_SIZE_PLD(0)]; + + ecp_pld_set_type(payload, ECP_MTYPE_KGET); + return ecp_pld_send_wkey(conn, ECP_ECDH_IDX_PERMA, ECP_ECDH_IDX_INV, payload, sizeof(payload)); +} + +int ecp_conn_proxy_open(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *proxy[], ECPNode *proxy_node[], int size) { + int rv = ecp_conn_proxy_init(conn, conn_node, proxy, proxy_node, size); + if (rv) return rv; + + ssize_t _rv = ecp_timer_send((ECPConnection *)proxy[0], _proxy_send_kget, ECP_MTYPE_KGET, 3, 500); + if (_rv < 0) return _rv; + + return ECP_OK; +}
\ No newline at end of file diff --git a/code/proxy/proxy.h b/code/proxy/proxy.h index c6d5422..f3bc58a 100644 --- a/code/proxy/proxy.h +++ b/code/proxy/proxy.h @@ -16,4 +16,6 @@ typedef struct ECPConnProxyF { } ECPConnProxyF; int ecp_proxy_init(ECPContext *ctx); -int ecp_conn_proxy_init(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *proxy[], ECPNode *proxy_node[], int size, ECPSocket *sock); + +int ecp_conn_proxy_init(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *proxy[], ECPNode *proxy_node[], int size); +int ecp_conn_proxy_open(ECPConnection *conn, ECPNode *conn_node, ECPConnProxy *proxy[], ECPNode *proxy_node[], int size); |