1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

ctdb-protocol: Add API to extract ctdb_ltdb_header from TDB_DATA

Signed-off-by: Amitay Isaacs <amitay@gmail.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Amitay Isaacs 2015-11-10 18:29:39 +11:00 committed by Martin Schwenke
parent 5f5b3193a3
commit 8ded8e81b0
2 changed files with 17 additions and 0 deletions

View File

@ -31,6 +31,8 @@ void ctdb_ltdb_header_push(struct ctdb_ltdb_header *header, uint8_t *buf);
int ctdb_ltdb_header_pull(uint8_t *buf, size_t buflen,
struct ctdb_ltdb_header *header);
int ctdb_ltdb_header_extract(TDB_DATA *data, struct ctdb_ltdb_header *header);
size_t ctdb_rec_data_len(struct ctdb_rec_data *rec);
void ctdb_rec_data_push(struct ctdb_rec_data *rec, uint8_t *buf);
int ctdb_rec_data_pull(uint8_t *buf, size_t buflen, TALLOC_CTX *mem_ctx,

View File

@ -494,6 +494,21 @@ int ctdb_ltdb_header_pull(uint8_t *buf, size_t buflen,
return 0;
}
int ctdb_ltdb_header_extract(TDB_DATA *data, struct ctdb_ltdb_header *header)
{
int ret;
ret = ctdb_ltdb_header_pull(data->dptr, data->dsize, header);
if (ret != 0) {
return ret;
}
data->dptr += sizeof(struct ctdb_ltdb_header);
data->dsize -= sizeof(struct ctdb_ltdb_header);
return 0;
}
struct ctdb_rec_data_wire {
uint32_t length;
uint32_t reqid;