avmpack.h
Include dependency graph for avmpack.h:
This graph shows which files directly or indirectly include avmpack.h:
AVM Pack file format parsing function.
Typedefs
-
typedef void *(*avmpack_fold_fun)(void *accum, const void *section_ptr, uint32_t section_size, const void *beam_ptr, uint32_t flags, const char *section_name)
callback function for AVMPack section fold.
Instances of this function are supplied to the avmpack_fold function, in order to provide a callback mechanism for folding over the contents of the AVM binary.
- Param accum:
The accumulator supplied by the application.
- Param section_ptr:
a pointer to the start of the AVM section (including the module header).
- Param section_size:
the size of the entire section (including the module header).
- Param beam_ptr:
the start of the beam module portion of the section. This pointers starts immediately after the (aligned) header.
- Param flags:
the section flags, as defined in the module header.
- Param section_name:
the section name, as defined in the module header.
- Return:
an accumulator, which will be supplied to the next call to this function, and eventually returned from the avmpack_fold function.
Functions
-
static inline void avmpack_data_init(struct AVMPackData *avm_pack_data, const struct AVMPackInfo *info)
-
static inline void avmpack_data_destroy(struct AVMPackData *avm_pack_data, GlobalContext *global)
-
int avmpack_find_section_by_flag(const void *avmpack_binary, uint32_t flags_mask, const void **ptr, uint32_t *size, const char **name)
Finds an AVM Pack section that has certain flags set.
Finds an AVM Pack section that has certain flags set and returns a pointer to it, its size and its name.
- Parameters:
avmpack_binary – a pointer to valid AVM Pack file data.
flags_mask – that will be matched against file sections.
ptr – will point to the found file section.
size – will be set to the file section size that has been found, if the section has not been found it will not be updated.
name – the section name, as defined in the module header.
- Returns:
1 if the file section has been found, 0 otherwise.
-
int avmpack_find_section_by_name(const void *avmpack_binary, const char *name, const void **ptr, uint32_t *size)
Finds an AVM Pack section that has certain name.
Finds an AVM Pack section with a certain name and returns a pointer to it and its size.
- Parameters:
avmpack_binary – a pointer to valid AVM Pack file data.
name – the file section name that will be searched.
ptr – will point to the found file section, if the section has not been found it will not be updated.
size – will be set to the file section size that has been found, if the section has not been found it will not be updated.
- Returns:
1 if the file section has been found, 0 otherwise.
-
int avmpack_is_valid(const void *avmpack_binary, uint32_t size)
Returns 1 if the pointed binary is a valid AVM Pack.
Returns if the pointed binary is a valid AVM Pack binary or not.
- Parameters:
avmpack_binary – a pointer to an AVM Pack binary.
size – the size of AVM Pack binary.
- Returns:
1 if it is a valid AVM Pack binary, 0 otherwise.
-
void *avmpack_fold(void *accum, const void *avmpack_binary, avmpack_fold_fun fold_fun)
Fold over all the sections in an AVM Pack.
This function will call the callback on each section of the AVM Pack, passing in the current section of each module in the AVM binary to the supplied fold function.
- Parameters:
accum – The accumulator supplied by the application.
avmpack_binary – a pointer to an AVM Pack binary.
fold_fun – function that will be called for each AVM section.
Variables
-
const struct AVMPackInfo in_memory_avm_pack_info
-
const struct AVMPackInfo const_avm_pack_info
-
struct AVMPackInfo
- #include <avmpack.h>
Public Members
-
void (*destructor)(struct AVMPackData *obj, GlobalContext *global)
-
void (*destructor)(struct AVMPackData *obj, GlobalContext *global)
-
struct AVMPackData
- #include <avmpack.h>
Collaboration diagram for AVMPackData:
-
struct InMemoryAVMPack
- #include <avmpack.h>
Collaboration diagram for InMemoryAVMPack:
Public Members
-
struct AVMPackData base
-
struct AVMPackData base
-
struct ConstAVMPack
- #include <avmpack.h>
Collaboration diagram for ConstAVMPack:
Public Members
-
struct AVMPackData base
-
struct AVMPackData base