Witness: enum witness_notifyResponse_type
[wireshark-wip.git] / ui / export_object_http.c
blob9f5afb01545bb3f1885e82bb7d525f68b5a66b59
1 /* export_object_http.c
2 * Routines for tracking & saving objects found in HTTP streams
3 * See also: export_object.c / export_object.h for common code
4 * Copyright 2007, Stephen Fisher (see AUTHORS file)
6 * $Id$
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
25 * USA.
28 #include "config.h"
30 #include <glib.h>
32 #include <epan/dissectors/packet-http.h>
33 #include <epan/tap.h>
35 #include "export_object.h"
38 gboolean
39 eo_http_packet(void *tapdata, packet_info *pinfo, epan_dissect_t *edt _U_,
40 const void *data)
42 export_object_list_t *object_list = (export_object_list_t *)tapdata;
43 const http_eo_t *eo_info = (const http_eo_t *)data;
44 export_object_entry_t *entry;
46 if(eo_info) { /* We have data waiting for us */
47 /* These values will be freed when the Export Object window
48 * is closed. */
49 entry = (export_object_entry_t *)g_malloc(sizeof(export_object_entry_t));
51 entry->pkt_num = pinfo->fd->num;
52 entry->hostname = g_strdup(eo_info->hostname);
53 entry->content_type = g_strdup(eo_info->content_type);
54 entry->filename = g_strdup(g_path_get_basename(eo_info->filename));
55 entry->payload_len = eo_info->payload_len;
56 entry->payload_data = (guint8 *)g_memdup(eo_info->payload_data,
57 eo_info->payload_len);
59 object_list_add_entry(object_list, entry);
61 return TRUE; /* State changed - window should be redrawn */
62 } else {
63 return FALSE; /* State unchanged - no window updates needed */
68 * Editor modelines
70 * Local Variables:
71 * c-basic-offset: 4
72 * tab-width: 8
73 * indent-tabs-mode: nil
74 * End:
76 * ex: set shiftwidth=4 tabstop=8 expandtab:
77 * :indentSize=4:tabSize=8:noTabs=true: