12166fc0324620c27d197afc5a35cf526219478d
[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  * Wireshark - Network traffic analyzer
8  * By Gerald Combs <gerald@wireshark.org>
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 <epan/stat_cmd_args.h>
38 #include "../stat_menu.h"
39 #include "gui_stat_menu.h"
40 #include <epan/tap.h>
41 #include "../register.h"
42 #include "conversations_table.h"
43 #include <epan/dissectors/packet-jxta.h>
44
45
46 static int
47 jxta_conversation_packet(void *pct, packet_info *pinfo _U_, epan_dissect_t *edt _U_, const void *vip)
48 {
49         const jxta_tap_header *jxtahdr = (const jxta_tap_header *) vip;
50
51         add_conversation_table_data((conversations_table *)pct, 
52                 &jxtahdr->src_address, 
53                 &jxtahdr->dest_address, 
54                 0, 
55                 0, 
56                 1, 
57                 jxtahdr->size, 
58                 SAT_JXTA, 
59                 PT_NONE);
60
61
62         return 1;
63 }
64
65 static void
66 jxta_conversation_init(const char *optarg, void* userdata _U_)
67 {
68         const char *filter=NULL;
69
70         if(!strncmp(optarg,"conv,jxta,",10)){
71                 filter=optarg+10;
72         } else {
73                 filter=NULL;
74         }
75
76         init_conversation_table(TRUE, "JXTA", "jxta", filter, jxta_conversation_packet);
77
78 }
79
80
81 static void
82 jxta_conversation_cb(GtkWidget *w _U_, gpointer d _U_)
83 {
84         jxta_conversation_init("conv,jxta",NULL);
85 }
86
87
88 void
89 register_tap_listener_jxta_conversation(void)
90 {
91         register_stat_cmd_arg("conv,jxta", jxta_conversation_init,NULL);
92
93         register_stat_menu_item("JXTA", REGISTER_STAT_GROUP_CONVERSATION_LIST,
94             jxta_conversation_cb, NULL, NULL, NULL);
95
96         register_conversation_table(TRUE, "JXTA", "jxta", NULL /*filter*/, jxta_conversation_packet);
97 }