Commit 392bb2ea authored by Nils Goroll's avatar Nils Goroll

add helper to get blob from a uint32 case of a VCL_INT

parent 7fe8ce98
...@@ -207,6 +207,7 @@ CONTENTS ...@@ -207,6 +207,7 @@ CONTENTS
* hmac(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB) * hmac(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB)
* BLOB hmacf(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB, BLOB) * BLOB hmacf(ENUM {MD5,SHA1,SHA224,SHA256,SHA384,SHA512,SHA3_224,SHA3_256,SHA3_384,SHA3_512}, BLOB, BLOB)
* STRING version() * STRING version()
* BLOB _uint32blob(INT)
.. _obj_digest: .. _obj_digest:
...@@ -518,6 +519,17 @@ Example:: ...@@ -518,6 +519,17 @@ Example::
std.log("Using VMOD blobdigest version " + blobdigest.version()); std.log("Using VMOD blobdigest version " + blobdigest.version());
.. _func__uint32blob:
_uint32blob
-----------
::
BLOB _uint32blob(INT)
Intentionally undocumented, transitional helper only
REQUIREMENTS REQUIREMENTS
============ ============
......
...@@ -590,3 +590,25 @@ vmod_version(VRT_CTX __attribute__((unused))) ...@@ -590,3 +590,25 @@ vmod_version(VRT_CTX __attribute__((unused)))
{ {
return VERSION; return VERSION;
} }
/* vend.h is varinshd private */
static __inline void
vbe32enc(void *pp, uint32_t u)
{
uint8_t *p = (uint8_t *)pp;
p[0] = (u >> 24) & 0xff;
p[1] = (u >> 16) & 0xff;
p[2] = (u >> 8) & 0xff;
p[3] = u & 0xff;
}
VCL_BLOB
vmod__uint32blob(VRT_CTX, VCL_INT i)
{
uint32_t ui = (uint32_t)i;
uint8_t be[sizeof ui];
vbe32enc(be, ui);
return (VRT_blob(ctx, "uint32blob", be, sizeof be));
}
...@@ -445,6 +445,10 @@ Example:: ...@@ -445,6 +445,10 @@ Example::
std.log("Using VMOD blobdigest version " + blobdigest.version()); std.log("Using VMOD blobdigest version " + blobdigest.version());
$Function BLOB _uint32blob(INT)
Intentionally undocumented, transitional helper only
REQUIREMENTS REQUIREMENTS
============ ============
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment