diff --git a/src/libckpool.c b/src/libckpool.c index 50861c2c..ef0abd1d 100644 --- a/src/libckpool.c +++ b/src/libckpool.c @@ -1280,6 +1280,13 @@ char *bkey_object(void) return bkey; } +/* Extract bkey length */ +uint32_t bkey_len(char *bkey) +{ + uint32_t *lenptr = bkey_lenptr(bkey); + return le32toh(*lenptr); +} + /* Add binary from hex to a bkey message */ void _bkey_add_hex(char **bkey, const char *key, const char *hex, const char *file, const char *func, const int line) { diff --git a/src/libckpool.h b/src/libckpool.h index 20fe8542..2a0cbc66 100644 --- a/src/libckpool.h +++ b/src/libckpool.h @@ -320,6 +320,7 @@ typedef struct unixsock unixsock_t; char *bkey_object(void); +uint32_t bkey_len(char *bkey); void _bkey_add_hex(char **bkey, const char *key, const char *hex, const char *file, const char *func, const int line); #define bkey_add_hex(bkey, key, hex) _bkey_add_hex(&(bkey), key, hex, __FILE__, __func__, __LINE__) void _bkey_add_bin(char **bkey, const char *key, const char *bin, const int blen, const char *file, const char *func, const int line);