|
From: <xb...@us...> - 2013-05-16 15:47:52
|
Revision: 1756
http://sourceforge.net/p/scstudio/code/1756
Author: xborza
Date: 2013-05-16 15:47:49 +0000 (Thu, 16 May 2013)
Log Message:
-----------
ImportFormatter - argument config_file in load_msc
- pcap headers
Modified Paths:
--------------
trunk/src/data/Z120/z120.h
trunk/src/data/Z120/z120_load.cpp
trunk/src/data/engmann/engmann.cpp
trunk/src/data/engmann/engmann.h
trunk/src/data/formatter.h
trunk/src/data/mscgen/mscgen.h
trunk/src/data/mscgen/mscgen_load.cpp
trunk/src/data/pcap/aggreg_handler.cpp
trunk/src/data/pcap/aggreg_handler.h
trunk/src/data/pcap/aggregation_formats.cpp
trunk/src/data/pcap/aggregation_formats.h
trunk/src/data/pcap/application_layer.cpp
trunk/src/data/pcap/application_layer.h
trunk/src/data/pcap/data_link_layer.cpp
trunk/src/data/pcap/data_link_layer.h
trunk/src/data/pcap/export.h
trunk/src/data/pcap/module.cpp
trunk/src/data/pcap/network_layer.cpp
trunk/src/data/pcap/network_layer.h
trunk/src/data/pcap/packet.cpp
trunk/src/data/pcap/packet.h
trunk/src/data/pcap/pcap_handler.cpp
trunk/src/data/pcap/pcap_handler.h
trunk/src/data/pcap/pcap_load.cpp
trunk/src/data/pcap/pcap_load.h
trunk/src/data/pcap/pcap_settings.cpp
trunk/src/data/pcap/pcap_settings.h
trunk/src/data/pcap/protocols.h
trunk/src/data/pcap/transport_layer.cpp
trunk/src/data/pcap/transport_layer.h
trunk/src/scstudio.cpp
trunk/src/view/visio/addon/pcapSettingADlg.cpp
trunk/src/view/visio/addon/pcapSettingADlg.h
trunk/src/view/visio/addon/pcapSettingAggregDlg.cpp
trunk/src/view/visio/addon/pcapSettingAggregDlg.h
trunk/src/view/visio/addon/pcapSettingGDlg.cpp
trunk/src/view/visio/addon/pcapSettingGDlg.h
trunk/src/view/visio/addon/pcapSettingViewDlg.cpp
trunk/src/view/visio/addon/pcapSettingViewDlg.h
trunk/tests/pcap/pcap_test.cpp
Modified: trunk/src/data/Z120/z120.h
===================================================================
--- trunk/src/data/Z120/z120.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/Z120/z120.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -58,7 +58,7 @@
#ifdef HAVE_ANTLR
//! import MSC document
- virtual std::vector<MscPtr> load_msc(const std::string &filename);
+ virtual std::vector<MscPtr> load_msc(const std::string &filename, const std::string &config_name = "");
//! Returns a list of transformation for this format.
virtual TransformationList get_transformations(MscPtr msc) const;
#endif
Modified: trunk/src/data/Z120/z120_load.cpp
===================================================================
--- trunk/src/data/Z120/z120_load.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/Z120/z120_load.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -21,7 +21,7 @@
#include "Z120Lexer.h"
#include "Z120Parser.h"
-std::vector<MscPtr> Z120::load_msc(const std::string &filename)
+std::vector<MscPtr> Z120::load_msc(const std::string &filename, const std::string &config_file)
{
std::vector<MscPtr> result;
Modified: trunk/src/data/engmann/engmann.cpp
===================================================================
--- trunk/src/data/engmann/engmann.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/engmann/engmann.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -138,7 +138,7 @@
return pos->second;
}
-std::vector<MscPtr> Engmann::load_msc(const std::string &filename)
+std::vector<MscPtr> Engmann::load_msc(const std::string &filename, const std::string &config_file)
{
std::vector<MscPtr> result;
Modified: trunk/src/data/engmann/engmann.h
===================================================================
--- trunk/src/data/engmann/engmann.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/engmann/engmann.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -34,7 +34,7 @@
{ return "Engmann Message Chart"; }
//! import MSC document
- virtual std::vector<MscPtr> load_msc(const std::string &filename);
+ virtual std::vector<MscPtr> load_msc(const std::string &filename, const std::string &config_file = "");
//! Returns a list of transformation for this format.
virtual TransformationList get_transformations(MscPtr msc) const;
Modified: trunk/src/data/formatter.h
===================================================================
--- trunk/src/data/formatter.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/formatter.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -50,7 +50,7 @@
virtual ~ImportFormatter() {}
//! import MSC document
- virtual std::vector<MscPtr> load_msc(const std::string &filename) = 0;
+ virtual std::vector<MscPtr> load_msc(const std::string &filename, const std::string &config_file = "") = 0;
//! List of transformations that must be performed after the import.
typedef std::vector<std::wstring> TransformationList;
Modified: trunk/src/data/mscgen/mscgen.h
===================================================================
--- trunk/src/data/mscgen/mscgen.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/mscgen/mscgen.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -57,7 +57,7 @@
#ifdef HAVE_ANTLR
//! import MSC document
- virtual std::vector<MscPtr> load_msc(const std::string &filename);
+ virtual std::vector<MscPtr> load_msc(const std::string &filename, const std::string &config_file = "");
//! Returns a list of transformation for this format.
virtual TransformationList get_transformations(MscPtr msc) const;
#endif
Modified: trunk/src/data/mscgen/mscgen_load.cpp
===================================================================
--- trunk/src/data/mscgen/mscgen_load.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/mscgen/mscgen_load.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -21,7 +21,7 @@
#include "MscgenLexer.h"
#include "MscgenParser.h"
-std::vector<MscPtr> Mscgen::load_msc(const std::string &filename)
+std::vector<MscPtr> Mscgen::load_msc(const std::string &filename,const std::string &config_file)
{
std::vector<MscPtr> result;
Modified: trunk/src/data/pcap/aggreg_handler.cpp
===================================================================
--- trunk/src/data/pcap/aggreg_handler.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/aggreg_handler.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "aggreg_handler.h"
AggregHandler::AggregHandler(PcapSettings* p_settings)
Modified: trunk/src/data/pcap/aggreg_handler.h
===================================================================
--- trunk/src/data/pcap/aggreg_handler.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/aggreg_handler.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef AGGREGATION_INCLUDED
#define AGGREGATION_INCLUDED
Modified: trunk/src/data/pcap/aggregation_formats.cpp
===================================================================
--- trunk/src/data/pcap/aggregation_formats.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/aggregation_formats.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "aggregation_formats.h"
AggregData get_aggregd_for_aggreg(PcapSettings* settings,Packet* packet,AggrLevel packet_level) // MAX TRANSPORT_LAYER PARSE
Modified: trunk/src/data/pcap/aggregation_formats.h
===================================================================
--- trunk/src/data/pcap/aggregation_formats.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/aggregation_formats.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef AGGREGATION_FORMATS_INCLUDED
#define AGGREGATION_FORMATS_INCLUDED
Modified: trunk/src/data/pcap/application_layer.cpp
===================================================================
--- trunk/src/data/pcap/application_layer.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/application_layer.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "application_layer.h"
/*-------------------------------------------------DNS --------------------------------------------------*/
Modified: trunk/src/data/pcap/application_layer.h
===================================================================
--- trunk/src/data/pcap/application_layer.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/application_layer.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef APPLICATION_LAYER_INCLUDED
#define APPLICATION_LAYER_INCLUDED
Modified: trunk/src/data/pcap/data_link_layer.cpp
===================================================================
--- trunk/src/data/pcap/data_link_layer.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/data_link_layer.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "data_link_layer.h"
EthernetPacket::EthernetPacket(const u_char* data,u_short data_size)
Modified: trunk/src/data/pcap/data_link_layer.h
===================================================================
--- trunk/src/data/pcap/data_link_layer.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/data_link_layer.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,20 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
+
#ifndef DATA_LINK_LAYER_INCLUDED
#define DATA_LINK_LAYER_INCLUDED
Modified: trunk/src/data/pcap/export.h
===================================================================
--- trunk/src/data/pcap/export.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/export.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
- *
- * $Id$
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*/
#ifndef _SCPCAP_EXPORT_H
Modified: trunk/src/data/pcap/module.cpp
===================================================================
--- trunk/src/data/pcap/module.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/module.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
- *
- * $Id$
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*/
#include "data/pcap/pcap_load.h"
Modified: trunk/src/data/pcap/network_layer.cpp
===================================================================
--- trunk/src/data/pcap/network_layer.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/network_layer.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "network_layer.h"
/* ----------------------------------------------------Ipv4--------------------------------------------------------*/
Modified: trunk/src/data/pcap/network_layer.h
===================================================================
--- trunk/src/data/pcap/network_layer.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/network_layer.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef NETWORK_LAYER_INCLUDED
#define NETWORK_LAYER_INCLUDED
Modified: trunk/src/data/pcap/packet.cpp
===================================================================
--- trunk/src/data/pcap/packet.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/packet.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "packet.h"
std::string get_host(u_char* host,u_short len)
Modified: trunk/src/data/pcap/packet.h
===================================================================
--- trunk/src/data/pcap/packet.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/packet.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef PACKET_INCLUDED
#define PACKET_INCLUDED
Modified: trunk/src/data/pcap/pcap_handler.cpp
===================================================================
--- trunk/src/data/pcap/pcap_handler.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/pcap_handler.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "pcap_handler.h"
PcapSettings* PcapHandler::settings;
@@ -10,16 +26,13 @@
inst_count = 0;
packet_id = 0;
- settings = parse_set;
+ this->aggreg_handler = NULL;
+ this->settings = parse_set;
if(settings->flow_settings->apply_aggreg)
{
this->aggreg_handler = new AggregHandler(parse_set);
}
- else
- {
- this->aggreg_handler = NULL;
- }
zero_time.tv_sec = 0;
zero_time.tv_usec = 0;
Modified: trunk/src/data/pcap/pcap_handler.h
===================================================================
--- trunk/src/data/pcap/pcap_handler.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/pcap_handler.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef PCAP_HANDLER_INCLUDED
#define PCAP_HANDLER_INCLUDED
Modified: trunk/src/data/pcap/pcap_load.cpp
===================================================================
--- trunk/src/data/pcap/pcap_load.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/pcap_load.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,30 +11,95 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
- *
- * $Id$
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*/
// include pcap library
-// under Windows WinPcap Developer's Pack http://www.winpcap.org/devel.htm
+// under Windows WinPcap Developer's Pack http://www.winpcap.org
// under UN*X libpcap http://www.tcpdump.org
#include "pcap_load.h"
#include "pcap_settings.h"
+#include <boost/lexical_cast.hpp>
+#include <boost/property_tree/ptree.hpp>
+#include <boost/property_tree/ini_parser.hpp>
#include <pcap.h>
-std::vector<MscPtr> Pcap::load_msc(const std::string &filename)
+PcapSettings* Pcap::load_configuration(const std::string &filename)
{
- PcapSettings* settings = new PcapSettings(this->get_config_provider());
- settings->load_registry();
+ PcapSettings* settings = new PcapSettings();
+ boost::property_tree::ptree pt;
+ boost::property_tree::ini_parser::read_ini(filename, pt);
+ // read general settings
+ settings->pcap_filter = pt.get<std::string>("GeneralSettings.PcapFilter");
+ settings->parse_layer = (ParseLayer)pt.get<int>("GeneralSettings.ParseLayer");
+ settings->show_timestamps = pt.get<bool>("GeneralSettings.ShowTimestamps");
+ settings->time_format = (TimeFormat)pt.get<int>("GeneralSettings.TimeFormat");
+ settings->time_unit = pt.get<int>("GeneralSettings.TimeUnit");
+ settings->data_unit = pt.get<int>("GeneralSettings.DataUnit");
+
+ // read view settings
+ ViewSettings* view_set = new ViewSettings();
+ view_set->show_all_layers_info = pt.get<bool>("ViewSettings.AllLayersInfo");
+ view_set->ignore_packets = pt.get<bool>("ViewSettings.IgnorePackets");
+ view_set->show_data_size = pt.get<bool>("ViewSettings.DataSize");
+ view_set->show_packets_numbers = pt.get<bool>("ViewSettings.PacketNumber");
+ view_set->show_upper_proto = pt.get<bool>("ViewSettings.EncapsulatedProto");
+ view_set->show_ports = pt.get<bool>("ViewSettings.Ports");
+ settings->view_settings = view_set;
+
+ // read advanced settings
+ TcpSettings* tcp_set = new TcpSettings();
+ tcp_set->show_flags = pt.get<bool>("TcpSettings.Flags");
+ tcp_set->show_seqack = pt.get<bool>("TcpSettings.SeqAckNumbers");
+ tcp_set->show_segments = pt.get<bool>("TcpSettings.Segments");
+ tcp_set->reassembly = pt.get<bool>("TcpSettings.Reassemble");
- return load_msc(filename,settings);
+ HttpSettings* http_set = new HttpSettings();
+ http_set->show_version = pt.get<bool>("HttpSettings.Version");
+ http_set->show_packet_part = pt.get<bool>("HttpSettings.PacketPart");
+ http_set->reassembly = pt.get<bool>("HttpSettings.Reassemble");
+
+ SipSettings* sip_set = new SipSettings();
+ sip_set->show_version = pt.get<bool>("SipSettings.Version");
+ sip_set->show_from_to = pt.get<bool>("SipSettings.FromTo");
+ sip_set->show_only_nick_names = pt.get<bool>("SipSettings.OnlyNicknames");
+ sip_set->show_specification = pt.get<bool>("SipSettings.StatusDescript");
+ sip_set->reassembly = pt.get<bool>("SipSettings.ReassembleRTP");
+
+ AdvancedSettings* adv_set = new AdvancedSettings(http_set,sip_set,tcp_set);
+ settings->adv_settings = adv_set;
+
+ // read aggregation settings
+ AggregSettings* agg_set = new AggregSettings();
+ agg_set->apply_aggreg = pt.get<bool>("AggregSettings.ApplyAggregation");
+ agg_set->level = (AggrLevel)pt.get<int>("AggregSettings.AggregLevel");
+ agg_set->type = (AggregType)pt.get<int>("AggregSettings.AggregType");
+ agg_set->time_interval = pt.get<double>("AggregSettings.TimeInterval");
+ agg_set->ignore_packets = pt.get<bool>("AggregSettings.IgnorePackets");
+ //redefine by aggregation dialog
+ agg_set->show_data_size = pt.get<bool>("AggregSettings.DataSize");
+ agg_set->show_packet_count = pt.get<bool>("AggregSettings.PacketCount");
+ settings->flow_settings = agg_set;
+
+ return settings;
}
-std::vector<MscPtr> Pcap::load_msc(const std::string &filename,PcapSettings* settings)
+
+std::vector<MscPtr> Pcap::load_msc(const std::string &filename,const std::string &config_file)
{
- std::string filter = "Pcap filter:";
+ PcapSettings* settings = NULL;
+ if(config_file == "")
+ {
+ settings = new PcapSettings(this->get_config_provider());
+ settings->load_registry();
+ }
+ else
+ {
+ settings = load_configuration(config_file);
+ }
+
+ std::string filter = "Pcap filter:";
filter.append(settings->pcap_filter);
this->print_report(RS_REPORT, TOWSTRING(filter));
@@ -80,33 +145,31 @@
return result;
}
- //----------------------------------------------------------
- PcapHandler* pcapHandler = new PcapHandler(settings);
- //----------------------------------------------------------
+ PcapHandler* pcapHandler = new PcapHandler(settings);
+
handStruct hands;
- hands.pcap = pcapHandler;
+ hands.pcap = pcapHandler;
hands.handle = adhandle;
- pcap_loop(adhandle, 0, PcapHandler::packet_handler, (u_char*)&hands);
+ pcap_loop(adhandle, 0, PcapHandler::packet_handler, (u_char*)&hands);
// for aggregation buffer flush
hands.pcap->last_diagram_update();
// handle empty msc
if(hands.pcap->msc_is_empty())
{
- print_report(RS_ERROR,stringize() << "No packet passed through defined settings.");
+ print_report(RS_ERROR,stringize() << "No packet from PCAP file passeed through defined settings.");
}
else
{
result.push_back(hands.pcap->getMsc());
}
-
- pcap_freecode(&fcode);
- pcap_close(adhandle);
-
- delete settings;
- delete pcapHandler;
- return result;
+
+ delete pcapHandler;
+ delete settings;
+ pcap_freecode(&fcode);
+ pcap_close(adhandle);
+ return result;
}
ImportFormatter::TransformationList Pcap::get_transformations(MscPtr msc) const
Modified: trunk/src/data/pcap/pcap_load.h
===================================================================
--- trunk/src/data/pcap/pcap_load.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/pcap_load.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,7 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
- *
- * $Id$
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*/
#ifndef _SCPCAP_PCAP_IMPORT_H_
@@ -44,6 +42,9 @@
class SCPCAP_EXPORT Pcap : public Formatter, public ImportFormatter
{
+private:
+ PcapSettings* load_configuration(const std::string &filename);
+
public:
//! file extension used to distinguish this format
// note: DLL in Windows cannot return pointers to static data
@@ -54,8 +55,8 @@
{ return "Wireshark (libpcap) packet trace"; }
//! import MSC document
- virtual std::vector<MscPtr> load_msc(const std::string &filename);
- virtual std::vector<MscPtr> load_msc(const std::string &filename,PcapSettings* settings);
+ virtual std::vector<MscPtr> load_msc(const std::string &filename, const std::string &config_file ="");
+
//! Returns a list of transformation for this format.
virtual TransformationList get_transformations(MscPtr msc) const;
};
Modified: trunk/src/data/pcap/pcap_settings.cpp
===================================================================
--- trunk/src/data/pcap/pcap_settings.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/pcap_settings.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "pcap_settings.h"
double round(double num, int prec)
@@ -167,8 +183,6 @@
if(get_config_long(L"Pcap", L"AggPorts", 0) != 0)
flow_settings->level = PORT_AGGR;
-
- flow_settings->show_data_size = (get_config_long(L"Pcap", L"AggDataSize", 0) != 0);
//AggrLevel
if(get_config_long(L"Pcap", L"LstPackets", 1) != 0)
@@ -186,8 +200,10 @@
if(get_config_long(L"Pcap", L"IntPackets", 0) != 0)
flow_settings->type = TIME_AGGR;
- flow_settings->show_data_size = get_config_long(L"Pcap", L"DataSize", 0) != 0;
+
+ flow_settings->show_data_size = (get_config_long(L"Pcap", L"AggDataSize", 0) != 0);
flow_settings->show_packet_count = get_config_long(L"Pcap", L"PacketsCount", 1) != 0;
+
flow_settings->ignore_packets = get_config_long(L"Pcap", L"IgnorePack", 0) != 0;
flow_settings->time_interval = (float)get_config_float(L"Pcap", L"IntervalSize", 10.0);
Modified: trunk/src/data/pcap/pcap_settings.h
===================================================================
--- trunk/src/data/pcap/pcap_settings.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/pcap_settings.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef PCAP_SETTINGS_INCLUDED
#define PCAP_SETTINGS_INCLUDED
Modified: trunk/src/data/pcap/protocols.h
===================================================================
--- trunk/src/data/pcap/protocols.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/protocols.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef PROTOCOLS_INCLUDED
#define PROTOCOLS_INCLUDED
Modified: trunk/src/data/pcap/transport_layer.cpp
===================================================================
--- trunk/src/data/pcap/transport_layer.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/transport_layer.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#include "transport_layer.h"
/*------------------------------------------------TCP---------------------------------------------------*/
std::map<Ports,SeqItem> TcpPacket::seq_map;
Modified: trunk/src/data/pcap/transport_layer.h
===================================================================
--- trunk/src/data/pcap/transport_layer.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/data/pcap/transport_layer.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -1,3 +1,19 @@
+/*
+ * scstudio - Sequence Chart Studio
+ * http://scstudio.sourceforge.net
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
+ */
+
#ifndef TRANSPORT_LAYER_INCLUDED
#define TRANSPORT_LAYER_INCLUDED
Modified: trunk/src/scstudio.cpp
===================================================================
--- trunk/src/scstudio.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/scstudio.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -22,7 +22,6 @@
#include <string>
#include <list>
-
#include "data/Z120/z120.h"
#include "data/formatter.h"
#include "data/checker.h"
@@ -167,6 +166,8 @@
int export_tex(const char* input_msc);
+int import_pcap(const char* input_pcap, const char* config_file);
+
/**
* The main function of the SCStudio command-line interface.
* See the print_usage() function for more info.
@@ -227,6 +228,16 @@
}
}
+ if (stricmp("ImportPcap", argv[1]) == 0) {
+ if (argc == 4) {
+ return import_pcap(argv[2],argv[3]);
+ }
+ else {
+ print_usage();
+ return 4;
+ }
+ }
+
// just a checker is to be run by now
if (argc != 3) {
print_usage();
@@ -290,6 +301,9 @@
<< std::endl
<< " " << PRG_NAME << " ExportTex <mscfile>" << std::endl
<< " produces a LaTeX source code to draw MSC in given file" << std::endl
+ << std::endl
+ << " " << PRG_NAME << " ImportPcap <pcapfile[*.cap,*.pcap]> <configuration [*.ini]>" << std::endl
+ << " produces a MSC in Z.120 Textual form" << std::endl
<< std::endl
<< "INPUT FILES" << std::endl
<< " All input MSC files are expected in the textual representation of the ITU-T Z.120." << std::endl
@@ -409,6 +423,39 @@
return result;
}
+std::vector<MscPtr> run_importFormatter(const FInitFormatters& init_formatters, const std::string& property, const std::string &name, const std::string &config_name = "")
+{
+ boost::shared_ptr<ImportFormatter> formatter;
+
+ Formatter **formatters = init_formatters();
+ for(Formatter **fpos = formatters; *fpos != NULL; fpos++)
+ {
+ if((*fpos)->get_description() == property)
+ {
+ formatter = boost::dynamic_pointer_cast<ImportFormatter>(boost::shared_ptr<Formatter>(*fpos));
+ // note: no break here as we have to delete the remaining pointers
+ }
+// else
+// delete *fpos;
+ }
+ delete[] formatters; //FIXME double close
+
+ if(formatter == NULL)
+ {
+ throw std::logic_error("could not find transformer");
+ }
+
+ std::vector<MscPtr> result;
+
+ if(property == "Wireshark (libpcap) packet trace"){
+ result = formatter->load_msc(name,config_name);
+ }
+ else{
+ result = formatter->load_msc(name);
+ }
+ return result;
+}
+
int call_tighten_time(const char* msc_file)
{ //FIXME catch precondition failure and report it to user //FIXME dlclose
std::cerr << "tighten time on " << msc_file << std::endl;
@@ -1176,3 +1223,55 @@
LIBRARY_CLOSE(beautifyModule);
return result;
}
+
+
+int import_pcap(const char* input_pcap, const char* config_file) {
+
+ std::cerr << "Import PCAP on " << input_pcap << std::endl;
+
+ Z120 z120;
+
+ StreamReportPrinter printer(std::wcerr);
+ z120.set_printer(&printer);
+
+ std::vector<MscPtr> msc;
+
+ const char* library= ADD_LIB_PREF_SUFF("scpcap");
+#ifdef WIN32
+ HINSTANCE module = LoadLibrary(library);
+#else
+ void *module = dlopen(library, RTLD_LAZY);
+#endif
+ if(module == NULL)
+ {
+ std::wcerr << "ERROR: Cannot open " << library << std::endl;
+ return 7;
+ }
+
+ // note: this is a nasty hack to avoid the gcc warning:
+ // ISO C++ forbids casting between pointer-to-function and pointer-to-object
+ union
+ {
+ void *pointer;
+ FInitFormatters function;
+ } init_formatters;
+
+ init_formatters.pointer = LIBRARY_SYMBOL(module, "init_formatters");
+
+ msc = run_importFormatter(init_formatters.function, "Wireshark (libpcap) packet trace", input_pcap, config_file);
+ int result = 0;
+
+ if(!msc.empty())
+ {
+ try
+ {
+ result = z120.save_msc(std::cout, TOWSTRING(input_pcap), msc[0], msc);
+ }
+ catch(std::exception& exc)
+ {
+ std::cerr << "EXCEPTION: Cannot save the document: " << exc.what() << std::endl;
+ }
+ }
+
+ return 0;
+}
Modified: trunk/src/view/visio/addon/pcapSettingADlg.cpp
===================================================================
--- trunk/src/view/visio/addon/pcapSettingADlg.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingADlg.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2010 Milan Malota <xm...@gm...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.cpp 1111 2011-06-29 10:13:46Z xmalota $
*/
#include "stdafx.h"
Modified: trunk/src/view/visio/addon/pcapSettingADlg.h
===================================================================
--- trunk/src/view/visio/addon/pcapSettingADlg.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingADlg.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.h 1111 2011-06-29 10:13:46Z xmalota $
*/
#pragma once
Modified: trunk/src/view/visio/addon/pcapSettingAggregDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/pcapSettingAggregDlg.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingAggregDlg.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2010 Milan Malota <xm...@gm...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.cpp 1111 2011-06-29 10:13:46Z xmalota $
*/
#include "stdafx.h"
Modified: trunk/src/view/visio/addon/pcapSettingAggregDlg.h
===================================================================
--- trunk/src/view/visio/addon/pcapSettingAggregDlg.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingAggregDlg.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.h 1111 2011-06-29 10:13:46Z xmalota $
*/
#pragma once
Modified: trunk/src/view/visio/addon/pcapSettingGDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/pcapSettingGDlg.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingGDlg.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2010 Milan Malota <xm...@gm...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.cpp 1111 2011-06-29 10:13:46Z xmalota $
*/
#include "stdafx.h"
Modified: trunk/src/view/visio/addon/pcapSettingGDlg.h
===================================================================
--- trunk/src/view/visio/addon/pcapSettingGDlg.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingGDlg.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.h 1111 2011-06-29 10:13:46Z xmalota $
*/
#pragma once
Modified: trunk/src/view/visio/addon/pcapSettingViewDlg.cpp
===================================================================
--- trunk/src/view/visio/addon/pcapSettingViewDlg.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingViewDlg.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2010 Viktor Borza <vic...@gm...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.cpp 1111 2011-06-29 10:13:46Z xborza $
*/
#include "stdafx.h"
Modified: trunk/src/view/visio/addon/pcapSettingViewDlg.h
===================================================================
--- trunk/src/view/visio/addon/pcapSettingViewDlg.h 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/src/view/visio/addon/pcapSettingViewDlg.h 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,9 +11,8 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*
- * $Id: beautifySettingGDlg.h 1111 2011-06-29 10:13:46Z xmalota $
*/
#pragma once
Modified: trunk/tests/pcap/pcap_test.cpp
===================================================================
--- trunk/tests/pcap/pcap_test.cpp 2013-05-16 12:52:11 UTC (rev 1755)
+++ trunk/tests/pcap/pcap_test.cpp 2013-05-16 15:47:49 UTC (rev 1756)
@@ -11,18 +11,15 @@
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
- * Copyright (c) 2009 Petr Gotthard <pet...@ce...>
- *
- * $Id: z120_test.cpp 1274 2012-01-10 15:49:30Z lkorenciak $
+ * Copyright (c) 2012 Viktor Borza <bo...@ma...>
*/
+
#define _WINSOCKAPI_
#include <string.h>
#include <iostream>
#include <fstream>
#include <boost/lexical_cast.hpp>
-#include <boost/property_tree/ptree.hpp>
-#include <boost/property_tree/ini_parser.hpp>
#include "data/Z120/z120.h"
#include "data/pcap/pcap_load.h"
@@ -46,70 +43,11 @@
return last_name;
}
-PcapSettings* get_settings(const std::string &filename)
-{
- PcapSettings* settings = new PcapSettings();
- boost::property_tree::ptree pt;
- boost::property_tree::ini_parser::read_ini(filename, pt);
- // read general settings
- settings->pcap_filter = pt.get<std::string>("GeneralSettings.PcapFilter");
- settings->parse_layer = (ParseLayer)pt.get<int>("GeneralSettings.ParseLayer");
- settings->show_timestamps = pt.get<bool>("GeneralSettings.ShowTimestamps");
- settings->time_format = (TimeFormat)pt.get<int>("GeneralSettings.TimeFormat");
- settings->time_unit = pt.get<int>("GeneralSettings.TimeUnit");
- settings->data_unit = pt.get<int>("GeneralSettings.DataUnit");
-
- // read view settings
- ViewSettings* view_set = new ViewSettings();
- view_set->show_all_layers_info = pt.get<bool>("ViewSettings.AllLayersInfo");
- view_set->ignore_packets = pt.get<bool>("ViewSettings.IgnorePackets");
- view_set->show_data_size = pt.get<bool>("ViewSettings.DataSize");
- view_set->show_packets_numbers = pt.get<bool>("ViewSettings.PacketNumber");
- view_set->show_upper_proto = pt.get<bool>("ViewSettings.EncapsulatedProto");
- view_set->show_ports = pt.get<bool>("ViewSettings.Ports");
- settings->view_settings = view_set;
-
- // read advanced settings
- TcpSettings* tcp_set = new TcpSettings();
- tcp_set->show_flags = pt.get<bool>("TcpSettings.Flags");
- tcp_set->show_seqack = pt.get<bool>("TcpSettings.SeqAckNumbers");
- tcp_set->show_segments = pt.get<bool>("TcpSettings.Segments");
- tcp_set->reassembly = pt.get<bool>("TcpSettings.Reassemble");
-
- HttpSettings* http_set = new HttpSettings();
- http_set->show_version = pt.get<bool>("HttpSettings.Version");
- http_set->show_packet_part = pt.get<bool>("HttpSettings.PacketPart");
- http_set->reassembly = pt.get<bool>("HttpSettings.Reassemble");
-
- SipSettings* sip_set = new SipSettings();
- sip_set->show_version = pt.get<bool>("SipSettings.Version");
- sip_set->show_from_to = pt.get<bool>("SipSettings.FromTo");
- sip_set->show_only_nick_names = pt.get<bool>("SipSettings.OnlyNicknames");
- sip_set->show_specification = pt.get<bool>("SipSettings.StatusDescript");
- sip_set->reassembly = pt.get<bool>("SipSettings.ReassembleRTP");
-
- AdvancedSettings* adv_set = new AdvancedSettings(http_set,sip_set,tcp_set);
- settings->adv_settings = adv_set;
-
- // read aggregation settings
- AggregSettings* agg_set = new AggregSettings();
- agg_set->apply_aggreg = pt.get<bool>("AggregSettings.ApplyAggregation");
- agg_set->level = (AggrLevel)pt.get<int>("AggregSettings.AggregLevel");
- agg_set->type = (AggregType)pt.get<int>("AggregSettings.AggregType");
- agg_set->time_interval = pt.get<double>("AggregSettings.TimeInterval");
- agg_set->ignore_packets = pt.get<bool>("AggregSettings.IgnorePackets");
- agg_set->show_data_size = pt.get<bool>("AggregSettings.DataSize");
- agg_set->show_packet_count = pt.get<bool>("AggregSettings.PacketCount");
- settings->flow_settings = agg_set;
-
- return settings;
-}
-
int main(int argc, char** argv)
{
if(argc < 3)
{
- std::wcerr << "Usage: " << argv[0] << "<settings_filename.ini> <(pcap)filename>" << std::endl;
+ std::wcerr << "Usage: " << argv[0] << "<configuration_file[*.ini]> <pcap_file[*.cap; *.pcap]> " << std::endl;
return 1;
}
@@ -120,10 +58,7 @@
z120.set_printer(&printer);
int errors = 0;
-
- PcapSettings* settings;
- settings = get_settings(argv[1]);
- std::vector<MscPtr> msc = pcap.load_msc(argv[2],settings);
+ std::vector<MscPtr> msc = pcap.load_msc(argv[2],argv[1]);
#ifdef WIN32
char *path = _strdup(argv[2]);
#else
@@ -145,7 +80,6 @@
}
free(path);
- //free(filename);
return errors;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|