summaryrefslogtreecommitdiff
path: root/source3/rpc_parse
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-06-08 01:16:42 +0000
committerJeremy Allison <jra@samba.org>2000-06-08 01:16:42 +0000
commit6d38ba721ce57a9a574b5f0c24621df3dfcd0738 (patch)
tree93d1e123b9b97cd082e486e4613f8d42dea06c25 /source3/rpc_parse
parentb2eef912cfaf768fd26b3b2acbcfc0be2951a197 (diff)
downloadsamba-6d38ba721ce57a9a574b5f0c24621df3dfcd0738.tar.gz
samba-6d38ba721ce57a9a574b5f0c24621df3dfcd0738.tar.bz2
samba-6d38ba721ce57a9a574b5f0c24621df3dfcd0738.zip
Moved tdb functions that access parse structs into parse_prs.c
to prevent builkd breaking. Jeremy. (This used to be commit 6c7adeab0f92844ecefbcb923d0d4763d4c3eaa5)
Diffstat (limited to 'source3/rpc_parse')
-rw-r--r--source3/rpc_parse/parse_prs.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/source3/rpc_parse/parse_prs.c b/source3/rpc_parse/parse_prs.c
index b7fe19f9ab..b6bedac536 100644
--- a/source3/rpc_parse/parse_prs.c
+++ b/source3/rpc_parse/parse_prs.c
@@ -807,3 +807,31 @@ BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32,
}
return True;
}
+
+/* useful function to store a structure in rpc wire format */
+int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
+{
+ TDB_DATA kbuf, dbuf;
+ kbuf.dptr = keystr;
+ kbuf.dsize = strlen(keystr)+1;
+ dbuf.dptr = prs_data_p(ps);
+ dbuf.dsize = prs_offset(ps);
+ return tdb_store(tdb, kbuf, dbuf, TDB_REPLACE);
+}
+
+/* useful function to fetch a structure into rpc wire format */
+int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps)
+{
+ TDB_DATA kbuf, dbuf;
+ kbuf.dptr = keystr;
+ kbuf.dsize = strlen(keystr)+1;
+
+ dbuf = tdb_fetch(tdb, kbuf);
+ if (!dbuf.dptr) return -1;
+
+ ZERO_STRUCTP(ps);
+ prs_init(ps, 0, 4, UNMARSHALL);
+ prs_give_memory(ps, dbuf.dptr, dbuf.dsize, True);
+
+ return 0;
+}