diff options
author | Martin Schanzenbach <schanzen@gnunet.org> | 2023-06-29 09:31:06 +0200 |
---|---|---|
committer | Martin Schanzenbach <schanzen@gnunet.org> | 2023-06-29 09:31:06 +0200 |
commit | ce6160020ff0d24012ccd288653197e45936a287 (patch) | |
tree | e7e46ebdac2bb5188df93f6ab4e711ca76395500 /src/gnsrecord | |
parent | afee6f6d552c2293d31dc0d6beba15f0c89e0d72 (diff) | |
download | gnunet-ce6160020ff0d24012ccd288653197e45936a287.tar.gz gnunet-ce6160020ff0d24012ccd288653197e45936a287.zip |
GNS: Test vector output nicer
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/gnunet-gnsrecord-tvg.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c index 4822141f9..16c917b24 100644 --- a/src/gnsrecord/gnunet-gnsrecord-tvg.c +++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c | |||
@@ -71,8 +71,13 @@ print_bytes_ (void *buf, | |||
71 | 71 | ||
72 | for (i = 0; i < buf_len; i++) | 72 | for (i = 0; i < buf_len; i++) |
73 | { | 73 | { |
74 | if ((0 != i) && (0 != fold) && (i % fold == 0)) | 74 | if (0 != i) |
75 | printf ("\n"); | 75 | { |
76 | if ((0 != fold) && (i % fold == 0)) | ||
77 | printf ("\n"); | ||
78 | else | ||
79 | printf (" "); | ||
80 | } | ||
76 | if (in_be) | 81 | if (in_be) |
77 | printf ("%02x", ((unsigned char*) buf)[buf_len - 1 - i]); | 82 | printf ("%02x", ((unsigned char*) buf)[buf_len - 1 - i]); |
78 | else | 83 | else |
@@ -100,13 +105,14 @@ print_record (const struct GNUNET_GNSRECORD_Data *rd) | |||
100 | uint64_t abs_nbo = GNUNET_htonll (rd->expiration_time); | 105 | uint64_t abs_nbo = GNUNET_htonll (rd->expiration_time); |
101 | uint16_t size_nbo = htons (rd->data_size); | 106 | uint16_t size_nbo = htons (rd->data_size); |
102 | uint32_t type_nbo = htonl (rd->record_type); | 107 | uint32_t type_nbo = htonl (rd->record_type); |
108 | at.abs_value_us = GNUNET_ntohll (abs_nbo); | ||
103 | if (0 != (rd->flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) | 109 | if (0 != (rd->flags & GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION)) |
104 | { | 110 | { |
105 | rt.rel_value_us = rd->expiration_time; | 111 | rt.rel_value_us = rd->expiration_time; |
106 | at = GNUNET_TIME_relative_to_absolute (rt); | 112 | at = GNUNET_TIME_relative_to_absolute (rt); |
107 | abs_nbo = GNUNET_htonll (at.abs_value_us); | 113 | abs_nbo = GNUNET_htonll (at.abs_value_us); |
108 | } | 114 | } |
109 | printf ("EXPIRATION:\n"); | 115 | printf ("EXPIRATION: %" PRIu64 " us\n", rd->expiration_time); |
110 | print_bytes (&abs_nbo, sizeof (abs_nbo), 8); | 116 | print_bytes (&abs_nbo, sizeof (abs_nbo), 8); |
111 | printf ("\nDATA_SIZE:\n"); | 117 | printf ("\nDATA_SIZE:\n"); |
112 | print_bytes (&size_nbo, sizeof (size_nbo), 8); | 118 | print_bytes (&size_nbo, sizeof (size_nbo), 8); |