Baseer 0.2.0
Baseer is an advanced binary analysis tool designed to provide deep insights into any file.
Loading...
Searching...
No Matches
bparser.h File Reference

Binary parser abstraction supporting memory and streaming files. More...

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../../baseer.h"

Go to the source code of this file.

Classes

struct  bparser
 Parser object. More...

Typedefs

typedef bool(* bparser_callback_t) (bparser *parser, void *arg)
 Callback for bparser tools.

Functions

bparserbparser_load (baseer_target_t *data)
 Load a parser object.
size_t bparser_read (bparser *parser, void *buf, unsigned int pos, size_t size)
 Read bytes from parser.
bool bparser_apply (bparser *parser, bparser_callback_t callback, void *arg)
 Execute a callback on the parser.

Detailed Description

Binary parser abstraction supporting memory and streaming files.

Provides a unified interface to read from memory blocks or FILE* streams and execute callbacks on the parsed content.

Typedef Documentation

◆ bparser_callback_t

typedef bool(* bparser_callback_t) (bparser *parser, void *arg)

Callback for bparser tools.

Parameters
parserPointer to parser object
argAdditional argument (e.g., inputs)
Returns
true on success, false on failure

Function Documentation

◆ bparser_apply()

bool bparser_apply ( bparser * parser,
bparser_callback_t callback,
void * arg )

Execute a callback on the parser.

Parameters
parserPointer to parser
callbackCallback function
argAdditional argument
Returns
true on success, false on failure

◆ bparser_load()

bparser * bparser_load ( baseer_target_t * data)

Load a parser object.

Parameters
typeParser type: BPARSER_MEM or BPARSER_FILE
dataMemory block or FILE* pointer
Returns
Pointer to bparser on success, NULL on failure

◆ bparser_read()

size_t bparser_read ( bparser * parser,
void * buf,
unsigned int pos,
size_t size )

Read bytes from parser.

Parameters
parserPointer to parser object
bufOutput buffer
posOffset in memory or file
sizeNumber of bytes to read
Returns
Number of bytes successfully read