Main Page | Modules | Class List | Directories | File List | Class Members | File Members | Related Pages

flow.c File Reference

FLOW and associated operations. More...

#include "flow.h"
#include "flow_stat.h"
#include "flow_print.h"
#include <stdlib.h>
#include <string.h>

Go to the source code of this file.

Functions

int flow_init (FLOW *flow, char protocol, u_int32_t init_address, u_int16_t init_port, u_int32_t resp_address, u_int16_t resp_port)
int flow_alloc (int family, FLOW **flow, int *size)
int flowkey_make (FLOWKEY *key, FLOWPACKET *p)
int flowkey_print (FLOWKEY *key)
int flowkey_normalize (FLOWKEY *dst, const FLOWKEY *src)
int flowkeycmp_fcn (const void *s1, const void *s2, size_t n)


Detailed Description

FLOW and associated operations.

Author:
Chris Green <cmg@sourcefire.com>
Date:
Thu May 29 15:38:05 2003

Definition in file flow.c.


Function Documentation

int flow_alloc int  family,
FLOW **  flow,
int *  size
 

Calloc a FLOW object of the right type -- this function is not needed

Parameters:
family address family
flow paramter to return the actual flow in
size # of bytes allocated for a new flow
Returns:
0 on sucess, else failure

Definition at line 59 of file flow.c.

References FLOW_ENOMEM, FLOW_ENULL, FLOW_SUCCESS, and NULL.

int flow_init FLOW flow,
char  protocol,
u_int32_t  init_address,
u_int16_t  init_port,
u_int32_t  resp_address,
u_int16_t  resp_port
 

have not done anything with the flow->data section yet

Definition at line 22 of file flow.c.

References FLOW_EINVALID, FLOW_ENULL, flow_printf(), FLOW_SUCCESS, flowstat_clear(), _FLOWKEY::init_address, _FLOWKEY::init_port, _FLOW::key, NULL, _FLOWKEY::protocol, _FLOWKEY::resp_address, _FLOWKEY::resp_port, and _FLOW::stats.

Referenced by flowcache_newflow().

int flowkey_make FLOWKEY key,
FLOWPACKET p
 

Given a packet, generate a key.

Todo:
ICMP errors on an existing flow
Parameters:
key where to set the key
p Packet to make a key from
Returns:
FLOW_SUCCESS on success, else failure

Definition at line 94 of file flow.c.

References FLOW_EINVALID, FLOW_ENULL, FLOW_SUCCESS, GetIPv4DstIp(), GetIPv4DstPort(), GetIPv4Proto(), GetIPv4SrcIp(), GetIPv4SrcPort(), _FLOWKEY::init_address, _FLOWKEY::init_port, IsIPv4Packet(), memset, _FLOWKEY::protocol, _FLOWKEY::resp_address, and _FLOWKEY::resp_port.

Referenced by FlowPreprocessor().

int flowkey_normalize FLOWKEY dst,
const FLOWKEY src
 

Copy into dst from src and normalize the results so that things will hash to the same entry no matter what.

This should only be used for SEARCHING as it doesn't store much else.

Parameters:
dst where to copy to
src where to copy from

Definition at line 153 of file flow.c.

References _FLOWKEY::init_address, _FLOWKEY::init_port, _FLOWKEY::protocol, _FLOWKEY::resp_address, and _FLOWKEY::resp_port.

Referenced by flowcache_find(), flowcache_newflow(), and flowcache_releaseflow().

int flowkey_print FLOWKEY key  ) 
 

print out a key to a file stream

Parameters:
key what to print
Returns:
0 on sucess

Definition at line 134 of file flow.c.

References flow_printf(), _FLOWKEY::init_address, _FLOWKEY::init_port, _FLOWKEY::protocol, _FLOWKEY::resp_address, and _FLOWKEY::resp_port.

Referenced by flow_callbacks(), FlowPreprocessor(), and flowps_newflow_callback().

int flowkeycmp_fcn const void *  s1,
const void *  s2,
size_t  n
 

perform key comparison

Parameters:
s1 pointer to A
s2 pointer to B
n size of each node
Returns:
0 if they are equal, else they aren't equal

Definition at line 186 of file flow.c.

References _FLOWKEY::init_address, _FLOWKEY::init_port, _FLOWKEY::protocol, _FLOWKEY::resp_address, and _FLOWKEY::resp_port.

Referenced by flowcache_init().


Generated on Sun May 14 14:51:24 2006 by  doxygen 1.4.2