parser: move all packet parser related files

This commit is contained in:
Kaian 2019-10-11 12:20:27 +02:00
parent 201f265cd0
commit a36bf0f10e
47 changed files with 72 additions and 78 deletions

View File

@ -50,14 +50,14 @@ set(SOURCES
src/parser/address.c
src/parser/packet.c
src/parser/parser.c
src/parser/dissectors/packet_link.c
src/parser/dissectors/packet_ip.c
src/parser/dissectors/packet_tcp.c
src/parser/dissectors/packet_udp.c
src/parser/dissectors/packet_sip.c
src/parser/dissectors/packet_sdp.c
src/parser/dissectors/packet_rtp.c
src/parser/dissectors/packet_rtcp.c
src/parser/packet_link.c
src/parser/packet_ip.c
src/parser/packet_tcp.c
src/parser/packet_udp.c
src/parser/packet_sip.c
src/parser/packet_sdp.c
src/parser/packet_rtp.c
src/parser/packet_rtcp.c
src/storage/filter.c
src/storage/group.c
src/storage/stream.c
@ -75,7 +75,7 @@ set(SOURCES
option(USE_HEP "Enable HEP/EEP Support" OFF)
if (USE_HEP)
set(SOURCES ${SOURCES} src/capture/capture_hep.c)
set(SOURCES ${SOURCES} src/parser/dissectors/packet_hep.c)
set(SOURCES ${SOURCES} src/parser/packet_hep.c)
endif (USE_HEP)
# IPv6 Support
@ -84,7 +84,7 @@ option(USE_IPV6 "Enable IPv6 Support" OFF)
# GnuTLS Support
option(WITH_SSL "Enable SSL Support (TLS SIP Transport)" OFF)
if (WITH_SSL)
set(SOURCES ${SOURCES} src/parser/dissectors/packet_tls.c)
set(SOURCES ${SOURCES} src/parser/packet_tls.c)
endif (WITH_SSL)
# libsnd Support

View File

@ -51,10 +51,10 @@
#include "storage/datetime.h"
#include "setting.h"
#include "glib/glib-extra.h"
#include "parser/dissectors/packet_hep.h"
#include "parser/dissectors/packet_ip.h"
#include "parser/dissectors/packet_udp.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_hep.h"
#include "parser/packet_ip.h"
#include "parser/packet_udp.h"
#include "parser/packet_sip.h"
#include "parser/packet.h"
#include "capture_hep.h"

View File

@ -34,13 +34,11 @@
#include <glib.h>
#include <netdb.h>
#include <string.h>
#include <pcap/sll.h>
#include <glib-unix.h>
#include "glib/glib-extra.h"
#include "capture.h"
#include "capture_hep.h"
#include "capture_pcap.h"
#include "parser/dissectors/packet_link.h"
#include "parser/packet_link.h"
#include "storage/storage.h"
#include "storage/stream.h"
#include "setting.h"
@ -451,12 +449,6 @@ capture_pcap_parse_packet(u_char *info, const struct pcap_pkthdr *header, const
g_byte_array_unref(data);
}
gint
capture_packet_time_sorter(const Packet **a, const Packet **b)
{
return date_time_is_older(packet_time(*a), packet_time(*b));
}
const gchar *
capture_input_pcap_file(CaptureManager *manager)
{

View File

@ -178,12 +178,6 @@ capture_output_pcap(const gchar *filename, GError **error);
void
capture_pcap_parse_packet(u_char *input, const struct pcap_pkthdr *header, const guchar *content);
/**
* @brief Sorter by time for captured packets
*/
gint
capture_packet_time_sorter(const Packet **a, const Packet **b);
/**
* @brief Get Input file from Offline mode
*

View File

@ -34,7 +34,7 @@
#include <stdio.h>
#include "storage/datetime.h"
#include "parser/packet.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "capture/capture_txt.h"
GQuark

View File

@ -36,7 +36,7 @@
#include "capture/capture_hep.h"
#endif
#ifdef WITH_SSL
#include "parser/dissectors/packet_tls.h"
#include "parser/packet_tls.h"
#endif
void

View File

@ -40,7 +40,7 @@
#include "setting.h"
#include "manager.h"
#include "capture/capture.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "ncurses/windows/auth_validate_win.h"
#include "ncurses/windows/call_list_win.h"
#include "ncurses/windows/call_flow_win.h"

View File

@ -28,7 +28,7 @@
#include "config.h"
#include <glib.h>
#include <storage/message.h>
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "ncurses/dialog.h"
#include "auth_validate_win.h"

View File

@ -29,7 +29,7 @@
#include "config.h"
#include <glib.h>
#include <storage/message.h>
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "capture/capture_pcap.h"
#include "ncurses/manager.h"
#include "ncurses/dialog.h"
@ -150,7 +150,7 @@ call_flow_arrow_time(const CallFlowArrow *arrow)
static gint
call_flow_arrow_time_sorter(const CallFlowArrow **a, const CallFlowArrow **b)
{
return date_time_is_older(call_flow_arrow_time(*a), call_flow_arrow_time(*b));
return g_date_time_compare(call_flow_arrow_time(*a), call_flow_arrow_time(*b));
}
/**

View File

@ -33,7 +33,7 @@
#include "config.h"
#include <string.h>
#include <stdlib.h>
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "ncurses/manager.h"
#include "ncurses/dialog.h"
#include "ncurses/windows/save_win.h"

View File

@ -30,7 +30,7 @@
#include <string.h>
#include <stdlib.h>
#include <form.h>
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "ncurses/manager.h"
#include "filter_win.h"
#include "call_list_win.h"

View File

@ -399,7 +399,7 @@ save_to_file(Window *window)
}
}
g_ptr_array_sort(packets, (GCompareFunc) capture_packet_time_sorter);
g_ptr_array_sort(packets, (GCompareFunc) packet_time_sorter);
g_ptr_array_foreach(packets, (GFunc) save_packet_cb, output);
dialog_progress_destroy(progress);

View File

@ -58,7 +58,7 @@
#include <storage/message.h>
#include "glib/glib-extra.h"
#include "storage/storage.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "stats_win.h"
Window *

View File

@ -29,10 +29,10 @@
#include "config.h"
#include <glib.h>
#include "glib/glib-extra.h"
#include "parser/dissectors/packet_ip.h"
#include "parser/dissectors/packet_tcp.h"
#include "parser/dissectors/packet_udp.h"
#include "parser/dissectors/packet_sip.h"
#include "packet_ip.h"
#include "packet_tcp.h"
#include "packet_udp.h"
#include "packet_sip.h"
#include "capture/capture_pcap.h"
#include "packet.h"
@ -185,6 +185,12 @@ packet_time(const Packet *packet)
return ts;
}
gint
packet_time_sorter(const Packet **a, const Packet **b)
{
return g_date_time_compare(packet_time(*a), packet_time(*b));
}
void
packet_frame_free(PacketFrame *frame)
{

View File

@ -152,6 +152,12 @@ packet_transport(Packet *packet);
GDateTime *
packet_time(const Packet *packet);
/**
* @brief Sorter by time for captured packets
*/
gint
packet_time_sorter(const Packet **a, const Packet **b);
/**
* @brief Free allocated memory in Packet frame
* @param frame Frame pointer to be free'd

View File

@ -31,19 +31,19 @@
#include <glib.h>
#include "setting.h"
#include "glib/glib-extra.h"
#include "parser/dissectors/packet_link.h"
#include "parser/dissectors/packet_ip.h"
#include "parser/dissectors/packet_udp.h"
#include "parser/dissectors/packet_tcp.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/dissectors/packet_sdp.h"
#include "parser/dissectors/packet_rtp.h"
#include "parser/dissectors/packet_rtcp.h"
#include "packet_link.h"
#include "packet_ip.h"
#include "packet_udp.h"
#include "packet_tcp.h"
#include "packet_sip.h"
#include "packet_sdp.h"
#include "packet_rtp.h"
#include "packet_rtcp.h"
#ifdef WITH_SSL
#include "parser/dissectors/packet_tls.h"
#include "packet_tls.h"
#endif
#ifdef USE_HEP
#include "parser/dissectors/packet_hep.h"
#include "packet_hep.h"
#endif
#include "parser.h"

View File

@ -30,7 +30,7 @@
#include <glib.h>
#include "glib/glib-extra.h"
#include "attribute.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "ncurses/manager.h"
static GPtrArray *attributes = NULL;

View File

@ -32,7 +32,7 @@
#include <glib.h>
#include "glib/glib-extra.h"
#include "call.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "storage/storage.h"
#include "setting.h"
#include "message.h"

View File

@ -32,12 +32,6 @@
#include <glib/gprintf.h>
#include "datetime.h"
gint
date_time_is_older(GDateTime *t1, GDateTime *t2)
{
return g_date_time_compare(t1, t2);
}
const gchar *
date_time_date_to_str(GDateTime *time, gchar *out)
{

View File

@ -31,16 +31,6 @@
#include <glib.h>
/**
* @brief Compare two timeval structures
*
* @param time1 First timeval structure
* @param t2 Second timval structure
* @return -1 if t1 > t2, 1 if t1 < t2, 0 if t1 == t2
*/
gint
date_time_is_older(GDateTime *t1, GDateTime *t2);
/**
* @brief Convert timeval to yyyy/mm/dd format
*/

View File

@ -32,8 +32,8 @@
#include <glib.h>
#include "glib/glib-extra.h"
#include "message.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/dissectors/packet_sdp.h"
#include "parser/packet_sip.h"
#include "parser/packet_sdp.h"
#include "storage/storage.h"
Message *

View File

@ -30,7 +30,7 @@
#define __SNGREP_MESSAGE_H
#include <glib.h>
#include "parser/dissectors/packet_sdp.h"
#include "parser/packet_sdp.h"
#include "parser/packet.h"
#include "storage/attribute.h"
#include "datetime.h"

View File

@ -57,7 +57,7 @@
#include <glib/gprintf.h>
#include <glib/gasyncqueuesource.h>
#include "glib/glib-extra.h"
#include "parser/dissectors/packet_sip.h"
#include "parser/packet_sip.h"
#include "setting.h"
#include "filter.h"
#include "storage.h"

View File

@ -32,9 +32,9 @@
#include "config.h"
#include "storage/message.h"
#include "capture/capture_pcap.h"
#include "parser/dissectors/packet_sdp.h"
#include "parser/dissectors/packet_rtp.h"
#include "parser/dissectors/packet_rtcp.h"
#include "parser/packet_sdp.h"
#include "parser/packet_rtp.h"
#include "parser/packet_rtcp.h"
//! Shorter declaration of rtp_stream structure
typedef struct _Stream Stream;

View File

@ -322,3 +322,15 @@
fun:capture_input_pcap_read_packet
fun:g_main_context_dispatch
}
{
malloc
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:g_malloc
fun:parse_arg.isra.0
fun:parse_short_option
fun:g_option_context_parse
fun:main
}