engine/session.h File Reference

#include "../config.h"
#include "hlbr.h"

Go to the source code of this file.

Data Structures

struct  tcp_stream_piece
struct  tcp_stream
struct  port_pair
struct  ip_pair
struct  ip_bin
struct  session_func

Defines

#define IP_START   1
#define IP_GROW   1
#define PORT_START   5
#define PORT_GROW   10
#define SESSION_FORCE_TIMEOUT   60
#define SESSION_UNKNOWN   0
#define SESSION_IP1_SERVER   1
#define SESSION_IP2_SERVER   2
#define SESSION_IP1_SERVER_MAYBE   3
#define SESSION_IP2_SERVER_MAYBE   4
#define TCP_STATE_NEW   0
#define TCP_STATE_SYN   1
#define TCP_STATE_SYNACK   2
#define TCP_STATE_DATA   3
#define TCP_STATE_FIN   4
#define TCP_STATE_RESET   6
#define TCP_STATE_LATE   7
#define TCP_PAYLOAD_BUFFER_SIZE   4*1460
#define TCP_QUEUE_SIZE   16
#define TCP_PAYLOAD_PIECES_SIZE   1024

Typedefs

typedef port_pair PP
typedef ip_pair IPP
typedef ip_bin IPB
typedef session_func SFunc

Functions

int InitSession ()
int AddSessionCreateHandler (void(*Func)(PP *Port, void *Data), void *Data)
int AddSessionDestroyHandler (void(*Func)(PP *Port, void *Data), void *Data)
int AssignSessionTCP (int, void *)
int TCPRemount_unblock (int, int)


Define Documentation

#define IP_GROW   1

Definition at line 8 of file session.h.

Referenced by FindIPPair().

#define IP_START   1

Definition at line 7 of file session.h.

Referenced by FindIPPair().

#define PORT_GROW   10

Definition at line 10 of file session.h.

Referenced by FindPortPair().

#define PORT_START   5

Definition at line 9 of file session.h.

Referenced by FindPortPair().

#define SESSION_FORCE_TIMEOUT   60

Definition at line 13 of file session.h.

Referenced by TimeoutSessions().

#define SESSION_IP1_SERVER   1

Definition at line 17 of file session.h.

Referenced by AssignSessionTCP().

#define SESSION_IP1_SERVER_MAYBE   3

Definition at line 19 of file session.h.

#define SESSION_IP2_SERVER   2

Definition at line 18 of file session.h.

Referenced by AssignSessionTCP().

#define SESSION_IP2_SERVER_MAYBE   4

Definition at line 20 of file session.h.

#define SESSION_UNKNOWN   0

Definition at line 16 of file session.h.

#define TCP_PAYLOAD_BUFFER_SIZE   4*1460

Definition at line 34 of file session.h.

#define TCP_PAYLOAD_PIECES_SIZE   1024

Definition at line 36 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_QUEUE_SIZE   16

Definition at line 35 of file session.h.

#define TCP_STATE_DATA   3

Definition at line 26 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_STATE_FIN   4

Definition at line 27 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_STATE_LATE   7

Definition at line 29 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_STATE_NEW   0

Definition at line 23 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_STATE_RESET   6

Definition at line 28 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_STATE_SYN   1

Definition at line 24 of file session.h.

Referenced by AssignSessionTCP().

#define TCP_STATE_SYNACK   2

Definition at line 25 of file session.h.

Referenced by AssignSessionTCP().


Typedef Documentation

typedef struct ip_bin IPB

typedef struct ip_pair IPP

Struct that represents the two IPs in a session (?). The two IPs are supposed to be server/client IPs. This struct doesn't hold info about the actual session, only about the source/destination. Info about the session lies in the struct port_pair.

See also:
port_pair

typedef struct port_pair PP

Struct that represents the actual session. Holds the source/dest ports, a pointer to the ip_pair struct, and other info about the session (packet counts, connection state etc.)

See also:
ip_pair

typedef struct session_func SFunc


Function Documentation

int AddSessionCreateHandler ( void(*)(PP *Port, void *Data)  Func,
void *  Data 
)

Definition at line 46 of file session.c.

References CreateFuncs, session_func::Data, DEBUGPATH, session_func::Func, session_func::Next, and TRUE.

int AddSessionDestroyHandler ( void(*)(PP *Port, void *Data)  Func,
void *  Data 
)

Definition at line 74 of file session.c.

References session_func::Data, DEBUGPATH, DestroyFuncs, session_func::Func, session_func::Next, and TRUE.

int AssignSessionTCP ( int  PacketSlot,
void *  Data 
)

Find the session for this TCP packet. This function is called for every TCP packet; it searches for its corresponding session, updates the state of both streams (cli->srv and srv->cli), and remounts the payload of the packets of this same session, to apply checks upon the remounted buffer.

See also:
FindIPPair()

Definition at line 713 of file session.c.

References tcp_header::ack, tcp_header::ack_seq, BlockPacket(), port_pair::ClientAck, port_pair::ClientSeq, port_pair::ClientState, tcp_data::Data, tcp_data::DataLen, DBG, DBGDIR, DEBUGPATH, tcp_header::dest, port_pair::Direction, port_pair::Error, FALSE, tcp_header::fin, FindIPPair(), FindPortPair(), GetDataByID(), Globals, tcp_data::Header, IP_BYTES, IPDecoderID, tcp_stream::LastSeq, MALLOC, port_pair::noreassemble, NULL, tcp_stream::NumPieces, global_vars::Packets, tcp_stream_piece::PacketSlot, tcp_stream::Payloads, PAYLOADS_SIZE, tcp_stream_piece::piece_end, PIECE_SIZE, tcp_stream_piece::piece_start, tcp_stream::Pieces, PRINT, PRINT2, PRINTERROR, PRINTERROR4, PrintPacketSummary(), PRINTPKTERROR, PRINTSESERROR, tcp_header::rst, tcp_header::seq, port_pair::ServerAck, port_pair::ServerFin, port_pair::ServerSeq, port_pair::ServerState, SESSION_IP1_SERVER, SESSION_IP2_SERVER, tcp_header::source, packet_rec::Stream, port_pair::Stream0, port_pair::Stream1, tcp_header::syn, TCP_PAYLOAD_PIECES_SIZE, TCP_STATE_DATA, TCP_STATE_FIN, TCP_STATE_LATE, TCP_STATE_NEW, TCP_STATE_RESET, TCP_STATE_SYN, TCP_STATE_SYNACK, port_pair::TCPCount, TimeoutSessions(), tcp_stream::TopSeq, TRUE, packet_rec::tv, and UnblockPacket().

Referenced by DecodeTCP().

int InitSession (  ) 

Sets up the session handler. Global variable IPB holds info about all identified sessions.

See also:
ip_bin

ip_pair

port_pair

Definition at line 1077 of file session.c.

References CreateFuncs, DEBUGPATH, DestroyFuncs, GetDecoderByName(), IPDecoderID, NULL, Sessions, TCPDecoderID, TimeHead, and TRUE.

Referenced by main().

int TCPRemount_unblock ( int  ,
int   
)

Definition at line 1312 of file session.c.

Referenced by DropAction(), and ProcessPacket().


Generated on Sat Jul 7 23:33:10 2007 for HLBR by  doxygen 1.5.2