2007-02-28 23:20:40 +00:00
|
|
|
/* export_object_http.c
|
|
|
|
* Routines for tracking & saving objects found in HTTP streams
|
|
|
|
* See also: export_object.c / export_object.h for common code
|
2009-05-31 05:55:15 +00:00
|
|
|
* Copyright 2007, Stephen Fisher (see AUTHORS file)
|
2007-02-28 23:20:40 +00:00
|
|
|
*
|
|
|
|
* $Id$
|
2012-10-16 22:57:22 +00:00
|
|
|
*
|
2007-02-28 23:20:40 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program 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 General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
|
|
|
* USA.
|
|
|
|
*/
|
|
|
|
|
2012-09-20 01:48:30 +00:00
|
|
|
#include "config.h"
|
2007-02-28 23:20:40 +00:00
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
|
|
|
#include <epan/dissectors/packet-http.h>
|
|
|
|
#include <epan/tap.h>
|
|
|
|
|
2012-10-16 22:57:22 +00:00
|
|
|
#include "export_object.h"
|
2008-04-13 01:54:20 +00:00
|
|
|
|
2007-02-28 23:20:40 +00:00
|
|
|
|
2012-10-16 22:57:22 +00:00
|
|
|
gboolean
|
2007-02-28 23:20:40 +00:00
|
|
|
eo_http_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_,
|
2012-10-24 15:51:59 +00:00
|
|
|
const void *data)
|
2007-02-28 23:20:40 +00:00
|
|
|
{
|
2013-03-20 01:18:10 +00:00
|
|
|
export_object_list_t *object_list = (export_object_list_t *)tapdata;
|
|
|
|
const http_eo_t *eo_info = (const http_eo_t *)data;
|
2012-10-24 15:51:59 +00:00
|
|
|
export_object_entry_t *entry;
|
2007-02-28 23:20:40 +00:00
|
|
|
|
2012-10-24 15:51:59 +00:00
|
|
|
if(eo_info) { /* We have data waiting for us */
|
|
|
|
/* These values will be freed when the Export Object window
|
|
|
|
* is closed. */
|
2013-03-20 01:18:10 +00:00
|
|
|
entry = (export_object_entry_t *)g_malloc(sizeof(export_object_entry_t));
|
2007-03-13 20:42:04 +00:00
|
|
|
|
2012-10-24 15:51:59 +00:00
|
|
|
entry->pkt_num = pinfo->fd->num;
|
|
|
|
entry->hostname = g_strdup(eo_info->hostname);
|
|
|
|
entry->content_type = g_strdup(eo_info->content_type);
|
|
|
|
entry->filename = g_strdup(g_path_get_basename(eo_info->filename));
|
|
|
|
entry->payload_len = eo_info->payload_len;
|
2013-03-20 01:18:10 +00:00
|
|
|
entry->payload_data = (guint8 *)g_memdup(eo_info->payload_data,
|
2012-10-24 15:51:59 +00:00
|
|
|
eo_info->payload_len);
|
2007-02-28 23:20:40 +00:00
|
|
|
|
2012-10-24 15:51:59 +00:00
|
|
|
object_list_add_entry(object_list, entry);
|
2007-03-13 20:42:04 +00:00
|
|
|
|
2012-10-24 15:51:59 +00:00
|
|
|
return TRUE; /* State changed - window should be redrawn */
|
|
|
|
} else {
|
|
|
|
return FALSE; /* State unchanged - no window updates needed */
|
|
|
|
}
|
2007-02-28 23:20:40 +00:00
|
|
|
}
|
2012-10-24 15:51:59 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Editor modelines
|
|
|
|
*
|
|
|
|
* Local Variables:
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: nil
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* ex: set shiftwidth=4 tabstop=8 expandtab:
|
|
|
|
* :indentSize=4:tabSize=8:noTabs=true:
|
|
|
|
*/
|