-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathbser_write.h
26 lines (20 loc) · 937 Bytes
/
bser_write.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#ifndef LIBWATCHMAN_BSER_WRITE_H_
#define LIBWATCHMAN_BSER_WRITE_H_
#include <stdio.h>
#include <stdint.h>
#include <jansson.h>
/* Returns the number of bytes needed for encoding 'node'. Does not include
* any header */
size_t bser_encoding_size(json_t* node);
/* Size of the header needed for content of size 'content_size' */
size_t bser_header_size(size_t content_size);
/* Write JSON data in BSER format to a memory buffer, including a header with
* the magic value and the content size. Returns the number of bytes that were
* written, 0 on error. */
size_t bser_write_to_buffer(
json_t* root, size_t content_size, void* buffer, size_t buflen);
/* Write JSON data in BSER format to a FILE, including a header with the magic
* value and the content size. Returns the number of bytes that were written,
* 0 on error. */
size_t bser_write_to_file(json_t* root, FILE* file);
#endif /* ndef LIBWATCHMAN_BSER_WRITE_H */