From d1e6e4486c14e56da665c5690844ef5f2e893f0a Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 28 Apr 2017 15:42:17 +0200 Subject: incorporate a more verbose ascii dump, provided by Tom --- ot_fullscrape.c | 4 ++++ ot_http.c | 2 +- ot_mutex.h | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/ot_fullscrape.c b/ot_fullscrape.c index 89db2f1..faea4b9 100644 --- a/ot_fullscrape.c +++ b/ot_fullscrape.c @@ -175,6 +175,10 @@ static void fullscrape_make( int *iovec_entries, struct iovec **iovector, ot_tas to_hex( r, *hash ); r+= 2 * sizeof(ot_hash); r += sprintf( r, ":%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count ); break; + case TASK_FULLSCRAPE_TPB_ASCII_PLUS: + to_hex( r, *hash ); r+= 2 * sizeof(ot_hash); + r += sprintf( r, ":%zd:%zd:%zd\n", peer_list->seed_count, peer_list->peer_count-peer_list->seed_count, peer_list->down_count ); + break; case TASK_FULLSCRAPE_TPB_BINARY: memcpy( r, *hash, sizeof(ot_hash) ); r += sizeof(ot_hash); *(uint32_t*)(r+0) = htonl( (uint32_t) peer_list->seed_count ); diff --git a/ot_http.c b/ot_http.c index 832f21d..0e3cc29 100644 --- a/ot_http.c +++ b/ot_http.c @@ -184,7 +184,7 @@ static const ot_keywords keywords_mode[] = { NULL, -3 } }; static const ot_keywords keywords_format[] = { { "bin", TASK_FULLSCRAPE_TPB_BINARY }, { "ben", TASK_FULLSCRAPE }, { "url", TASK_FULLSCRAPE_TPB_URLENCODED }, - { "txt", TASK_FULLSCRAPE_TPB_ASCII }, { NULL, -3 } }; + { "txt", TASK_FULLSCRAPE_TPB_ASCII }, { "txtp", TASK_FULLSCRAPE_TPB_ASCII_PLUS }, { NULL, -3 } }; int mode = TASK_STATS_PEERS, scanon = 1, format = 0; diff --git a/ot_mutex.h b/ot_mutex.h index 1079074..bd07009 100644 --- a/ot_mutex.h +++ b/ot_mutex.h @@ -47,8 +47,9 @@ typedef enum { TASK_FULLSCRAPE = 0x0200, /* Default mode */ TASK_FULLSCRAPE_TPB_BINARY = 0x0201, TASK_FULLSCRAPE_TPB_ASCII = 0x0202, - TASK_FULLSCRAPE_TPB_URLENCODED = 0x0203, - TASK_FULLSCRAPE_TRACKERSTATE = 0x0204, + TASK_FULLSCRAPE_TPB_ASCII_PLUS = 0x0203, + TASK_FULLSCRAPE_TPB_URLENCODED = 0x0204, + TASK_FULLSCRAPE_TRACKERSTATE = 0x0205, TASK_DMEM = 0x0300, -- cgit v1.2.3