diff options
author | Uros Majstorovic <majstor@majstor.org> | 2021-09-01 03:47:19 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2021-09-01 03:47:19 +0200 |
commit | b98a39ddae6a9cd002465bd46c19a1cb9285174b (patch) | |
tree | 1d18ab7cd34b2f07b4fbb313f845111d4d09b847 /ecp/test | |
parent | 2a33ef2344145e12f1eea96214cdb317857321c1 (diff) |
updated directory service
Diffstat (limited to 'ecp/test')
-rw-r--r-- | ecp/test/Makefile | 2 | ||||
-rw-r--r-- | ecp/test/dir.c | 22 |
2 files changed, 8 insertions, 16 deletions
diff --git a/ecp/test/Makefile b/ecp/test/Makefile index 84fdbe1..8bb17a3 100644 --- a/ecp/test/Makefile +++ b/ecp/test/Makefile @@ -51,4 +51,4 @@ voip: voip.o init.o $(dep) clean: rm -f *.o - rm -f basic client server echo frag stress vcs vc_server vc_client vc_client_t voip + rm -f basic dir client server echo frag stress vcs vc_server vc_client vc_client_t voip diff --git a/ecp/test/dir.c b/ecp/test/dir.c index a4e94a3..413cd03 100644 --- a/ecp/test/dir.c +++ b/ecp/test/dir.c @@ -24,24 +24,16 @@ static ECPDirList dir_shadow; #define CTYPE_TEST 0 ssize_t handle_dir(ECPConnection *conn, ecp_seq_t seq, unsigned char mtype, unsigned char *msg, ssize_t size, ECP2Buffer *b) { - ECPDirItem item; - size_t _size; + ECPDirList dir; + ssize_t rv; - _size = size; - if (mtype == ECP_MTYPE_DIR_REP) { - int rv; + dir.count = 0; + rv = ecp_dir_parse(&dir, msg, size); + if (rv < 0) return rv; - while (_size >= ECP_SIZE_DIR_ITEM) { - ecp_dir_parse_item(msg, &item); + printf("DIR: %s %ld\n", (char *)ecp_cr_dh_pub_get_buf(&dir.item[0].node.public), size); - printf("DIR: %s\n", (char *)ecp_cr_dh_pub_get_buf(&item.node.public)); - - msg += ECP_SIZE_DIR_ITEM; - _size -= ECP_SIZE_DIR_ITEM; - }; - } - - return size - _size; + return rv; } int main(int argc, char *argv[]) { |