diff options
author | Christian Grothoff <christian@grothoff.org> | 2015-08-14 22:05:34 +0200 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2015-08-14 22:05:34 +0200 |
commit | 3d1627daa7b62a30b8bb2d201829b1a6034e85be (patch) | |
tree | 0869314f7ccf1cd696a035ed1a6432a034d4379e /src/include | |
parent | 8a4043248893a7c7cb3b896a0ed24d7611796c98 (diff) |
helper function for debugging
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/taler_util.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/include/taler_util.h b/src/include/taler_util.h index 00397cc88..b6dd9596a 100644 --- a/src/include/taler_util.h +++ b/src/include/taler_util.h @@ -74,6 +74,30 @@ TALER_gcrypt_init (void); /** + * Convert a buffer to an 8-character string + * representative of the contents. This is used + * for logging binary data when debugging. + * + * @param buf buffer to log + * @param buf_size number of bytes in @a buf + * @return text representation of buf, valid until next + * call to this function + */ +const char * +TALER_b2s (const void *buf, + size_t buf_size); + +/** + * Convert a fixed-sized object to a string using + * #TALER_b2s(). + * + * @param obj address of object to convert + * @return string representing the binary obj buffer + */ +#define TALER_B2S(obj) TALER_b2s (obj, sizeof (*obj)) + + +/** * Round a time value so that it is suitable for transmission * via JSON encodings. * |