Add support for Exif decoding (initial framework).
[obnox/wireshark/wip.git] / packet-aim-chatnav.c
1 /* packet-aim.c
2  * Routines for AIM Instant Messenger (OSCAR) dissection
3  * Copyright 2004, Jelmer Vernooij <jelmer@samba.org>
4  *
5  * $Id: packet-aim-chatnav.c,v 1.4 2004/04/20 04:48:31 guy Exp $
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 #include <stdio.h>
31 #include <stdlib.h>
32 #include <string.h>
33 #include <ctype.h>
34
35 #include <glib.h>
36
37 #include <epan/packet.h>
38 #include <epan/strutil.h>
39
40 #include "packet-aim.h"
41
42 #define FAMILY_CHAT_NAV   0x000D
43
44 /* Family Chat Navigation */
45 #define FAMILY_CHATNAV_ERROR          0x0001
46 #define FAMILY_CHATNAV_LIMITS_REQ     0x0002
47 #define FAMILY_CHATNAV_EXCHANGE_REQ   0x0003
48 #define FAMILY_CHATNAV_ROOM_INFO_REQ  0x0004
49 #define FAMILY_CHATNAV_ROOMIF_EXT_REQ 0x0005
50 #define FAMILY_CHATNAV_MEMBERLIST_REQ 0x0006
51 #define FAMILY_CHATNAV_SEARCH_ROOM    0x0007
52 #define FAMILY_CHATNAV_CREATE_ROOM    0x0008
53 #define FAMILY_CHATNAV_INFO_REPLY     0x0009
54 #define FAMILY_CHATNAV_DEFAULT        0xffff
55
56 static const value_string aim_fnac_family_chatnav[] = {
57   { FAMILY_CHATNAV_ERROR, "Error" },
58   { FAMILY_CHATNAV_LIMITS_REQ, "Request Limits" },
59   { FAMILY_CHATNAV_EXCHANGE_REQ, "Request Exchange" },
60   { FAMILY_CHATNAV_ROOM_INFO_REQ, "Request Room Information" },
61   { FAMILY_CHATNAV_ROOMIF_EXT_REQ, "Request Extended Room Information" },
62   { FAMILY_CHATNAV_MEMBERLIST_REQ, "Request Member List" },
63   { FAMILY_CHATNAV_SEARCH_ROOM, "Search Room" },
64   { FAMILY_CHATNAV_CREATE_ROOM, "Create" },
65   { FAMILY_CHATNAV_INFO_REPLY, "Info" },
66   { FAMILY_CHATNAV_DEFAULT, "ChatNav Default" },
67   { 0, NULL }
68 };
69
70 /* Initialize the protocol and registered fields */
71 static int proto_aim_chatnav = -1;
72
73 int ett_aim_chatnav = -1;
74
75 static int dissect_aim_chatnav(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
76 {
77   struct aiminfo *aiminfo = pinfo->private_data;
78         
79   proto_item *ti;
80   proto_tree *chatnav_tree = NULL;
81
82   if(tree) {
83       ti = proto_tree_add_text(tree, tvb, 0, -1, "Chat Navigation Service");
84       chatnav_tree = proto_item_add_subtree(ti, ett_aim_chatnav);
85   }
86
87   switch(aiminfo->subtype) {
88           case FAMILY_CHATNAV_ERROR:
89                   return dissect_aim_snac_error(tvb, pinfo, 0, chatnav_tree);
90         case FAMILY_CHATNAV_LIMITS_REQ:
91                   /* No data */
92                   return 0;
93         case FAMILY_CHATNAV_EXCHANGE_REQ:
94         case FAMILY_CHATNAV_ROOM_INFO_REQ:
95         case FAMILY_CHATNAV_ROOMIF_EXT_REQ:
96         case FAMILY_CHATNAV_MEMBERLIST_REQ:
97         case FAMILY_CHATNAV_SEARCH_ROOM:
98         case FAMILY_CHATNAV_CREATE_ROOM:
99         case FAMILY_CHATNAV_INFO_REPLY:
100         case FAMILY_CHATNAV_DEFAULT:
101   /* FIXME */
102           return 0;
103         default: return 0;
104   }
105 }
106
107 /* Register the protocol with Ethereal */
108 void
109 proto_register_aim_chatnav(void)
110 {
111
112 /* Setup list of header fields */
113 /*FIXME
114   static hf_register_info hf[] = {
115   };*/
116
117 /* Setup protocol subtree array */
118   static gint *ett[] = {
119     &ett_aim_chatnav,
120   };
121 /* Register the protocol name and description */
122   proto_aim_chatnav = proto_register_protocol("AIM Chat Navigation", "AIM ChatNav", "aim_chatnav");
123
124 /* Required function calls to register the header fields and subtrees used */
125 /*FIXME
126   proto_register_field_array(proto_aim_chatnav, hf, array_length(hf));*/
127   proto_register_subtree_array(ett, array_length(ett));
128 }
129
130 void
131 proto_reg_handoff_aim_chatnav(void)
132 {
133   dissector_handle_t aim_handle;
134
135   aim_handle = new_create_dissector_handle(dissect_aim_chatnav, proto_aim_chatnav);
136   dissector_add("aim.family", FAMILY_CHAT_NAV, aim_handle);
137   
138   aim_init_family(FAMILY_CHAT_NAV, "Chat Navigation", aim_fnac_family_chatnav);
139 }