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

xlink2state.c File Reference

#include <stdlib.h>
#include <string.h>
#include "generators.h"
#include "event_wrapper.h"
#include "event_queue.h"
#include "util.h"
#include "plugbase.h"
#include "parser.h"
#include "snort.h"
#include "inline.h"
#include "sfthreshold.h"
#include "debug.h"
#include "str_search.h"
#include "xlink2state.h"

Go to the source code of this file.

Defines

#define START_LIST   "{"
#define END_LIST   "}"
#define PORTS   "ports"
#define DISABLE   "disable"
#define INLINE_DROP   "drop"
#define CONF_SEPARATORS   " \t\n\r"
#define ERRSTRLEN   512

Functions

void XLINK2STATE_Init (void)
void XLINK2STATE_SessionFree (void *v)
static void XLINK2STATE_Setup (Packet *p)
static int IsServer (unsigned short port)
static char * safe_strchr (char *buf, char c, u_int len)
int ParseXLink2State (int id, u_int8_t *x)
int StrFound (void *id, int index, void *data)
static void XLINK2STATE_ProcessPacket (Packet *p)
void SnortXLINK2STATE (Packet *p)
static int PrintConfig (void)
static int ProcessPorts (char *ErrorString, int ErrStrLen)
void XLINK2STATE_ParseArgs (u_char *args)

Variables

XLINK2STATE_xlink
static u_int _xlink2state_ports [65535]
static u_int _xlink2state_disabled = 0
static u_int _xlink2state_drop = 0
static Packet_xlink2state_pkt = NULL


Define Documentation

#define CONF_SEPARATORS   " \t\n\r"
 

Definition at line 54 of file xlink2state.c.

#define DISABLE   "disable"
 

Definition at line 52 of file xlink2state.c.

Referenced by XLINK2STATE_ParseArgs().

#define END_LIST   "}"
 

Definition at line 50 of file xlink2state.c.

#define ERRSTRLEN   512
 

Definition at line 56 of file xlink2state.c.

#define INLINE_DROP   "drop"
 

Definition at line 53 of file xlink2state.c.

Referenced by XLINK2STATE_ParseArgs().

#define PORTS   "ports"
 

Definition at line 51 of file xlink2state.c.

#define START_LIST   "{"
 

Definition at line 49 of file xlink2state.c.


Function Documentation

static int IsServer unsigned short  port  )  [static]
 

Definition at line 136 of file xlink2state.c.

References _xlink2state_ports.

int ParseXLink2State int  id,
u_int8_t x
 

Definition at line 164 of file xlink2state.c.

References _xlink2state_drop, _XLINK2STATE::alerted, _Packet::data, _Packet::dsize, GENERATOR_SMTP, InlineDrop(), InlineMode(), _IPHdr::ip_dst, _IPHdr::ip_src, _Packet::iph, _XLINK2STATE::length, _Packet::packet_flags, PKT_INLINE_DROP, _Packet::pkth, safe_strchr(), sfthreshold_test(), SnortEventqAdd(), and pcap_pkthdr::ts.

Referenced by StrFound().

static int PrintConfig void   )  [static]
 

Definition at line 337 of file xlink2state.c.

References _xlink2state_drop, _xlink2state_ports, InlineMode(), LogMessage(), memset, sfsnprintfappend(), snprintf, and STD_BUF.

static int ProcessPorts char *  ErrorString,
int  ErrStrLen
[static]
 

Definition at line 380 of file xlink2state.c.

References _xlink2state_ports, CONF_SEPARATORS, END_LIST, NULL, PORTS, SMTP_DEFAULT_SERVER_PORT, snprintf, START_LIST, and strtol().

static char* safe_strchr char *  buf,
char  c,
u_int  len
[static]
 

Definition at line 146 of file xlink2state.c.

References NULL.

Referenced by ParseXLink2State().

void SnortXLINK2STATE Packet p  ) 
 

Definition at line 305 of file xlink2state.c.

References _xlink2state_disabled, DEBUG_PLUGIN, DEBUG_WRAP, _Packet::dp, _Packet::dsize, IsServer(), _Packet::packet_flags, PKT_STREAM_INSERT, XLINK2STATE_ProcessPacket(), and XLINK2STATE_Setup().

Referenced by XLINK2STATEDetect().

int StrFound void *  id,
int  index,
void *  data
 

Definition at line 246 of file xlink2state.c.

References int(), and ParseXLink2State().

Referenced by XLINK2STATE_ProcessPacket().

void XLINK2STATE_Init void   ) 
 

Definition at line 65 of file xlink2state.c.

References SearchAdd(), SearchInit(), and SearchPrepPatterns().

Referenced by XLINK2STATEInit().

void XLINK2STATE_ParseArgs u_char *  args  ) 
 

Definition at line 466 of file xlink2state.c.

References _xlink2state_disabled, _xlink2state_drop, _xlink2state_ports, CONF_SEPARATORS, DISABLE, ERRSTRLEN, FatalError(), file_line, file_name, INLINE_DROP, InlineMode(), LogMessage(), NULL, PORTS, PrintConfig(), ProcessPorts(), SMTP_DEFAULT_SERVER_PORT, and strcasecmp.

Referenced by XLINK2STATEInit().

static void XLINK2STATE_ProcessPacket Packet p  )  [static]
 

Definition at line 265 of file xlink2state.c.

References _xlink2state_drop, _XLINK2STATE::alerted, _Packet::data, _Packet::dsize, InlineDrop(), InlineMode(), NULL, _Packet::packet_flags, PKT_INLINE_DROP, _Session::preproc_data, SearchFindString(), _Packet::ssnptr, and StrFound().

Referenced by SnortXLINK2STATE().

void XLINK2STATE_SessionFree void *  v  ) 
 

Definition at line 87 of file xlink2state.c.

Referenced by XLINK2STATE_Setup().

static void XLINK2STATE_Setup Packet p  )  [static]
 

Definition at line 104 of file xlink2state.c.

References FatalError(), file_line, file_name, memset, NULL, _Session::preproc_data, _Session::preproc_free, _Packet::ssnptr, and XLINK2STATE_SessionFree().

Referenced by SnortXLINK2STATE().


Variable Documentation

XLINK2STATE* _xlink
 

Definition at line 40 of file xlink2state.c.

u_int _xlink2state_disabled = 0 [static]
 

Definition at line 42 of file xlink2state.c.

Referenced by SnortXLINK2STATE(), and XLINK2STATE_ParseArgs().

u_int _xlink2state_drop = 0 [static]
 

Definition at line 43 of file xlink2state.c.

Referenced by ParseXLink2State(), PrintConfig(), XLINK2STATE_ParseArgs(), and XLINK2STATE_ProcessPacket().

Packet* _xlink2state_pkt = NULL [static]
 

Definition at line 44 of file xlink2state.c.

u_int _xlink2state_ports[65535] [static]
 

Definition at line 41 of file xlink2state.c.

Referenced by IsServer(), PrintConfig(), ProcessPorts(), and XLINK2STATE_ParseArgs().


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