diff options
author | Jeremy Allison <jra@samba.org> | 2000-06-08 01:16:42 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-06-08 01:16:42 +0000 |
commit | 6d38ba721ce57a9a574b5f0c24621df3dfcd0738 (patch) | |
tree | 93d1e123b9b97cd082e486e4613f8d42dea06c25 | |
parent | b2eef912cfaf768fd26b3b2acbcfc0be2951a197 (diff) | |
download | samba-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)
-rw-r--r-- | source3/include/proto.h | 4 | ||||
-rw-r--r-- | source3/rpc_parse/parse_prs.c | 28 | ||||
-rw-r--r-- | source3/tdb/tdbutil.c | 30 |
3 files changed, 30 insertions, 32 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h index 65b84398c2..fdd3282307 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -2100,6 +2100,8 @@ BOOL prs_uint16_post(char *name, prs_struct *ps, int depth, uint16 *data16, BOOL prs_uint32_pre(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 *offset); BOOL prs_uint32_post(char *name, prs_struct *ps, int depth, uint32 *data32, uint32 ptr_uint32, uint32 data_size); +int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps); +int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps); /*The following definitions come from rpc_parse/parse_reg.c */ @@ -3631,8 +3633,6 @@ int tdb_store_by_string(TDB_CONTEXT *tdb, char *keystr, void *buffer, int len); TDB_DATA tdb_fetch_by_string(TDB_CONTEXT *tdb, char *keystr); size_t tdb_pack(char *buf, int bufsize, char *fmt, ...); int tdb_unpack(char *buf, int bufsize, char *fmt, ...); -int tdb_prs_store(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps); -int tdb_prs_fetch(TDB_CONTEXT *tdb, char *keystr, prs_struct *ps); /*The following definitions come from utils/nbio.c */ 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; +} diff --git a/source3/tdb/tdbutil.c b/source3/tdb/tdbutil.c index d2eb6b5ec7..3e973337b9 100644 --- a/source3/tdb/tdbutil.c +++ b/source3/tdb/tdbutil.c @@ -250,33 +250,3 @@ int tdb_unpack(char *buf, int bufsize, char *fmt, ...) no_space: return -1; } - - -/* 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; -} |