input-bacnet.c File Reference

BACnet Monitoring Plugin - input plugin. Masaryk University, Institute of Computer Science. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pcap.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/ether.h>
#include <poll.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <openssl/md5.h>
#include <flowmonexp/plugin_input.h>
#include "protocols.h"

Go to the source code of this file.

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 VERSION   "1.0"
#define PROCESS_VLAN
#define PROCESS_MPLS
#define _GNU_SOURCE
#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)


Detailed Description

BACnet Monitoring Plugin - input plugin. Masaryk University, Institute of Computer Science.

Date:
2011
Author:
Pavel CELEDA <celeda@ics.muni.cz>

Radek KREJCI <radek.krejci@mail.muni.cz>

Copyright (C) 2011 Masaryk University, Institute of Computer Science

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the Masaryk University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

This software is provided ``as is'', and any express or implied warranties, including, but not limited to, the implied warranties of merchantability and fitness for a particular purpose are disclaimed. In no event shall the company or contributors be liable for any direct, indirect, incidental, special, exemplary, or consequential damages (including, but not limited to, procurement of substitute goods or services; loss of use, data, or profits; or business interruption) however caused and on any theory of liability, whether in contract, strict liability, or tort (including negligence or otherwise) arising in any way out of the use of this software, even if advised of the possibility of such damage.

Id
input-bacnet.c 170 2012-01-02 13:36:20Z 98863

Definition in file input-bacnet.c.


Define Documentation

#define _GNU_SOURCE

define getline(), ... GNU extensions

Definition at line 69 of file input-bacnet.c.

#define PROCESS_MPLS

Allow processing MPLS headers

Definition at line 67 of file input-bacnet.c.

#define PROCESS_VLAN

Allow processing VLAN headers

Definition at line 63 of file input-bacnet.c.

#define VERSION   "1.0"

Plugin version

Definition at line 58 of file input-bacnet.c.


© 2011 Masaryk University - Institute of Computer Science - visit http://www.muni.cz/ics/