aboutsummaryrefslogtreecommitdiffstats
path: root/pack.h
blob: b8139d5b7e16a4bddf306146beb3701253bab7b9 (plain)
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
27
28
/*
 * Copyright (C) 2020 Tomasz Kramkowski <tk@the-tk.com>
 * SPDX-License-Identifier: MIT
 */
#ifndef PACK_H
#define PACK_H

#include <stddef.h>

enum pack_status {
	PACK_OK,
	PACK_FMTINVAL,
	PACK_TOOSMALL,
};

extern enum pack_trace {
	PACK_TRACE_OFF,
	PACK_TRACE_CALL,
	PACK_TRACE_DEBUG,
	PACK_TRACE_ALL,
} pack_trace;

enum pack_status pack(void *dest, size_t size, const char *fmt, ...);
enum pack_status unpack(const void *buf, size_t size, const char *fmt, ...);

const char *pack_strerror(enum pack_status status);

#endif // !PACK_H