Barrelfish
Macros | Typedefs | Functions
vm.h File Reference

Interface for filter execution virtual machine. More...

Macros

#define ERR_BAD_OP   -1
 Execution failed because of an unknown opcode.
 
#define ERR_BAD_ACCESS   -2
 Filter did not match because it tried to access a non existing location in the packet.
 
#define ERR_UNKNOWN   -3
 An unknown internal error occurred during the execution.
 

Typedefs

typedef uint8_t op_t
 Define opcode type as single byte.
 

Functions

bool execute_filter (uint8_t *filter_code, int filter_len, uint8_t *packet_data, int packet_len, int *error_out)
 Executes the specified filter on the given packet. More...
 

Detailed Description

Interface for filter execution virtual machine.

Function Documentation

bool execute_filter ( uint8_t *  filter_code,
int  filter_len,
uint8_t *  packet_data,
int  packet_len,
int *  error_out 
)

Executes the specified filter on the given packet.

Parameters
filter_codePoints to the filters byte code
filter_lenLength of the byte code
packet_dataPoints to the packet data to run the filter on
packet_lenLength of packet data in bytes
[out]error_outError information upon failure during execution
Returns
true, if the filter executed successfully and the result was not zero. false otherwise.