MSWSP: add ids for another unknown Property Set
[wireshark-wip.git] / epan / dissectors / packet-aim-sst.c
blob5cfdac7451f8ed446f72deafee8de32026c74300
1 /* packet-aim-sst.c
2 * Routines for AIM (OSCAR) dissection, SNAC Server Stored Themes
3 * Copyright 2004, Jelmer Vernooij <jelmer@samba.org>
5 * $Id$
7 * Wireshark - Network traffic analyzer
8 * By Gerald Combs <gerald@wireshark.org>
9 * Copyright 1998 Gerald Combs
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 #include "config.h"
28 #include <glib.h>
30 #include <epan/packet.h>
31 #include <epan/strutil.h>
33 #include "packet-aim.h"
35 void proto_register_aim_sst(void);
36 void proto_reg_handoff_aim_sst(void);
38 #define FAMILY_SST 0x0010
41 /* Initialize the protocol and registered fields */
42 static int proto_aim_sst = -1;
43 static int hf_aim_sst_unknown = -1;
44 static int hf_aim_sst_md5_hash = -1;
45 static int hf_aim_sst_md5_hash_size = -1;
46 static int hf_aim_sst_ref_num = -1;
47 static int hf_aim_sst_icon_size = -1;
48 static int hf_aim_sst_icon = -1;
50 /* Initialize the subtree pointers */
51 static gint ett_aim_sst = -1;
53 static int dissect_aim_sst_buddy_down_req (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
55 int offset = dissect_aim_buddyname(tvb, pinfo, 0, tree);
56 guint8 md5_size;
58 proto_tree_add_item(tree, hf_aim_sst_unknown, tvb, offset, 4, ENC_NA);
59 offset+=4;
61 proto_tree_add_item(tree, hf_aim_sst_md5_hash_size, tvb, offset, 1, ENC_BIG_ENDIAN);
62 md5_size = tvb_get_guint8(tvb, offset);
63 offset++;
65 proto_tree_add_item(tree, hf_aim_sst_md5_hash, tvb, offset, md5_size, ENC_NA);
67 offset+=md5_size;
68 return offset;
71 static int dissect_aim_sst_buddy_down_repl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
73 int offset = dissect_aim_buddyname(tvb, pinfo, 0, tree);
74 guint8 md5_size;
75 guint16 icon_size;
77 proto_tree_add_item(tree, hf_aim_sst_unknown, tvb, offset, 3, ENC_NA);
78 offset+=3;
80 proto_tree_add_item(tree, hf_aim_sst_md5_hash_size, tvb, offset, 1, ENC_BIG_ENDIAN);
81 md5_size = tvb_get_guint8(tvb, offset);
82 offset++;
84 proto_tree_add_item(tree, hf_aim_sst_md5_hash, tvb, offset, md5_size, ENC_NA);
86 offset+=md5_size;
88 proto_tree_add_item(tree, hf_aim_sst_icon_size, tvb, offset, 2, ENC_BIG_ENDIAN);
89 icon_size = tvb_get_ntohs(tvb, offset);
90 offset+=2;
92 if (icon_size)
94 proto_tree_add_item(tree, hf_aim_sst_icon, tvb, offset, icon_size, ENC_NA);
97 offset+=icon_size;
99 return offset;
102 static int dissect_aim_sst_buddy_up_repl (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
104 int offset = 0;
105 guint8 md5_size;
107 proto_tree_add_item(tree, hf_aim_sst_unknown, tvb, offset, 4, ENC_NA);
108 offset+=4;
110 proto_tree_add_item(tree, hf_aim_sst_md5_hash_size, tvb, offset, 1, ENC_BIG_ENDIAN);
111 md5_size = tvb_get_guint8(tvb, offset);
112 offset++;
114 proto_tree_add_item(tree, hf_aim_sst_md5_hash, tvb, offset, md5_size, ENC_NA);
116 offset+=md5_size;
117 return offset;
120 static int dissect_aim_sst_buddy_up_req (tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
122 int offset = 0;
123 guint16 icon_size;
125 proto_tree_add_item(tree, hf_aim_sst_ref_num, tvb, offset, 2, ENC_BIG_ENDIAN);
126 offset+=2;
128 proto_tree_add_item(tree, hf_aim_sst_icon_size, tvb, offset, 2, ENC_BIG_ENDIAN);
129 icon_size = tvb_get_ntohs(tvb, offset);
130 offset+=2;
132 if (icon_size)
134 proto_tree_add_item(tree, hf_aim_sst_icon, tvb, offset, icon_size, ENC_NA);
137 offset+=icon_size;
138 return offset;
141 static const aim_subtype aim_fnac_family_sst[] = {
142 { 0x0001, "Error", dissect_aim_snac_error },
143 { 0x0002, "Upload Buddy Icon Request", dissect_aim_sst_buddy_up_req },
144 { 0x0003, "Upload Buddy Icon Reply", dissect_aim_sst_buddy_up_repl },
145 { 0x0004, "Download Buddy Icon Request", dissect_aim_sst_buddy_down_req },
146 { 0x0005, "Download Buddy Icon Reply", dissect_aim_sst_buddy_down_repl },
147 { 0, NULL, NULL }
151 /* Register the protocol with Wireshark */
152 void
153 proto_register_aim_sst(void)
156 /* Setup list of header fields */
157 static hf_register_info hf[] = {
158 { &hf_aim_sst_md5_hash,
159 { "MD5 Hash", "aim_sst.md5", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL },
161 { &hf_aim_sst_md5_hash_size,
162 { "MD5 Hash Size", "aim_sst.md5.size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL },
164 { &hf_aim_sst_unknown,
165 { "Unknown Data", "aim_sst.unknown", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL },
167 { &hf_aim_sst_ref_num,
168 { "Reference Number", "aim_sst.ref_num", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL },
170 { &hf_aim_sst_icon_size,
171 { "Icon Size", "aim_sst.icon_size", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL },
173 { &hf_aim_sst_icon,
174 { "Icon", "aim_sst.icon", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL },
178 /* Setup protocol subtree array */
179 static gint *ett[] = {
180 &ett_aim_sst,
183 /* Register the protocol name and description */
184 proto_aim_sst = proto_register_protocol("AIM Server Side Themes", "AIM SST", "aim_sst");
186 /* Required function calls to register the header fields and subtrees used */
187 proto_register_field_array(proto_aim_sst, hf, array_length(hf));
188 proto_register_subtree_array(ett, array_length(ett));
191 void
192 proto_reg_handoff_aim_sst(void)
194 aim_init_family(proto_aim_sst, ett_aim_sst, FAMILY_SST, aim_fnac_family_sst);