summaryrefslogtreecommitdiff
path: root/ecp/test/dir.c
diff options
context:
space:
mode:
authorUros Majstorovic <majstor@majstor.org>2021-09-01 03:47:19 +0200
committerUros Majstorovic <majstor@majstor.org>2021-09-01 03:47:19 +0200
commitb98a39ddae6a9cd002465bd46c19a1cb9285174b (patch)
tree1d18ab7cd34b2f07b4fbb313f845111d4d09b847 /ecp/test/dir.c
parent2a33ef2344145e12f1eea96214cdb317857321c1 (diff)
updated directory service
Diffstat (limited to 'ecp/test/dir.c')
-rw-r--r--ecp/test/dir.c22
1 files changed, 7 insertions, 15 deletions
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[]) {