Sequence Chart Studio  svn HEAD revision
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
PcapHandler Class Reference

#include <pcap_handler.h>

Collaboration diagram for PcapHandler:
Collaboration graph

Public Member Functions

 PcapHandler (PcapSettings *pcap_set)
 
 ~PcapHandler ()
 
bool msc_is_empty ()
 
MscPtr getMsc ()
 
void last_diagram_update ()
 
void diagram_update (int pckt_id, std::string src, std::string dst, std::string label, double timestamp=0, AggregData flow_data=AggregData())
 
void add_new_message (MessageEventPtr src_e, MessageEventPtr dst_e, std::string label, double timestamp=0, bool set_all_times=true)
 
num_inst_pair create_instance (std::string address)
 
num_inst_pair get_num_inst (std::string address)
 

Static Public Member Functions

static void packet_handler (u_char *param, const struct pcap_pkthdr *header, const u_char *pkt_data)
 
static std::string get_message_label (int packet_id, Packet *packet, std::string all_info, bool append_all_info)
 

Private Member Functions

bool create_aggr_event (AggrMessage msg_start)
 
bool create_aggr_message (AggrMessage msg_end)
 
bool create_relative_interval (EventPtr prev_e, EventPtr new_e, double time)
 

Private Attributes

std::map< std::string,
num_inst_pair
instance_map
 
u_short inst_count
 
BMscPtr msc
 
AggregHandleraggreg_handler
 
std::map< int, EventPtrevents_map
 
std::list< EventPtrabs_time_events
 

Static Private Attributes

static int packet_id
 
static PcapSettingssettings
 
static timeval zero_time
 

Detailed Description

The main class for handling packets obtained with exported fucnction pcap_loop() from <pcap.h> According to settings return generated BMSC

Definition at line 36 of file pcap_handler.h.

Constructor & Destructor Documentation

PcapHandler::PcapHandler ( PcapSettings pcap_set)
PcapHandler::~PcapHandler ( )

PcapHandler Destructor

Definition at line 41 of file pcap_handler.cpp.

References aggreg_handler.

Member Function Documentation

void PcapHandler::add_new_message ( MessageEventPtr  src_e,
MessageEventPtr  dst_e,
std::string  label,
double  timestamp = 0,
bool  set_all_times = true 
)
bool PcapHandler::create_aggr_event ( AggrMessage  msg_start)
private

Create event according to given AggrMessage - send event

Returns
true if the operation was succesfull, false otherwise

Definition at line 157 of file pcap_handler.cpp.

References abs_time_events, events_map, AggrMessage::ids, MscTimeIntervalSet< T >::insert(), AggrMessage::m_id, settings, PcapSettings::show_timestamps, MsgId::source_pair, and AggrMessage::time.

Referenced by diagram_update(), and last_diagram_update().

bool PcapHandler::create_aggr_message ( AggrMessage  msg_end)
private

Create message according to given AggrMessage - message and receive event

Returns
true if the operation was succesfull, false otherwise

Definition at line 185 of file pcap_handler.cpp.

References add_new_message(), MsgId::destin_pair, events_map, AggrMessage::ids, AggrMessage::label, AggrMessage::m_id, and AggrMessage::time.

Referenced by diagram_update(), and last_diagram_update().

num_inst_pair PcapHandler::create_instance ( std::string  address)

Create instance, which should be then added to BMSC

Definition at line 285 of file pcap_handler.cpp.

References inst_count, instance_map, msc, and TOWSTRING().

Referenced by diagram_update().

bool PcapHandler::create_relative_interval ( EventPtr  prev_e,
EventPtr  new_e,
double  time 
)
private

Create relative time interval between events

Returns
true if the operation was succesfull, false otherwise

Definition at line 137 of file pcap_handler.cpp.

References MscTimeIntervalSet< T >::get_set(), MscTimeIntervalSet< T >::insert(), PcapSettings::round_double(), and settings.

Referenced by add_new_message().

void PcapHandler::diagram_update ( int  pckt_id,
std::string  src,
std::string  dst,
std::string  label,
double  timestamp = 0,
AggregData  flow_data = AggregData() 
)
std::string PcapHandler::get_message_label ( int  packet_id,
Packet packet,
std::string  all_info,
bool  append_all_info 
)
static

Get label for message added to BMSC append all info param is used only if show_all_layers option is active –> If append == false, then it's used for previous parsed information

Definition at line 46 of file pcap_handler.cpp.

References PcapSettings::bytes_to_user_unit(), Ports::dst, Packet::get_data_size(), Packet::get_message(), Packet::get_ports(), Packet::get_upper_proto_name(), make_ports(), settings, ViewSettings::show_all_layers_info, ViewSettings::show_data_size, ViewSettings::show_packets_numbers, ViewSettings::show_ports, ViewSettings::show_upper_proto, Ports::src, and PcapSettings::view_settings.

Referenced by packet_handler().

num_inst_pair PcapHandler::get_num_inst ( std::string  address)

Get instance's number identifier, on accounf of name (IP or MAC address)

Definition at line 300 of file pcap_handler.cpp.

References instance_map.

Referenced by diagram_update().

MscPtr PcapHandler::getMsc ( )

Return null in case of no empty MSC, null otherwise

Definition at line 87 of file pcap_handler.cpp.

References msc.

Referenced by Pcap::load_msc().

void PcapHandler::last_diagram_update ( )
bool PcapHandler::msc_is_empty ( )

Check if generated MSC is empty

Definition at line 82 of file pcap_handler.cpp.

References inst_count.

Referenced by Pcap::load_msc().

void PcapHandler::packet_handler ( u_char param,
const struct pcap_pkthdr *  header,
const u_char pkt_data 
)
static

Member Data Documentation

std::list<EventPtr> PcapHandler::abs_time_events
private

Definition at line 52 of file pcap_handler.h.

Referenced by add_new_message(), create_aggr_event(), and last_diagram_update().

AggregHandler* PcapHandler::aggreg_handler
private

Definition at line 46 of file pcap_handler.h.

Referenced by diagram_update(), last_diagram_update(), PcapHandler(), and ~PcapHandler().

std::map<int,EventPtr> PcapHandler::events_map
private

Definition at line 49 of file pcap_handler.h.

Referenced by create_aggr_event(), and create_aggr_message().

u_short PcapHandler::inst_count
private

Definition at line 43 of file pcap_handler.h.

Referenced by create_instance(), msc_is_empty(), and PcapHandler().

std::map<std::string,num_inst_pair> PcapHandler::instance_map
private

Definition at line 42 of file pcap_handler.h.

Referenced by create_instance(), and get_num_inst().

BMscPtr PcapHandler::msc
private

Definition at line 45 of file pcap_handler.h.

Referenced by create_instance(), getMsc(), and PcapHandler().

int PcapHandler::packet_id
staticprivate

Definition at line 38 of file pcap_handler.h.

Referenced by packet_handler(), and PcapHandler().

PcapSettings * PcapHandler::settings
staticprivate
timeval PcapHandler::zero_time
staticprivate

Definition at line 40 of file pcap_handler.h.

Referenced by packet_handler(), and PcapHandler().


The documentation for this class was generated from the following files:

SourceForge.net Logo
Generated on Fri Jan 15 2016 16:26:59 for Sequence Chart Studio by  doxygen