Data Structures | |
struct | bacnet_input_private_t |
Plugin's private structure with information passed from init to the calls of main plugin functions. More... | |
struct | bacnet_record_t |
BACnet specific part of the flow record. More... | |
Defines | |
#define | PCAP_SIZE 1500 |
#define | PCAP_TIMEOUT 500 |
#define | PRINT(format, args...) |
#define | PRINTERR(format, args...) fprintf(stderr,format,##args) |
#define | PRINTWARN(format, args...) fprintf(stderr,format,##args) |
Functions | |
int | parse_eth (unsigned char *buf, uint32_t caplen, flow_record_t *record, bacnet_record_t *pr) |
Parse Ethernet header and fill required information into the flow record. | |
int | parse_llc (unsigned char *buf, uint32_t caplen, flow_record_t *record, bacnet_record_t *pr) |
Parse Logical Link Control header and fill required information into the flow record. | |
int | parse_bacnet_vlc (unsigned char *buf, uint32_t caplen, flow_record_t *record, bacnet_record_t *pr) |
Parse BACnet Virtual Link Control header and fill required information into the flow record. | |
int | parse_bacnet_ip (uint16_t ethtype, unsigned char *buf, uint32_t caplen, flow_record_t *record, bacnet_record_t *pr) |
Parse IP header and fill required information into the flow record. | |
int | parse_bacnet (unsigned char *buf, uint32_t caplen, flow_record_t *record, bacnet_record_t *pr) |
Parse BACnet headers and fill required information into the flow record. | |
plugin_desc_t * | plugin_input_desc () |
API for flowmonexp to get plugin description structure. | |
int | validity_control (void *self, flow_record_t *r) |
Validity checker for BACnet record's control field. | |
int | validity_fail (void *self, flow_record_t *r) |
General validity checker that always fails. | |
int | validity_ethertype (void *self, flow_record_t *r) |
Validity checker for BACnet record's ethertype field. | |
int | validity_dst (void *self, flow_record_t *r) |
Validity checker for BACnet record's hop count and dnet fields. | |
int | validity_dstadr (void *self, flow_record_t *r) |
Validity checker for BACnet record's hop dadr field. | |
int | validity_src (void *self, flow_record_t *r) |
Validity checker for BACnet record's snet field. | |
int | validity_srcadr (void *self, flow_record_t *r) |
Validity checker for BACnet record's sadr field. | |
int | validity_msg_type (void *self, flow_record_t *r) |
Validity checker for BACnet record's msg_type field. | |
int | value_length_8 (void *self, flow_record_t *r) |
Get actual length for BACnet record's 8bit static fields. | |
int | value_length_16 (void *self, flow_record_t *r) |
Get actual length for BACnet record's 16bit static fields. | |
int | value_length_dadr (void *self, flow_record_t *r) |
Get actual length of the BACnet record's dadr field. | |
int | value_length_sadr (void *self, flow_record_t *r) |
Get actual length of the BACnet record's sadr field. | |
void | value_fill_ethertype (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's ethertype field. | |
void | value_fill_control (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's control field. | |
void | value_fill_hops (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's hop_count field. | |
void | value_fill_msg_type (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's msg_type field. | |
void | value_fill_vendor_id (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's vendor_id field. | |
void | value_fill_dnet (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's dnet field. | |
void | value_fill_dadr (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's dadr field. | |
void | value_fill_snet (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's snet field. | |
void | value_fill_sadr (void *self, flow_record_t *record, void *dst, int len, int to_network_byte_order) |
Get value of the BACnet record's sadr field. | |
void | plugin_input_getter_init (void *plugin_private, flow_record_getter_t **getter_list) |
Init flowmonexp's getters for BACnet record's specific fields. | |
void * | plugin_input_init (char *params, int full_packet, int data_offset) |
Initialize all needed structures/devices/files etc. The function is called once as the first part of the plugin. | |
uint64_t | plugin_input_get_final_flow (void *plugin_private, flow_record_t *record) |
Get flow record implementation - returned flow is immediatelly marked as expired. | |
uint64_t | plugin_input_get_flow (void *plugin_private, flow_record_t *record) |
Get flow record implementation - add flow record into the flowmonexp's flow cache. | |
Variables | |
unsigned int | plugin_type = (PLUGIN_TYPE_INPUT) |
By default, plugin reads input data (in PCAP format) from stdin. This can be changed by parameter given to the plugin via flowmonexp command. Parameter can be in a form of path to the input PCAP file or PCAP interface starting with a '@' character. Examples of starting flowmonexp follow.
Read data from stdin:
$ flowmonexp -X input-bacnet.so -I input-bacnet
$ flowmonexp -X input-bacnet.so -I input-bacnet:-
$ flowmonexp -X input-bacnet.so -I input-bacnet:data.pcap
$ flowmonexp -X input-bacnet.so:@eth0 -I input-bacnet
After the input type parameter there can be also specified file with BPF filter for the input data:
$ flowmonexp -X input-bacnet.so:-,filter.bpf -I input-bacnet
Plugin is able to work in a Single Packet Flow mode when each received packet is immediatelly marked as expired flow. This way flowmonexp exports only 1-packet flows. This feature can be enabled by defining macro SPF (e.g. in time of compilation by GCC's -DSPF option). Plugin then uses plugin_input_get_final_flow() function instead of plugin_input_get_flow().
#define PCAP_SIZE 1500 |
Snapshot length of the PCAP packet
Definition at line 125 of file input-bacnet.c.
#define PCAP_TIMEOUT 500 |
PCAP read timeout in milliseconds
Definition at line 126 of file input-bacnet.c.
#define PRINT | ( | format, | |||
args... | ) |
Message printer
Definition at line 136 of file input-bacnet.c.
#define PRINTERR | ( | format, | |||
args... | ) | fprintf(stderr,format,##args) |
Error message printer
Definition at line 142 of file input-bacnet.c.
#define PRINTWARN | ( | format, | |||
args... | ) | fprintf(stderr,format,##args) |
Warning message printer
Definition at line 147 of file input-bacnet.c.
int parse_bacnet | ( | unsigned char * | buf, | |
uint32_t | caplen, | |||
flow_record_t * | record, | |||
bacnet_record_t * | pr | |||
) |
Parse BACnet headers and fill required information into the flow record.
[in] | buf | Data buffer. |
[in] | caplen | Length of portion present. |
[in,out] | record | Flow record structure. |
[in] | pr | Plugin's private structure with BACnet specific record offset |
0 | on success, nonzero otherwise. |
Definition at line 1073 of file input-bacnet.c.
int parse_bacnet_ip | ( | uint16_t | ethtype, | |
unsigned char * | buf, | |||
uint32_t | caplen, | |||
flow_record_t * | record, | |||
bacnet_record_t * | pr | |||
) |
Parse IP header and fill required information into the flow record.
[in] | ethtype | Packet's EtherType value. |
[in] | buf | Data buffer. |
[in] | caplen | Length of portion present. |
[in,out] | record | Flow record structure. |
[in] | pr | Plugin's private structure with BACnet specific record offset |
0 | on success, nonzero otherwise. |
Definition at line 959 of file input-bacnet.c.
int parse_bacnet_vlc | ( | unsigned char * | buf, | |
uint32_t | caplen, | |||
flow_record_t * | record, | |||
bacnet_record_t * | pr | |||
) |
Parse BACnet Virtual Link Control header and fill required information into the flow record.
[in] | buf | Data buffer. |
[in] | caplen | Length of portion present. |
[in,out] | record | Flow record structure. |
[in] | pr | Plugin's private structure with BACnet specific record offset |
0 | on success, nonzero otherwise. |
Definition at line 998 of file input-bacnet.c.
int parse_eth | ( | unsigned char * | buf, | |
uint32_t | caplen, | |||
flow_record_t * | record, | |||
bacnet_record_t * | pr | |||
) |
Parse Ethernet header and fill required information into the flow record.
[in] | buf | Data buffer. |
[in] | caplen | Length of portion present. |
[in,out] | record | Flow record structure. |
[in] | pr | Plugin's private structure with BACnet specific record offset |
0 | on success, nonzero otherwise. |
Definition at line 831 of file input-bacnet.c.
int parse_llc | ( | unsigned char * | buf, | |
uint32_t | caplen, | |||
flow_record_t * | record, | |||
bacnet_record_t * | pr | |||
) |
Parse Logical Link Control header and fill required information into the flow record.
[in] | buf | Data buffer. |
[in] | caplen | Length of portion present. |
[in,out] | record | Flow record structure. |
[in] | pr | Plugin's private structure with BACnet specific record offset |
0 | on success, nonzero otherwise. |
Definition at line 1038 of file input-bacnet.c.
plugin_desc_t* plugin_input_desc | ( | ) |
API for flowmonexp to get plugin description structure.
Definition at line 258 of file input-bacnet.c.
uint64_t plugin_input_get_final_flow | ( | void * | plugin_private, | |
flow_record_t * | record | |||
) |
Get flow record implementation - returned flow is immediatelly marked as expired.
[in] | plugin_private | Plugin's private structure from init with all necessary information |
[in] | record | Flow record from input plugin(s) |
uint64_t plugin_input_get_flow | ( | void * | plugin_private, | |
flow_record_t * | record | |||
) |
Get flow record implementation - add flow record into the flowmonexp's flow cache.
[in] | plugin_private | Plugin's private structure from init with all necessary information |
[in,out] | record | Flow record from input plugin(s) |
Definition at line 763 of file input-bacnet.c.
void plugin_input_getter_init | ( | void * | plugin_private, | |
flow_record_getter_t ** | getter_list | |||
) |
Init flowmonexp's getters for BACnet record's specific fields.
[in] | plugin_private | Plugin's private structure from init with all necessary information |
[in,out] | getter_list | List of available getters for a complete flow record |
Definition at line 606 of file input-bacnet.c.
void* plugin_input_init | ( | char * | params, | |
int | full_packet, | |||
int | data_offset | |||
) |
Initialize all needed structures/devices/files etc. The function is called once as the first part of the plugin.
[in] | params | Plugin parameters as string from command line |
[in] | full_packet | Specify if plugin_input_get_packet() function (if implemented) is forced to return full packet or some cropping can be done |
[in] | data_offset | Offset of the plugin specific data (bacnet_record_t) in flowmonexp's standard flow record |
Definition at line 631 of file input-bacnet.c.
int validity_control | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's control field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 271 of file input-bacnet.c.
int validity_dst | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's hop count and dnet fields.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 322 of file input-bacnet.c.
int validity_dstadr | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's hop dadr field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 341 of file input-bacnet.c.
int validity_ethertype | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's ethertype field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 303 of file input-bacnet.c.
int validity_fail | ( | void * | self, | |
flow_record_t * | r | |||
) |
General validity checker that always fails.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 290 of file input-bacnet.c.
int validity_msg_type | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's msg_type field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 398 of file input-bacnet.c.
int validity_src | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's snet field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 360 of file input-bacnet.c.
int validity_srcadr | ( | void * | self, | |
flow_record_t * | r | |||
) |
Validity checker for BACnet record's sadr field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 379 of file input-bacnet.c.
void value_fill_control | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's control field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 488 of file input-bacnet.c.
void value_fill_dadr | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's dadr field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 563 of file input-bacnet.c.
void value_fill_dnet | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's dnet field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 548 of file input-bacnet.c.
void value_fill_ethertype | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's ethertype field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 473 of file input-bacnet.c.
void value_fill_hops | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's hop_count field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 503 of file input-bacnet.c.
void value_fill_msg_type | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's msg_type field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 518 of file input-bacnet.c.
void value_fill_sadr | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's sadr field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 593 of file input-bacnet.c.
void value_fill_snet | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's snet field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 578 of file input-bacnet.c.
void value_fill_vendor_id | ( | void * | self, | |
flow_record_t * | record, | |||
void * | dst, | |||
int | len, | |||
int | to_network_byte_order | |||
) |
Get value of the BACnet record's vendor_id field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | record | Standard flowmonexp's flow record |
[in] | dst | Where to copy resulted data |
[in] | len | Data length |
[in] | to_network_byte_order | if other than zero, convert value to network byte order (work only for lengths: 1,2,4,8) |
Definition at line 533 of file input-bacnet.c.
int value_length_16 | ( | void * | self, | |
flow_record_t * | r | |||
) |
Get actual length for BACnet record's 16bit static fields.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 430 of file input-bacnet.c.
int value_length_8 | ( | void * | self, | |
flow_record_t * | r | |||
) |
Get actual length for BACnet record's 8bit static fields.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 417 of file input-bacnet.c.
int value_length_dadr | ( | void * | self, | |
flow_record_t * | r | |||
) |
Get actual length of the BACnet record's dadr field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 443 of file input-bacnet.c.
int value_length_sadr | ( | void * | self, | |
flow_record_t * | r | |||
) |
Get actual length of the BACnet record's sadr field.
[in] | self | Plugin's specific record part (bacnet_record_t) allocated after standard flow record |
[in] | r | Standard flowmonexp's flow record |
Definition at line 458 of file input-bacnet.c.
unsigned int plugin_type = (PLUGIN_TYPE_INPUT) |
Set type of the flowmonexp's plugin
Definition at line 131 of file input-bacnet.c.