2 * Routines for AIM (OSCAR) dissection, SNAC Server Stored Themes
3 * Copyright 2004, Jelmer Vernooij <jelmer@samba.org>
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.
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
);
58 proto_tree_add_item(tree
, hf_aim_sst_unknown
, tvb
, offset
, 4, ENC_NA
);
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
);
65 proto_tree_add_item(tree
, hf_aim_sst_md5_hash
, tvb
, offset
, md5_size
, ENC_NA
);
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
);
77 proto_tree_add_item(tree
, hf_aim_sst_unknown
, tvb
, offset
, 3, ENC_NA
);
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
);
84 proto_tree_add_item(tree
, hf_aim_sst_md5_hash
, tvb
, offset
, md5_size
, ENC_NA
);
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
);
94 proto_tree_add_item(tree
, hf_aim_sst_icon
, tvb
, offset
, icon_size
, ENC_NA
);
102 static int dissect_aim_sst_buddy_up_repl (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
)
107 proto_tree_add_item(tree
, hf_aim_sst_unknown
, tvb
, offset
, 4, ENC_NA
);
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
);
114 proto_tree_add_item(tree
, hf_aim_sst_md5_hash
, tvb
, offset
, md5_size
, ENC_NA
);
120 static int dissect_aim_sst_buddy_up_req (tvbuff_t
*tvb
, packet_info
*pinfo _U_
, proto_tree
*tree
)
125 proto_tree_add_item(tree
, hf_aim_sst_ref_num
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
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
);
134 proto_tree_add_item(tree
, hf_aim_sst_icon
, tvb
, offset
, icon_size
, ENC_NA
);
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
},
151 /* Register the protocol with Wireshark */
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
},
174 { "Icon", "aim_sst.icon", FT_BYTES
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
},
178 /* Setup protocol subtree array */
179 static gint
*ett
[] = {
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
));
192 proto_reg_handoff_aim_sst(void)
194 aim_init_family(proto_aim_sst
, ett_aim_sst
, FAMILY_SST
, aim_fnac_family_sst
);