Add an ifdef and "dont apply patch twice".
[obnox/wireshark/wip.git] / gtk / conversations_jxta.c
1 /* conversations_jxta.c
2  * conversations_jxta  copyright (c) 2005 Mike Duigou <bondolo@jxta.org>
3  * copied from conversations_sctp.c
4  * 
5  * $Id$
6  *
7  * Ethereal - Network traffic analyzer
8  * By Gerald Combs <gerald@ethereal.com>
9  * Copyright 1998 Gerald Combs
10  *
11  * This program is free software; you can redistribute it and/or
12  * modify it under the terms of the GNU General Public License
13  * as published by the Free Software Foundation; either version 2
14  * of the License, or (at your option) any later version.
15  *
16  * This program is distributed in the hope that it will be useful,
17  * but WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  * GNU General Public License for more details.
20  *
21  * You should have received a copy of the GNU General Public License
22  * along with this program; if not, write to the Free Software
23  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
24  */
25
26 #ifdef HAVE_CONFIG_H
27 # include "config.h"
28 #endif
29
30 #ifdef HAVE_SYS_TYPES_H
31 # include <sys/types.h>
32 #endif
33
34 #include <gtk/gtk.h>
35 #include <string.h>
36 #include "epan/packet.h"
37 #include "tap_menu.h"
38 #include <epan/tap.h>
39 #include "../register.h"
40 #include "conversations_table.h"
41 #include <epan/dissectors/packet-jxta.h>
42
43
44 static int
45 jxta_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
46 {
47         const jxta_tap_header *jxtahdr = (const jxta_tap_header *) vip;
48
49         add_conversation_table_data((conversations_table *)pct, 
50                 &jxtahdr->src_address, 
51                 &jxtahdr->dest_address, 
52                 0, 
53                 0, 
54                 1, 
55                 jxtahdr->size, 
56                 SAT_NONE, 
57                 PT_NONE);
58
59
60         return 1;
61 }
62
63 static void
64 jxta_conversation_init(char *optarg)
65 {
66         char *filter=NULL;
67
68         if(!strncmp(optarg,"conv,jxta,",10)){
69                 filter=optarg+10;
70         } else {
71                 filter=NULL;
72         }
73
74         init_conversation_table(TRUE, "JXTA", "jxta", filter, jxta_conversation_packet);
75
76 }
77
78
79 static void
80 jxta_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
81 {
82         jxta_conversation_init("conv,jxta");
83 }
84
85
86 void
87 register_tap_listener_jxta_conversation(void)
88 {
89         register_tap_listener_cmd_arg("conv,jxta", jxta_conversation_init);
90
91         register_tap_menu_item("JXTA", REGISTER_TAP_GROUP_CONVERSATION_LIST,
92             jxta_conversation_cb, NULL, NULL, NULL);
93
94     register_conversation_table(TRUE, "JXTA", "jxta", NULL /*filter*/, jxta_conversation_packet);
95 }
96