flowmon-input-tcp  1.0.0
FlowMon IPFIX Export Plugin
 All Data Structures Files Functions Variables Macros Pages
flowmon-input-tcp.c File Reference

Main code of the Flowmon IPFIX Export Plugin. More...

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <endian.h>
#include <errno.h>
#include <netinet/if_ether.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
#include <flowmonexp/plugin_input_filter.h>

Go to the source code of this file.

Data Structures

struct  plugin_private_t
 
struct  plugin_record_t
 

Macros

#define _ETH_P_8021AD   0x88A8
 
#define _ETH_P_8021QINQ   0x9100
 
#define _ETH_P_8021QINQ_DOUBLE   0x9200
 
#define _ETH_P_8021QINQ_TRIPPLE   0x9300
 
#define VLAN_HLEN   4
 
#define VLAN_ID_MASK   0xFF0F
 
#define MPLS_HLEN   4
 
#define MPLS_STACK_MASK   0xFF7F
 

Functions

 SET_PLUGIN_TYPE (PLUGIN_TYPE_INPUT_FILTER)
 
 RECORD_VALID (value_syn_ok)
 
 RECORD_VALID (value_win_ok)
 
 RECORD_CURRENT_LENGTH (value_length)
 
 RECORD_FILLER (value_fill_syn_size)
 
 RECORD_FILLER_TXT (value_fill_syn_size_txt)
 
 RECORD_FILLER (value_fill_win_size)
 
 RECORD_FILLER_TXT (value_fill_win_size_txt)
 
 if (!retval)
 
 getter_add (getter_list,"SYN_SIZE", sizeof(uint16_t), retval,&value_syn_ok,&value_length,&value_fill_syn_size,&value_fill_syn_size_txt)
 
 getter_add (getter_list,"TCP_WIN_SIZE", sizeof(uint16_t), retval,&value_win_ok,&value_length,&value_fill_win_size,&value_fill_win_size_txt)
 
 return (retval)
 
int32_t link_offset (unsigned char *data, uint32_t caplen)
 
 if (record->l4.protocol==6 &&(record->l4.tcp_flags &0x02))
 

Variables

 PLUGIN_INPUT_FILTER_DESC
 
 PLUGIN_INPUT_FILTER_INIT
 
 retval = malloc(sizeof(plugin_private_t))
 
retval data_offset = data_offset
 
retval link_len = -1
 
 PLUGIN_INPUT_FILTER_FILTER
 
plugin_record_tr = PLUGIN_DATA(record, p->data_offset)
 
r syn_size = 0
 
r tcp_win_size = 0
 
return FLOW_FILTER_PASS
 
 PLUGIN_INPUT_FILTER_SHUTDOWN
 

Detailed Description

Main code of the Flowmon IPFIX Export Plugin.

Author
Petr Velan velan.nosp@m.@mai.nosp@m.l.mun.nosp@m.i.cz
Date
2012

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:
flowmon-input-tcp.c 928 2013-01-16 08:32:47Z 255519

Definition in file flowmon-input-tcp.c.

Macro Definition Documentation

#define _ETH_P_8021AD   0x88A8

Definition at line 72 of file flowmon-input-tcp.c.

#define _ETH_P_8021QINQ   0x9100

Definition at line 73 of file flowmon-input-tcp.c.

#define _ETH_P_8021QINQ_DOUBLE   0x9200

Definition at line 74 of file flowmon-input-tcp.c.

#define _ETH_P_8021QINQ_TRIPPLE   0x9300

Definition at line 75 of file flowmon-input-tcp.c.

#define VLAN_HLEN   4

Definition at line 77 of file flowmon-input-tcp.c.

#define VLAN_ID_MASK   0xFF0F

Definition at line 78 of file flowmon-input-tcp.c.

#define MPLS_HLEN   4

Definition at line 80 of file flowmon-input-tcp.c.

#define MPLS_STACK_MASK   0xFF7F

Definition at line 81 of file flowmon-input-tcp.c.

Function Documentation

SET_PLUGIN_TYPE ( PLUGIN_TYPE_INPUT_FILTER  )

This is an export plugin

RECORD_VALID ( value_syn_ok  )

Definition at line 108 of file flowmon-input-tcp.c.

RECORD_VALID ( value_win_ok  )

Definition at line 115 of file flowmon-input-tcp.c.

RECORD_CURRENT_LENGTH ( value_length  )

Definition at line 121 of file flowmon-input-tcp.c.

RECORD_FILLER ( value_fill_syn_size  )

Definition at line 125 of file flowmon-input-tcp.c.

RECORD_FILLER_TXT ( value_fill_syn_size_txt  )

Definition at line 132 of file flowmon-input-tcp.c.

RECORD_FILLER ( value_fill_win_size  )

Definition at line 139 of file flowmon-input-tcp.c.

RECORD_FILLER_TXT ( value_fill_win_size_txt  )

Definition at line 146 of file flowmon-input-tcp.c.

if ( retval)

Definition at line 157 of file flowmon-input-tcp.c.

getter_add ( getter_list  ,
"SYN_SIZE"  ,
sizeof(uint16_t)  ,
retval  ,
value_syn_ok,
value_length,
value_fill_syn_size,
value_fill_syn_size_txt 
)
getter_add ( getter_list  ,
"TCP_WIN_SIZE"  ,
sizeof(uint16_t)  ,
retval  ,
value_win_ok,
value_length,
value_fill_win_size,
value_fill_win_size_txt 
)
return ( retval  )
int32_t link_offset ( unsigned char *  data,
uint32_t  caplen 
)

Definition at line 169 of file flowmon-input-tcp.c.

if ( record->l4.  protocol = = 6 && (record->l4.tcp_flags & 0x02 ))

Definition at line 257 of file flowmon-input-tcp.c.

Variable Documentation

PLUGIN_INPUT_FILTER_DESC
Initial value:
{
return(&pcap_desc)

Definition at line 104 of file flowmon-input-tcp.c.

PLUGIN_INPUT_FILTER_INIT
Initial value:

Definition at line 153 of file flowmon-input-tcp.c.

retval = malloc(sizeof(plugin_private_t))

Definition at line 156 of file flowmon-input-tcp.c.

retval data_offset = data_offset

Definition at line 160 of file flowmon-input-tcp.c.

retval link_len = -1

Definition at line 161 of file flowmon-input-tcp.c.

PLUGIN_INPUT_FILTER_FILTER
Initial value:
{
plugin_private_t *p = plugin_private

Definition at line 251 of file flowmon-input-tcp.c.

plugin_record_t* r = PLUGIN_DATA(record, p->data_offset)

Definition at line 253 of file flowmon-input-tcp.c.

r syn_size = 0

Definition at line 254 of file flowmon-input-tcp.c.

r tcp_win_size = 0

Definition at line 255 of file flowmon-input-tcp.c.

return FLOW_FILTER_PASS

Definition at line 293 of file flowmon-input-tcp.c.

PLUGIN_INPUT_FILTER_SHUTDOWN
Initial value:
{
return(0)

Definition at line 296 of file flowmon-input-tcp.c.