2008-03-04 19:37:02 +01:00
|
|
|
#ifndef _LIBCTF_H
|
|
|
|
#define _LIBCTF_H
|
|
|
|
|
2009-03-19 16:16:07 +01:00
|
|
|
#include <stdbool.h>
|
2008-09-25 21:01:26 +02:00
|
|
|
#include <stdint.h>
|
2009-03-19 16:16:07 +01:00
|
|
|
#include <stddef.h>
|
2008-03-04 19:37:02 +01:00
|
|
|
|
2009-03-19 16:14:01 +01:00
|
|
|
struct ctf *ctf__new(const char *filename, void *buf, size_t size);
|
2008-09-25 21:01:26 +02:00
|
|
|
void ctf__delete(struct ctf *ctf);
|
2008-03-04 19:37:02 +01:00
|
|
|
|
2008-09-25 21:01:26 +02:00
|
|
|
uint16_t ctf__get16(struct ctf *self, uint16_t *p);
|
|
|
|
uint32_t ctf__get32(struct ctf *self, uint32_t *p);
|
|
|
|
void ctf__put16(struct ctf *self, uint16_t *p, uint16_t val);
|
|
|
|
void ctf__put32(struct ctf *self, uint32_t *p, uint32_t val);
|
2008-03-04 19:37:02 +01:00
|
|
|
|
2008-09-25 21:01:26 +02:00
|
|
|
void *ctf__get_buffer(struct ctf *self);
|
|
|
|
size_t ctf__get_size(struct ctf *self);
|
2008-03-04 19:37:02 +01:00
|
|
|
|
2009-03-19 16:16:07 +01:00
|
|
|
int ctf__add_base_type(struct ctf *self, uint32_t name, uint16_t size);
|
|
|
|
int ctf__add_fwd_decl(struct ctf *self, uint32_t name);
|
|
|
|
int ctf__add_short_type(struct ctf *self, uint16_t kind, uint16_t type,
|
|
|
|
uint32_t name);
|
|
|
|
void ctf__add_short_member(struct ctf *self, uint32_t name, uint16_t type,
|
|
|
|
uint16_t offset, int64_t *position);
|
|
|
|
void ctf__add_full_member(struct ctf *self, uint32_t name, uint16_t type,
|
|
|
|
uint64_t offset, int64_t *position);
|
|
|
|
int ctf__add_struct(struct ctf *self, uint16_t kind, uint32_t name,
|
|
|
|
uint64_t size, uint16_t nr_members, int64_t *position);
|
|
|
|
int ctf__add_array(struct ctf *self, uint16_t type, uint16_t index_type,
|
|
|
|
uint32_t nelems);
|
|
|
|
void ctf__add_parameter(struct ctf *self, uint16_t type, int64_t *position);
|
|
|
|
int ctf__add_function_type(struct ctf *self, uint16_t type,
|
2009-03-20 00:10:33 +01:00
|
|
|
uint16_t nr_parms, bool varargs, int64_t *position);
|
2009-03-20 16:51:30 +01:00
|
|
|
int ctf__add_enumeration_type(struct ctf *self, uint32_t name, uint16_t size,
|
2009-03-19 16:16:07 +01:00
|
|
|
uint16_t nr_entries, int64_t *position);
|
|
|
|
void ctf__add_enumerator(struct ctf *self, uint32_t name, uint32_t value,
|
|
|
|
int64_t *position);
|
|
|
|
|
|
|
|
struct gobuffer;
|
|
|
|
|
|
|
|
void ctf__set_strings(struct ctf *self, struct gobuffer *strings);
|
|
|
|
int ctf__encode(struct ctf *self, uint8_t flags);
|
|
|
|
|
2008-03-04 19:37:02 +01:00
|
|
|
#endif /* _LIBCTF_H */
|