Commit | Line | Data |
---|---|---|
fc93b2bd MD |
1 | #ifndef _BABELTRACE_FORMAT_H |
2 | #define _BABELTRACE_FORMAT_H | |
3 | ||
4 | /* | |
5 | * BabelTrace | |
6 | * | |
7 | * Trace Format Header | |
8 | * | |
9 | * Copyright (c) 2010 Mathieu Desnoyers <mathieu.desnoyers@efficios.com> | |
10 | * | |
11 | * This library is free software; you can redistribute it and/or | |
12 | * modify it under the terms of the GNU Lesser General Public | |
13 | * License as published by the Free Software Foundation; either | |
14 | * version 2.1 of the License, or (at your option) any later version. | |
15 | * | |
16 | * This library is distributed in the hope that it will be useful, | |
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
19 | * Lesser General Public License for more details. | |
20 | * | |
21 | * You should have received a copy of the GNU Lesser General Public | |
22 | * License along with this library; if not, write to the Free Software | |
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
24 | */ | |
25 | ||
26 | #include <stdint.h> | |
27 | #include <glib.h> | |
28 | ||
29 | struct format { | |
30 | GQuark name; | |
31 | ||
32 | uint64_t (*uint_read)(const uint8_t *ptr, size_t len, int byte_order); | |
33 | int64_t (*int_read)(const uint8_t *ptr, size_t len, int byte_order); | |
448d3cc7 MD |
34 | size_t (*uint_write)(uint8_t *ptr, size_t len, int byte_order, |
35 | uint64_t v); | |
36 | size_t (*int_write)(uint8_t *ptr, size_t len, int byte_order, | |
37 | int64_t v); | |
fc93b2bd MD |
38 | |
39 | uint64_t (*bitfield_unsigned_read)(const unsigned char *ptr, | |
448d3cc7 MD |
40 | unsigned long start, |
41 | unsigned long len, | |
42 | int byte_order); | |
fc93b2bd | 43 | int64_t (*bitfield_signed_read)(const unsigned char *ptr, |
448d3cc7 MD |
44 | unsigned long start, unsigned long len, |
45 | int byte_order); | |
fc93b2bd | 46 | size_t (*bitfield_unsigned_write)(unsigned char *ptr, |
448d3cc7 MD |
47 | unsigned long start, |
48 | unsigned long len, | |
49 | int byte_order, uint64_t v); | |
fc93b2bd | 50 | size_t (*bitfield_signed_write)(unsigned char *ptr, |
448d3cc7 MD |
51 | unsigned long start, |
52 | unsigned long len, | |
53 | int byte_order, int64_t v); | |
0a46062b | 54 | |
448d3cc7 MD |
55 | void (*float_copy)(unsigned char *destp, |
56 | const struct type_class_float *dest, | |
57 | const unsigned char *srcp, | |
58 | const struct type_class_float *src); | |
59 | double (*double_read)(const unsigned char *ptr, | |
60 | const struct type_class_float *src); | |
61 | size_t (*double_write)(unsigned char *ptr, | |
62 | const struct type_class_float *dest, | |
63 | double v); | |
fc93b2bd MD |
64 | |
65 | size_t (*string_copy)(unsigned char *dest, const unsigned char *src); | |
66 | ||
448d3cc7 MD |
67 | GQuark (*enum_read)(const unsigned char *ptr, |
68 | const struct type_class_enum *src); | |
69 | size_t (*enum_write)(unsigned char *ptr, | |
70 | const struct type_class_enum *dest, | |
71 | GQuark q); | |
72 | ||
fc93b2bd MD |
73 | }; |
74 | ||
75 | struct format *bt_lookup_format(GQuark qname); | |
76 | int bt_register_format(const struct format *format); | |
77 | ||
78 | /* TBD: format unregistration */ | |
79 | ||
80 | #endif /* _BABELTRACE_FORMAT_H */ |