Main Page   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

rubicon_pcap.c File Reference

Get packets from a raw device via libpcap. More...

#include "../../main/inplug.h"
#include "../../main/packet.h"
#include "../../main/memory.h"

Go to the source code of this file.

Defines

#define DEBUG_PCAP   0

Functions

int pluginRegister (INPLUG **inp, ANPLUG **anp, PROTOPLUG **protop, OUTPLUG **outp, int(*DecodeCallback)(PACKET*,PROTO))
 Registration function. More...

int pluginInit (int ct, char **inits)
 Initialise the plugin. More...

int pluginCleanup (int reason)
 Cleanup the plugin. More...

int pluginGetPacket (int iSrc, char *sSrc, PACKET **p)
 Gets a packet. More...


Detailed Description

Get packets from a raw device via libpcap.

Definition in file rubicon_pcap.c.


Define Documentation

#define DEBUG_PCAP   0
 

Definition at line 16 of file rubicon_pcap.c.


Function Documentation

int pluginCleanup ( int reason )
 

Cleanup the plugin.

Parameters:
reason   (int) The reason for the cleanup.

This call should always be made before closing the program, or reinitialising the plugin. It frees all the memory allocated and still held internally (i.e. it doesn't free memory that it has a pointer to but has passed elsewhere). Additionally, files are closed etc.

Definition at line 91 of file rubicon_pcap.c.

int pluginGetPacket ( int iSrc,
char * sSrc,
PACKET ** p )
 

Gets a packet.

Parameters:
iSrc   (int) Integer representing which source to select from
sSrc   (char*) String stating which source to get the packet from
p   (PACKET**) Placeholder for the received packet.
Returns:
(int) 1 on success, 0 on failure (due to timeout), -1 on failure due to an error

This function retrieves a packet from whatever source. It must not block. The iSrc variable takes precedence over the sSrc when selecting the input source. If iSrc should be ignored, it's value must be set to -1.

Definition at line 118 of file rubicon_pcap.c.

int pluginInit ( int ct,
char ** inits )
 

Initialise the plugin.

Parameters:
ct   (int) Number of initialisation strings
inits   (char **) Array of ct initialisation strings

Definition at line 74 of file rubicon_pcap.c.

int pluginRegister ( INPLUG ** inp,
ANPLUG ** anp,
PROTOPLUG ** protop,
OUTPLUG ** outp,
int(* DecodeCallback)(PACKET *,PROTO) )
 

Registration function.

Parameters:
inp   (INPLUG**) Placeholder for input plugin descriptor
anp   (ANPLUG**) Placeholder for analysis plugin descriptor
protop   (PROTOPLUG**) Placeholder for protocol plugin descriptor
outp   (OUTPLUG**) Placeholder for output plugin descriptor
DecodeCallback   (function ptr) Pointer to generic decode function

This function is called by the main process in order to register the plugin. The function then populates the placeholders for the plugin types it supports, and sets all others to null. The DecodeCallback function is stored in case the plugin ever wants to decode anything.

Definition at line 39 of file rubicon_pcap.c.


Generated at Mon Jul 8 15:16:50 2002 for RUBICON by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000