| 1 | #ifndef _BABELTRACE_CTF_TYPES_H |
| 2 | #define _BABELTRACE_CTF_TYPES_H |
| 3 | |
| 4 | /* |
| 5 | * Common Trace Format |
| 6 | * |
| 7 | * Type header |
| 8 | * |
| 9 | * Copyright 2010 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com> |
| 10 | * |
| 11 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
| 12 | * of this software and associated documentation files (the "Software"), to deal |
| 13 | * in the Software without restriction, including without limitation the rights |
| 14 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 15 | * copies of the Software, and to permit persons to whom the Software is |
| 16 | * furnished to do so, subject to the following conditions: |
| 17 | * |
| 18 | * The above copyright notice and this permission notice shall be included in |
| 19 | * all copies or substantial portions of the Software. |
| 20 | */ |
| 21 | |
| 22 | #include <stdint.h> |
| 23 | #include <glib.h> |
| 24 | |
| 25 | /* |
| 26 | * IMPORTANT: All lengths (len) and offsets (start, end) are expressed in bits, |
| 27 | * *not* in bytes. |
| 28 | * |
| 29 | * All write primitives, as well as read for dynamically sized entities, can |
| 30 | * receive a NULL ptr/dest parameter. In this case, no write is performed, but |
| 31 | * the size is returned. |
| 32 | */ |
| 33 | |
| 34 | uint64_t ctf_uint_read(struct stream_pos *pos, |
| 35 | const struct type_class_integer *int_class); |
| 36 | int64_t ctf_int_read(struct stream_pos *pos, |
| 37 | const struct type_class_integer *int_class); |
| 38 | void ctf_uint_write(struct stream_pos *pos, |
| 39 | const struct type_class_integer *int_class, |
| 40 | uint64_t v); |
| 41 | void ctf_int_write(struct stream_pos *pos, |
| 42 | const struct type_class_integer *int_class, |
| 43 | int64_t v); |
| 44 | |
| 45 | double ctf_double_read(struct stream_pos *pos, |
| 46 | const struct type_class_float *src); |
| 47 | void ctf_double_write(struct stream_pos *pos, |
| 48 | const struct type_class_float *dest, |
| 49 | double v); |
| 50 | long double ctf_ldouble_read(struct stream_pos *pos, |
| 51 | const struct type_class_float *src); |
| 52 | void ctf_ldouble_write(struct stream_pos *pos, |
| 53 | const struct type_class_float *dest, |
| 54 | long double v); |
| 55 | void ctf_float_copy(struct stream_pos *destp, const struct type_class_float *dest, |
| 56 | struct stream_pos *srcp, const struct type_class_float *src); |
| 57 | |
| 58 | void ctf_string_copy(struct stream_pos *dest, struct stream_pos *src, |
| 59 | const struct type_class_string *string_class); |
| 60 | void ctf_string_read(unsigned char **dest, struct stream_pos *src, |
| 61 | const struct type_class_string *string_class); |
| 62 | void ctf_string_write(struct stream_pos *dest, const unsigned char *src, |
| 63 | const struct type_class_string *string_class); |
| 64 | void ctf_string_free_temp(unsigned char *string); |
| 65 | |
| 66 | GQuark ctf_enum_read(struct stream_pos *pos, |
| 67 | const struct type_class_enum *src); |
| 68 | void ctf_enum_write(struct stream_pos *pos, |
| 69 | const struct type_class_enum *dest, |
| 70 | GQuark q); |
| 71 | void ctf_struct_begin(struct stream_pos *pos, |
| 72 | const struct type_class_struct *struct_class); |
| 73 | void ctf_struct_end(struct stream_pos *pos, |
| 74 | const struct type_class_struct *struct_class); |
| 75 | void ctf_array_begin(struct stream_pos *pos, |
| 76 | const struct type_class_array *array_class); |
| 77 | void ctf_array_end(struct stream_pos *pos, |
| 78 | const struct type_class_array *array_class); |
| 79 | void ctf_sequence_begin(struct stream_pos *pos, |
| 80 | const struct type_class_sequence *sequence_class); |
| 81 | void ctf_sequence_end(struct stream_pos *pos, |
| 82 | const struct type_class_sequence *sequence_class); |
| 83 | |
| 84 | #endif /* _BABELTRACE_CTF_TYPES_H */ |