aboutsummaryrefslogtreecommitdiffstats
path: root/pack.h
blob: 1cc085182e82458e08ca01ec2d43bce96bf3eb7d (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