diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-08-17 01:29:35 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:33:25 -0500 |
commit | ba6d3075bc7806878ed22f0bde7abf83142a714b (patch) | |
tree | e9667f80f95b3e1ce196ffcbd23ce300036c3490 /source4/scripting/ejs/mprutil.c | |
parent | 9fffd12799239219a276b1ca83319d1340d97232 (diff) | |
download | samba-ba6d3075bc7806878ed22f0bde7abf83142a714b.tar.gz samba-ba6d3075bc7806878ed22f0bde7abf83142a714b.tar.bz2 samba-ba6d3075bc7806878ed22f0bde7abf83142a714b.zip |
r9339: treat arrays of uint8 values as a special DATA_BLOB type in the ejs
interfaces to RPC. This makes large blobs of data much saner. Tim, you
will probably want to do the same for the smb_interfaces.h generated
code.
Next we will need ways of extracting different data types from these
blobs, for example asking for the blob to be interpreted as a utf16
string, or as a little-endian integer. That will allow for registry
scripting to be quite sane.
(This used to be commit a8bca2e8e27c953c0413693326ec3b5ecf17ba41)
Diffstat (limited to 'source4/scripting/ejs/mprutil.c')
-rw-r--r-- | source4/scripting/ejs/mprutil.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/source4/scripting/ejs/mprutil.c b/source4/scripting/ejs/mprutil.c index 657078e7c7..700185f07e 100644 --- a/source4/scripting/ejs/mprutil.c +++ b/source4/scripting/ejs/mprutil.c @@ -318,6 +318,31 @@ struct MprVar mprNTSTATUS(NTSTATUS status) } /* + create a data-blob in a mpr variable +*/ +struct MprVar mprDataBlob(DATA_BLOB blob) +{ + struct MprVar res; + struct data_blob *pblob = talloc(mprMemCtx(), struct data_blob); + *pblob = data_blob_talloc(pblob, blob.data, blob.length); + + res = mprObject("DATA_BLOB"); + + mprSetVar(&res, "size", mprCreateIntegerVar(blob.length)); + mprSetPtrChild(&res, "blob", pblob); + + return res; +} + +/* + return a data blob from a mpr var created using mprDataBlob +*/ +struct data_blob *mprToDataBlob(struct MprVar *v) +{ + return talloc_get_type(mprGetPtr(v, "blob"), struct data_blob); +} + +/* turn a WERROR into a MprVar object with lots of funky properties */ struct MprVar mprWERROR(WERROR status) |