The rest of the Follow UDP Stream check-in
[obnox/wireshark/wip.git] / gtk / conversations_rsvp.c
1 /* conversations_rsvp.c
2  * conversations_rsvp.c  August 2005, Manu Pathak <mapathak@cisco.com>
3  *
4  * Wireshark - Network traffic analyzer
5  * By Gerald Combs <gerald@wireshark.org>
6  * Copyright 1998 Gerald Combs
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * as published by the Free Software Foundation; either version 2
11  * of the License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
21  */
22
23 #ifdef HAVE_CONFIG_H
24 # include "config.h"
25 #endif
26
27 #ifdef HAVE_SYS_TYPES_H
28 # include <sys/types.h>
29 #endif
30
31 #include <gtk/gtk.h>
32 #include <string.h>
33 #include "epan/packet.h"
34 #include <epan/stat_cmd_args.h>
35 #include "../stat_menu.h"
36 #include "gui_stat_menu.h"
37 #include <epan/tap.h>
38 #include "../register.h"
39 #include "conversations_table.h"
40 #include <epan/dissectors/packet-rsvp.h>
41
42
43 static int
44 rsvp_conversation_packet(void *pct, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip)
45 {
46         const rsvp_conversation_info *rsvph = vip;
47
48         add_conversation_table_data((conversations_table *)pct, 
49                                     &rsvph->source, &rsvph->destination, 0, 0, 1, 
50                                     pinfo->fd->pkt_len, SAT_NONE, PT_NONE);
51
52         return 1;
53 }
54
55 static void
56 rsvp_conversation_init(const char *optarg, void* userdata _U_)
57 {
58         const char *filter=NULL;
59
60         if(!strncmp(optarg,"conv,rsvp,",10)){
61                 filter=optarg+10;
62         } else {
63                 filter=NULL;
64         }
65
66         init_conversation_table(TRUE, "RSVP", "rsvp", filter, 
67                                 rsvp_conversation_packet);
68
69 }
70
71
72 static void
73 rsvp_endpoints_cb(GtkWidget *w _U_, gpointer d _U_)
74 {
75         rsvp_conversation_init("conv,rsvp",NULL);
76 }
77
78
79 void
80 register_tap_listener_rsvp_conversation(void)
81 {
82         register_stat_cmd_arg("conv,rsvp", rsvp_conversation_init,NULL);
83
84         register_stat_menu_item("RSVP", REGISTER_STAT_GROUP_CONVERSATION_LIST,
85                                rsvp_endpoints_cb, NULL, NULL, NULL);
86
87         register_conversation_table(TRUE, "RSVP", "rsvp", NULL /*filter*/, 
88                                     rsvp_conversation_packet);
89 }