Implements a virtual machine for executing compiled intermediate language byte code.
More...
|
err_t | calc (uint8_t *filter_code, int filter_len, uint8_t *packet_data, int packet_len, uint64_t *result_value, size_t *result_offset) |
| Performs recursive execution of a subtree of the filter code. More...
|
|
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...
|
|
Implements a virtual machine for executing compiled intermediate language byte code.
err_t calc |
( |
uint8_t * |
filter_code, |
|
|
int |
filter_len, |
|
|
uint8_t * |
packet_data, |
|
|
int |
packet_len, |
|
|
uint64_t * |
result_value, |
|
|
size_t * |
result_offset |
|
) |
| |
Performs recursive execution of a subtree of the filter code.
- Parameters
-
| filter_code | Points to the begining of the filter code |
| filter_len | Specifies the length of the filter code in bytes |
| packet_data | Points to the packet data to run the filter on |
| packet_len | Specifies the length of the packet data in bytes |
[out] | result_value | Return value of the subtree execution |
[in] | result_offset | Initially specifies the offset of the next byte to be executed in the filter code |
[out] | result_offset | Specifies the next code byte to be executed, after the entire subtree code was executed |
- Returns
- ERR_OK on success, other error values on failure; see header file for error types.
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_code | Points to the filters byte code |
| filter_len | Length of the byte code |
| packet_data | Points to the packet data to run the filter on |
| packet_len | Length of packet data in bytes |
[out] | error_out | Error information upon failure during execution |
- Returns
- true, if the filter executed successfully and the result was not zero. false otherwise.