X-Git-Url: https://git.tokkee.org/?p=sysdb.git;a=blobdiff_plain;f=src%2Finclude%2Futils%2Fproto.h;h=56715630524594a71e524932def3f1a01a9f7670;hp=b626781f9a1f70652bd0de5fa7a51455ff57c346;hb=5637e2d8b66c64cb4ce2e205c0f6912cd8f9eb54;hpb=6c079fa6c3866576076ca47f50b5feacfa5ebbea diff --git a/src/include/utils/proto.h b/src/include/utils/proto.h index b626781..5671563 100644 --- a/src/include/utils/proto.h +++ b/src/include/utils/proto.h @@ -91,6 +91,20 @@ ssize_t sdb_proto_marshal(char *buf, size_t buf_len, uint32_t code, uint32_t msg_len, const char *msg); +/* + * sdb_proto_marshal_int32: + * Encode the 32-bit integer into the wire format and write it to buf. + * + * Returns: + * - The number of bytes of the encoded value on success. The function does + * not write more than 'buf_len' bytes. If the output was truncated then + * the return value is the number of bytes which would have been written if + * enough space had been available. + * - a negative value else + */ +ssize_t +sdb_proto_marshal_int32(char *buf, size_t buf_len, uint32_t v); + /* * sdb_proto_marshal_data: * Encode a datum into the wire format and write it to buf.