HACK: pinfo->private_data points to smb_info again
[wireshark-wip.git] / epan / dissectors / packet-aim-generic.c
blob3d1874c24e95a0e569cbc4ff937699b9840ca196
1 /* packet-aim-generic.c
2 * Routines for AIM Instant Messenger (OSCAR) dissection, SNAC Family Generic
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>
32 #include "packet-aim.h"
34 void proto_register_aim_generic(void);
35 void proto_reg_handoff_aim_generic(void);
37 #define STRIP_TAGS 1
39 /* SNAC families */
40 #define FAMILY_GENERIC 0x0001
43 #define FAMILY_GENERIC_MOTD_MOTDTYPE_MDT_UPGRADE 0x0001
44 #define FAMILY_GENERIC_MOTD_MOTDTYPE_ADV_UPGRADE 0x0002
45 #define FAMILY_GENERIC_MOTD_MOTDTYPE_SYS_BULLETIN 0x0003
46 #define FAMILY_GENERIC_MOTD_MOTDTYPE_NORMAL 0x0004
47 #define FAMILY_GENERIC_MOTD_MOTDTYPE_NEWS 0x0006
49 static const value_string aim_snac_generic_motd_motdtypes[] = {
50 { FAMILY_GENERIC_MOTD_MOTDTYPE_MDT_UPGRADE, "Mandatory Upgrade Needed Notice" },
51 { FAMILY_GENERIC_MOTD_MOTDTYPE_ADV_UPGRADE, "Advisable Upgrade Notice" },
52 { FAMILY_GENERIC_MOTD_MOTDTYPE_SYS_BULLETIN, "AIM/ICQ Service System Announcements" },
53 { FAMILY_GENERIC_MOTD_MOTDTYPE_NORMAL, "Standard Notice" },
54 { FAMILY_GENERIC_MOTD_MOTDTYPE_NEWS, "News from AOL service" },
55 { 0, NULL }
58 #define RATEINFO_STATE_LIMITED 0x01
59 #define RATEINFO_STATE_ALERT 0x02
60 #define RATEINFO_STATE_CLEAR 0x03
62 static const value_string rateinfo_states[] = {
63 { RATEINFO_STATE_LIMITED, "Limited" },
64 { RATEINFO_STATE_ALERT, "Alert" },
65 { RATEINFO_STATE_CLEAR, "Clear" },
66 { 0, NULL }
69 #define RATECHANGE_MSG_LIMIT_PARAMS_CHANGED 0x0001
70 #define RATECHANGE_MSG_LIMIT_WARN 0x0002
71 #define RATECHANGE_MSG_LIMIT_HIT 0x0003
72 #define RATECHANGE_MSG_LIMIT_CLEAR 0x0004
74 static const value_string ratechange_msgs[] = {
75 { RATECHANGE_MSG_LIMIT_PARAMS_CHANGED, "Rate limits parameters changed" },
76 { RATECHANGE_MSG_LIMIT_WARN, "Rate limits warning (current level < alert level)" },
77 { RATECHANGE_MSG_LIMIT_HIT, "Rate limit hit (current level < limit level)" },
78 { RATECHANGE_MSG_LIMIT_CLEAR, "Rate limit clear (current level now > clear level)" },
79 { 0, NULL },
82 #define EXT_STATUS_TYPE_BUDDY_ICON_0 0
83 #define EXT_STATUS_TYPE_BUDDY_ICON_1 1
84 #define EXT_STATUS_TYPE_AVAIL_MSG 2
85 #define EXT_STATUS_TYPE_UNKNOWN 6
87 static const value_string ext_status_types[] = {
88 { EXT_STATUS_TYPE_BUDDY_ICON_0, "Request to send buddy icon" },
89 { EXT_STATUS_TYPE_BUDDY_ICON_1, "Request to send buddy icon" },
90 { EXT_STATUS_TYPE_AVAIL_MSG, "Extended Status Update" },
91 { 0, NULL },
94 #define EXT_STATUS_FLAG_INITIAL_SEND 0x41
95 #define EXT_STATUS_FLAG_RESEND 0x81
97 static const value_string ext_status_flags[] = {
98 { EXT_STATUS_FLAG_INITIAL_SEND, "First Send Request" },
99 { EXT_STATUS_FLAG_RESEND, "Request To Re-Send" },
100 { 0, NULL },
103 /* Initialize the protocol and registered fields */
104 static int proto_aim_generic = -1;
105 static int hf_generic_motd_motdtype = -1;
106 static int hf_generic_servicereq_service = -1;
107 static int hf_generic_rateinfo_numclasses = -1;
108 static int hf_generic_rateinfo_windowsize = -1;
109 static int hf_generic_rateinfo_clearlevel = -1;
110 static int hf_generic_rateinfo_alertlevel = -1;
111 static int hf_generic_rateinfo_limitlevel = -1;
112 static int hf_generic_rateinfo_disconnectlevel = -1;
113 static int hf_generic_rateinfo_currentlevel = -1;
114 static int hf_generic_rateinfo_maxlevel = -1;
115 static int hf_generic_rateinfo_lasttime = -1;
116 static int hf_generic_rateinfo_curstate = -1;
117 static int hf_generic_rateinfo_classid = -1;
118 static int hf_generic_rateinfo_numpairs = -1;
119 static int hf_generic_rateinfoack_group = -1;
120 static int hf_generic_ratechange_msg = -1;
121 static int hf_generic_migration_numfams = -1;
122 static int hf_generic_priv_flags = -1;
123 static int hf_generic_allow_idle_see = -1;
124 static int hf_generic_allow_member_see = -1;
125 static int hf_generic_selfinfo_warninglevel = -1;
126 static int hf_generic_evil_new_warn_level = -1;
127 static int hf_generic_idle_time = -1;
128 static int hf_generic_client_ver_req_offset = -1;
129 static int hf_generic_client_ver_req_length = -1;
130 static int hf_generic_client_ver_req_hash = -1;
131 static int hf_generic_ext_status_type = -1;
132 static int hf_generic_ext_status_length = -1;
133 static int hf_generic_ext_status_flags = -1;
134 static int hf_generic_ext_status_data = -1;
136 /* Initialize the subtree pointers */
137 static gint ett_generic_clientready = -1;
138 static gint ett_generic_migratefamilies = -1;
139 static gint ett_generic_clientready_item = -1;
140 static gint ett_generic_serverready = -1;
141 static gint ett_generic = -1;
142 static gint ett_generic_priv_flags = -1;
143 static gint ett_generic_rateinfo_class = -1;
144 static gint ett_generic_rateinfo_classes = -1;
145 static gint ett_generic_rateinfo_groups = -1;
146 static gint ett_generic_rateinfo_group = -1;
148 static int dissect_rate_class(tvbuff_t *tvb, packet_info *pinfo _U_, int offset, proto_tree *class_tree)
150 proto_tree_add_uint(class_tree, hf_generic_rateinfo_classid, tvb, offset, 2, tvb_get_ntohs(tvb, offset));offset+=2;
151 proto_tree_add_uint(class_tree, hf_generic_rateinfo_windowsize, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
152 proto_tree_add_uint(class_tree, hf_generic_rateinfo_clearlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
153 proto_tree_add_uint(class_tree, hf_generic_rateinfo_alertlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
154 proto_tree_add_uint(class_tree, hf_generic_rateinfo_limitlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
155 proto_tree_add_uint(class_tree, hf_generic_rateinfo_disconnectlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
156 proto_tree_add_uint(class_tree, hf_generic_rateinfo_currentlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
157 proto_tree_add_uint(class_tree, hf_generic_rateinfo_maxlevel, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
158 proto_tree_add_uint(class_tree, hf_generic_rateinfo_lasttime, tvb, offset, 4, tvb_get_ntohl(tvb, offset));offset+=4;
159 proto_tree_add_uint(class_tree, hf_generic_rateinfo_curstate, tvb, offset, 1, tvb_get_guint8(tvb, offset));offset+=1;
160 return offset;
163 static int dissect_generic_rateinfo(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree)
165 int offset = 0;
166 guint16 i;
167 proto_item *ti;
168 guint16 numclasses = tvb_get_ntohs(tvb, 0);
169 proto_tree *classes_tree = NULL, *groups_tree, *group_tree;
170 proto_tree_add_uint(tree, hf_generic_rateinfo_numclasses, tvb, 0, 2, numclasses );
171 offset+=2;
173 if(tree) {
174 /* sizeof(rate_class_struct) = 35 ! */
175 ti = proto_tree_add_text(tree, tvb, offset, 35 * numclasses, "Available Rate Classes");
176 classes_tree = proto_item_add_subtree(ti, ett_generic_rateinfo_classes);
179 for(i = 0; i < numclasses; i++) {
180 guint16 myid = tvb_get_ntohs(tvb, offset);
181 proto_item *ti_local = proto_tree_add_text(classes_tree, tvb, offset, 35, "Rate Class 0x%02x", myid);
182 proto_tree *class_tree = proto_item_add_subtree(ti_local, ett_generic_rateinfo_class);
183 offset = dissect_rate_class(tvb, pinfo, offset, class_tree);
186 ti = proto_tree_add_text(tree, tvb, offset, -1, "Rate Groups");
187 groups_tree = proto_item_add_subtree(ti, ett_generic_rateinfo_groups);
189 for(i = 0; i < numclasses; i++) {
190 guint16 j;
191 guint16 myid = tvb_get_ntohs(tvb, offset);
192 guint16 numpairs = tvb_get_ntohs(tvb, offset + 2);
194 * sizeof(rate_group) = sizeof(class_id) + sizeof(numpairs) + numpairs * 2 * sizeof(uint16_t)
195 * = 2 + 2 + numpairs * 4
197 proto_item *ti_local = proto_tree_add_text(groups_tree, tvb, offset, 4 + 4 * numpairs, "Rate Group 0x%02x", myid);
198 group_tree = proto_item_add_subtree(ti_local, ett_generic_rateinfo_group);
199 proto_tree_add_uint(group_tree, hf_generic_rateinfo_classid, tvb, offset, 2, myid);offset+=2;
200 proto_tree_add_uint(group_tree, hf_generic_rateinfo_numpairs, tvb, offset, 2, numpairs); offset+=2;
201 for(j = 0; j < numpairs; j++) {
202 guint16 family_id;
203 guint16 subtype_id;
204 const aim_family *family;
205 const aim_subtype *subtype;
206 family_id = tvb_get_ntohs(tvb, offset); offset+=2;
207 subtype_id = tvb_get_ntohs(tvb, offset); offset+=2;
209 family = aim_get_family(family_id);
210 subtype = aim_get_subtype(family_id, subtype_id);
212 proto_tree_add_text(group_tree, tvb, offset-4, 4, "Family: %s (0x%04x), Subtype: %s (0x%04x)", family?family->name:"Unknown", family_id, subtype?subtype->name:"Unknown", subtype_id);
216 return offset;
219 static int dissect_aim_generic_clientready(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
221 int offset = 0;
222 proto_item *ti = proto_tree_add_text(gen_tree, tvb, 0, tvb_length(tvb), "Supported services");
223 proto_tree *entry = proto_item_add_subtree(ti, ett_generic_clientready);
225 while(tvb_length_remaining(tvb, offset) > 0) {
226 guint16 famnum = tvb_get_ntohs(tvb, offset);
227 const aim_family *family = aim_get_family(famnum);
229 proto_tree *subentry;
230 ti = proto_tree_add_text(entry, tvb, offset, 2, "%s (0x%x)", family?family->name:"Unknown Family", famnum);
231 offset+=2;
233 subentry = proto_item_add_subtree(ti, ett_generic_clientready_item);
235 proto_tree_add_text(subentry, tvb, offset, 2, "Version: %d", tvb_get_ntohs(tvb, offset) ); offset += 2;
236 proto_tree_add_text(subentry, tvb, offset, 4, "DLL Version: %u", tvb_get_ntoh24(tvb, offset) ); offset += 4;
238 return offset;
242 static int dissect_aim_generic_serverready(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
244 int offset = 0;
245 proto_item *ti = proto_tree_add_text(gen_tree, tvb, offset, tvb_length(tvb), "Supported services");
246 proto_tree *entry = proto_item_add_subtree(ti, ett_generic_clientready);
248 while(tvb_length_remaining(tvb, offset) > 0) {
249 guint16 famnum = tvb_get_ntohs(tvb, offset);
250 const aim_family *family = aim_get_family(famnum);
251 proto_tree_add_text(entry, tvb, offset, 2, "%s (0x%x)", family?family->name:"Unknown Family", famnum);
252 offset+=2;
254 return offset;
258 static int dissect_aim_generic_service_req(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
260 int offset = 0;
261 const aim_family *family = aim_get_family( tvb_get_ntohs(tvb, offset) );
263 proto_tree_add_uint_format(gen_tree, hf_generic_servicereq_service, tvb, offset, 2, tvb_get_ntohs(tvb, offset), "%s (0x%04x)", family?family->name:"Unknown", tvb_get_ntohs(tvb, offset) );
264 offset+=2;
265 return offset;
268 static int dissect_aim_generic_redirect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
270 return dissect_aim_tlv_sequence(tvb, pinfo, 0, gen_tree, aim_client_tlvs);
273 static int dissect_aim_generic_capabilities(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
275 int offset = 0;
276 proto_item *ti = proto_tree_add_text(gen_tree, tvb, offset, tvb_length(tvb), "Requested services");
277 proto_tree *entry = proto_item_add_subtree(ti, ett_generic_clientready);
279 while(tvb_length_remaining(tvb, offset) > 0) {
280 guint16 famnum = tvb_get_ntohs(tvb, offset);
281 const aim_family *family = aim_get_family(famnum);
282 proto_tree_add_text(entry, tvb, offset, 4, "%s (0x%x), Version: %d", family?family->name:"Unknown Family", famnum, tvb_get_ntohs(tvb, offset+2));
283 offset += 4;
285 return offset;
288 static int dissect_aim_generic_capack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
290 int offset = 0;
291 proto_item *ti = proto_tree_add_text(gen_tree, tvb, offset, tvb_length(tvb), "Accepted requested services");
292 proto_tree *entry = proto_item_add_subtree(ti, ett_generic_clientready);
294 while(tvb_length_remaining(tvb, offset) > 0) {
295 guint16 famnum = tvb_get_ntohs(tvb, offset);
296 const aim_family *family = aim_get_family(famnum);
297 proto_tree_add_text(entry, tvb, offset, 4, "%s (0x%x), Version: %d", family?family->name:"Unknown Family", famnum, tvb_get_ntohs(tvb, offset+2));
298 offset += 4;
300 return offset;
303 static int dissect_aim_generic_motd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
305 int offset = 0;
306 proto_tree_add_item(gen_tree, hf_generic_motd_motdtype, tvb, offset,
307 2, tvb_get_ntohs(tvb, offset));
308 offset+=2;
309 return dissect_aim_tlv_sequence(tvb, pinfo, offset, gen_tree, aim_motd_tlvs);
312 static int dissect_aim_generic_rateinfoack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
314 int offset = 0;
315 while(tvb_length_remaining(tvb, offset) > 0) {
316 proto_tree_add_uint(gen_tree, hf_generic_rateinfoack_group, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
317 offset+=2;
319 return offset;
322 static int dissect_aim_generic_ratechange(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
324 int offset = 0;
325 proto_tree_add_uint(gen_tree, hf_generic_ratechange_msg, tvb, offset, 2, tvb_get_ntohs(tvb, offset));
326 offset+=2;
327 offset = dissect_rate_class(tvb, pinfo, offset, gen_tree);
328 return offset;
332 static int dissect_aim_generic_clientpauseack(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
334 int offset = 0;
335 while(tvb_length_remaining(tvb, offset) > 0) {
336 guint16 famnum = tvb_get_ntohs(tvb, offset);
337 const aim_family *family = aim_get_family(famnum);
338 proto_tree_add_text(gen_tree, tvb, offset, 4, "Family: %s (0x%x)", family?family->name:"Unknown Family", famnum);
339 offset += 2;
341 return offset;
344 static int dissect_aim_generic_migration_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
346 int offset = 0;
347 guint32 n, i;
348 proto_item *ti;
349 proto_tree *entry;
351 n = tvb_get_ntohs(tvb, offset);offset+=2;
352 proto_tree_add_uint(gen_tree, hf_generic_migration_numfams, tvb, offset, 2, n);
353 ti = proto_tree_add_text(gen_tree, tvb, offset, 2 * n, "Families to migrate");
354 entry = proto_item_add_subtree(ti, ett_generic_migratefamilies);
355 for(i = 0; i < n; i++) {
356 guint16 famnum = tvb_get_ntohs(tvb, offset);
357 const aim_family *family = aim_get_family(famnum);
358 proto_tree_add_text(entry, tvb, offset, 4, "Family: %s (0x%x)", family?family->name:"Unknown Family", famnum);
359 offset += 2;
362 return dissect_aim_tlv_sequence(tvb, pinfo, offset, gen_tree, aim_client_tlvs);
365 static int dissect_aim_generic_setprivflags(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
367 int offset = 0;
368 guint32 flags = tvb_get_ntoh24(tvb, offset);
369 proto_item *ti = proto_tree_add_uint(gen_tree, hf_generic_priv_flags, tvb, offset, 4, flags);
370 proto_tree *entry = proto_item_add_subtree(ti, ett_generic_priv_flags);
371 proto_tree_add_boolean(entry, hf_generic_allow_idle_see, tvb, offset, 4, flags);
372 proto_tree_add_boolean(entry, hf_generic_allow_member_see, tvb, offset, 4, flags);
373 offset+=4;
374 return offset;
377 static int dissect_aim_generic_selfinfo_repl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
379 int offset = dissect_aim_buddyname(tvb, pinfo, 0, gen_tree);
380 proto_tree_add_item(gen_tree, hf_generic_selfinfo_warninglevel, tvb, offset, 2, ENC_BIG_ENDIAN);
381 offset += 2;
382 return dissect_aim_tlv_list(tvb, pinfo, offset, gen_tree, aim_onlinebuddy_tlvs);
385 static int dissect_aim_generic_evil(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
387 int offset = 0;
388 proto_tree_add_item(gen_tree, hf_generic_evil_new_warn_level, tvb, offset, 2, ENC_BIG_ENDIAN);
389 while(tvb_length_remaining(tvb, offset) > 0) {
390 offset = dissect_aim_userinfo(tvb, pinfo, offset, gen_tree);
392 return offset;
395 static int dissect_aim_generic_setidle(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
397 proto_tree_add_item(gen_tree, hf_generic_idle_time, tvb, 0, 2, ENC_BIG_ENDIAN);
398 return 2;
401 static int dissect_aim_generic_ext_status_req(tvbuff_t *tvb, packet_info *pinfo, proto_tree *gen_tree)
403 return dissect_aim_tlv_sequence(tvb, pinfo, 0, gen_tree, aim_onlinebuddy_tlvs);
406 static int dissect_aim_generic_clientver_req(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
408 int offset = 0;
409 proto_tree_add_item(gen_tree, hf_generic_client_ver_req_offset, tvb, offset, 4, ENC_BIG_ENDIAN);
410 offset+=4;
411 proto_tree_add_item(gen_tree, hf_generic_client_ver_req_length, tvb, offset, 4, ENC_BIG_ENDIAN);
412 return offset+4;
415 static int dissect_aim_generic_clientver_repl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
417 proto_tree_add_item(gen_tree, hf_generic_client_ver_req_hash, tvb, 0, 16, ENC_NA);
418 return 16;
421 static int dissect_aim_generic_ext_status_repl(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *gen_tree)
423 guint8 length;
424 int offset = 0;
425 proto_tree_add_item(gen_tree, hf_generic_ext_status_type, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2;
426 proto_tree_add_item(gen_tree, hf_generic_ext_status_flags, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1;
427 proto_tree_add_item(gen_tree, hf_generic_ext_status_length, tvb, offset, 1, ENC_BIG_ENDIAN); length = tvb_get_guint8(tvb, offset); offset += 1;
428 proto_tree_add_item(gen_tree, hf_generic_ext_status_data, tvb, offset, length, ENC_NA); offset += 1;
429 return offset;
432 static const aim_subtype aim_fnac_family_generic[] = {
433 { 0x0001, "Error", dissect_aim_snac_error },
434 { 0x0002, "Client Ready", dissect_aim_generic_clientready },
435 { 0x0003, "Server Ready", dissect_aim_generic_serverready },
436 { 0x0004, "Service Request", dissect_aim_generic_service_req },
437 { 0x0005, "Redirect", dissect_aim_generic_redirect },
438 { 0x0006, "Rate Info Request", NULL},
439 { 0x0007, "Rate Info", dissect_generic_rateinfo },
440 { 0x0008, "Rate Info Ack", dissect_aim_generic_rateinfoack },
441 { 0x000a, "Rate Change", dissect_aim_generic_ratechange },
442 { 0x000b, "Server Pause", NULL },
443 { 0x000c, "Client Pause Ack", dissect_aim_generic_clientpauseack },
444 { 0x000d, "Server Resume", NULL },
445 { 0x000e, "Self Info Request", NULL },
446 { 0x000f, "Self Info Reply", dissect_aim_generic_selfinfo_repl },
447 { 0x0010, "Evil", dissect_aim_generic_evil },
448 { 0x0011, "Set Idle", dissect_aim_generic_setidle },
449 { 0x0012, "Migration Request", dissect_aim_generic_migration_req },
450 { 0x0013, "Message Of The Day", dissect_aim_generic_motd },
451 { 0x0014, "Set Privilege Flags", dissect_aim_generic_setprivflags },
452 { 0x0015, "Well Known URL", NULL }, /* FIXME */
453 { 0x0016, "noop", NULL },
454 { 0x0017, "Capabilities", dissect_aim_generic_capabilities },
455 { 0x0018, "Capabilities Ack", dissect_aim_generic_capack },
456 { 0x001e, "Set Extended Status Request", dissect_aim_generic_ext_status_req },
457 { 0x001f, "Client Verification Request", dissect_aim_generic_clientver_req },
458 { 0x0020, "Client Verification Reply", dissect_aim_generic_clientver_repl },
459 { 0x0021, "Set Extended Status Reply", dissect_aim_generic_ext_status_repl },
460 { 0, NULL, NULL }
464 /* Register the protocol with Wireshark */
465 void
466 proto_register_aim_generic(void)
469 /* Setup list of header fields */
470 static hf_register_info hf[] = {
471 { &hf_generic_servicereq_service,
472 { "Requested Service", "aim_generic.servicereq.service", FT_UINT16,
473 BASE_HEX, NULL, 0x0, NULL, HFILL },
475 { &hf_generic_motd_motdtype,
476 { "MOTD Type", "aim_generic.motd.motdtype", FT_UINT16,
477 BASE_HEX, VALS(aim_snac_generic_motd_motdtypes), 0x0, NULL, HFILL },
479 { &hf_generic_rateinfo_numclasses,
480 { "Number of Rateinfo Classes", "aim_generic.rateinfo.numclasses", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL },
482 { &hf_generic_rateinfo_windowsize,
483 { "Window Size", "aim_generic.rateinfo.class.window_size", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
485 { &hf_generic_rateinfo_clearlevel,
486 { "Clear Level", "aim_generic.rateinfo.class.clearlevel", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
488 { &hf_generic_rateinfo_alertlevel,
489 { "Alert Level", "aim_generic.rateinfo.class.alertlevel", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
491 { &hf_generic_rateinfo_limitlevel,
492 { "Limit Level", "aim_generic.rateinfo.class.limitlevel", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
494 { &hf_generic_rateinfo_disconnectlevel,
495 { "Disconnect Level", "aim_generic.rateinfo.class.disconnectlevel", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
497 { &hf_generic_rateinfo_currentlevel,
498 { "Current Level", "aim_generic.rateinfo.class.currentlevel", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
500 { &hf_generic_rateinfo_maxlevel,
501 { "Max Level", "aim_generic.rateinfo.class.maxlevel", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
503 { &hf_generic_rateinfo_lasttime,
504 { "Last Time", "aim_generic.rateinfo.class.lasttime", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
506 { &hf_generic_rateinfo_curstate,
507 { "Current State", "aim_generic.rateinfo.class.curstate", FT_UINT8, BASE_HEX, VALS(rateinfo_states), 0x0, NULL, HFILL },
509 { &hf_generic_rateinfo_classid,
510 { "Class ID", "aim_generic.rateinfo.class.id", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL },
512 { &hf_generic_rateinfo_numpairs,
513 { "Number of Family/Subtype pairs", "aim_generic.rateinfo.class.numpairs", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL },
515 { &hf_generic_rateinfoack_group,
516 { "Acknowledged Rate Class", "aim_generic.rateinfoack.class", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL },
518 { &hf_generic_ratechange_msg,
519 { "Rate Change Message", "aim_generic.ratechange.msg", FT_UINT16, BASE_HEX, VALS(ratechange_msgs), 0x0, NULL, HFILL },
521 { &hf_generic_migration_numfams,
522 { "Number of families to migrate", "aim_generic.migrate.numfams", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL },
524 { &hf_generic_priv_flags,
525 { "Privilege flags", "aim_generic.privilege_flags", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL },
527 { &hf_generic_allow_idle_see,
528 { "Allow other users to see idle time", "aim_generic.privilege_flags.allow_idle", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x0001, NULL, HFILL },
530 { &hf_generic_allow_member_see,
531 { "Allow other users to see how long account has been a member", "aim_generic.privilege_flags.allow_member", FT_BOOLEAN, 32, TFS(&tfs_set_notset), 0x0002, NULL, HFILL },
533 { &hf_generic_selfinfo_warninglevel,
534 { "Warning level", "aim_generic.selfinfo.warn_level", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL },
536 { &hf_generic_evil_new_warn_level,
537 { "New warning level", "aim_generic.evil.new_warn_level", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL },
539 { &hf_generic_idle_time,
540 { "Idle time (seconds)", "aim_generic.idle_time", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL },
542 { &hf_generic_client_ver_req_offset,
543 { "Client Verification Request Offset", "aim_generic.client_verification.offset", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL },
545 { &hf_generic_client_ver_req_length,
546 { "Client Verification Request Length", "aim_generic.client_verification.length", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL },
548 { &hf_generic_client_ver_req_hash,
549 { "Client Verification MD5 Hash", "aim_generic.client_verification.hash", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL },
551 { &hf_generic_ext_status_type,
552 { "Extended Status Type", "aim_generic.ext_status.type", FT_UINT16, BASE_DEC, VALS(ext_status_types), 0x0, NULL, HFILL },
554 { &hf_generic_ext_status_flags,
555 { "Extended Status Flags", "aim_generic.ext_status.flags", FT_UINT8, BASE_HEX, VALS(ext_status_flags), 0x0, NULL, HFILL },
557 { &hf_generic_ext_status_length,
558 { "Extended Status Length", "aim_generic.ext_status.length", FT_UINT8, BASE_HEX, NULL, 0x0, NULL , HFILL },
560 { &hf_generic_ext_status_data,
561 { "Extended Status Data", "aim_generic.ext_status.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL , HFILL },
566 /* Setup protocol subtree array */
567 static gint *ett[] = {
568 &ett_generic,
569 &ett_generic_migratefamilies,
570 &ett_generic_rateinfo_class,
571 &ett_generic_rateinfo_group,
572 &ett_generic_rateinfo_groups,
573 &ett_generic_rateinfo_classes,
574 &ett_generic_clientready,
575 &ett_generic_clientready_item,
576 &ett_generic_serverready,
577 &ett_generic_priv_flags,
580 /* Register the protocol name and description */
581 proto_aim_generic = proto_register_protocol("AIM Generic Service", "AIM Generic", "aim_generic");
583 /* Required function calls to register the header fields and subtrees used */
584 proto_register_field_array(proto_aim_generic, hf, array_length(hf));
585 proto_register_subtree_array(ett, array_length(ett));
588 void
589 proto_reg_handoff_aim_generic(void)
591 aim_init_family(proto_aim_generic, ett_generic, FAMILY_GENERIC, aim_fnac_family_generic);