2 * Routines for AIM Instant Messenger (OSCAR) dissection, SNAC Signon
3 * Copyright 2004, Jelmer Vernooij <jelmer@samba.org>
4 * Copyright 2000, Ralf Hoelzer <ralf@well.com>
8 * Wireshark - Network traffic analyzer
9 * By Gerald Combs <gerald@wireshark.org>
10 * Copyright 1998 Gerald Combs
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 #include <epan/packet.h>
32 #include <epan/strutil.h>
34 #include "packet-aim.h"
36 void proto_register_aim_signon(void);
37 void proto_reg_handoff_aim_signon(void);
39 #define FAMILY_SIGNON 0x0017
42 /* Initialize the protocol and registered fields */
43 static int proto_aim_signon
= -1;
44 static int hf_aim_infotype
= -1;
45 static int hf_aim_signon_challenge_len
= -1;
46 static int hf_aim_signon_challenge
= -1;
49 /* Initialize the subtree pointers */
50 static gint ett_aim_signon
= -1;
52 static int dissect_aim_snac_signon_logon(tvbuff_t
*tvb
, packet_info
*pinfo
,
56 while (tvb_length_remaining(tvb
, offset
) > 0) {
57 offset
= dissect_aim_tlv(tvb
, pinfo
, offset
, tree
, aim_client_tlvs
);
62 static int dissect_aim_snac_signon_logon_reply(tvbuff_t
*tvb
,
67 while (tvb_length_remaining(tvb
, offset
) > 0) {
68 offset
= dissect_aim_tlv(tvb
, pinfo
, offset
, tree
, aim_client_tlvs
);
73 static int dissect_aim_snac_signon_signon(tvbuff_t
*tvb
, packet_info
*pinfo
,
76 guint8 buddyname_length
= 0;
78 guchar buddyname
[MAX_BUDDYNAME_LENGTH
+ 1];
81 proto_tree_add_item(tree
, hf_aim_infotype
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
88 buddyname_length
= aim_get_buddyname( buddyname
, tvb
, offset
, offset
+ 1 );
90 col_append_fstr(pinfo
->cinfo
, COL_INFO
, " Username: %s",
91 format_text(buddyname
, buddyname_length
));
94 offset
+=dissect_aim_buddyname(tvb
, pinfo
, offset
, tree
);
100 static int dissect_aim_snac_signon_signon_reply(tvbuff_t
*tvb
,
101 packet_info
*pinfo _U_
,
105 guint16 challenge_length
= 0;
107 /* Logon Challenge Length */
108 challenge_length
= tvb_get_ntohs(tvb
, offset
);
109 proto_tree_add_item(tree
, hf_aim_signon_challenge_len
, tvb
, offset
, 2, ENC_BIG_ENDIAN
);
113 proto_tree_add_item(tree
, hf_aim_signon_challenge
, tvb
, offset
, challenge_length
, ENC_ASCII
|ENC_NA
);
114 offset
+= challenge_length
;
118 static int dissect_aim_tlv_value_registration(proto_item
*ti _U_
, guint16 value_id _U_
, tvbuff_t
*tvb _U_
, packet_info
*pinfo _U_
)
124 #define REG_TLV_REGISTRATION_INFO 0x0001
126 static const aim_tlv aim_registration_tlvs
[] = {
127 { REG_TLV_REGISTRATION_INFO
, "Registration Info", dissect_aim_tlv_value_registration
},
131 static int dissect_aim_snac_register (tvbuff_t
*tvb
, packet_info
*pinfo
, proto_tree
*tree
)
133 return dissect_aim_tlv(tvb
, pinfo
, 0, tree
, aim_registration_tlvs
);
136 static const aim_subtype aim_fnac_family_signon
[] = {
137 { 0x0001, "Error", dissect_aim_snac_error
},
138 { 0x0002, "Logon", dissect_aim_snac_signon_logon
},
139 { 0x0003, "Logon Reply", dissect_aim_snac_signon_logon_reply
},
140 { 0x0004, "Request UIN", dissect_aim_snac_register
},
141 { 0x0005, "New UIN response", dissect_aim_snac_register
},
142 { 0x0006, "Sign-on", dissect_aim_snac_signon_signon
},
143 { 0x0007, "Sign-on Reply", dissect_aim_snac_signon_signon_reply
},
144 { 0x000a, "Server SecureID Request", NULL
},
145 { 0x000b, "Client SecureID Reply", NULL
},
150 /* Register the protocol with Wireshark */
152 proto_register_aim_signon(void)
155 /* Setup list of header fields */
156 static hf_register_info hf
[] = {
158 { "Infotype", "aim_signon.infotype", FT_UINT16
, BASE_HEX
, NULL
, 0x0, NULL
, HFILL
}
160 { &hf_aim_signon_challenge_len
,
161 { "Signon challenge length", "aim_signon.challengelen", FT_UINT16
, BASE_DEC
, NULL
, 0x0, NULL
, HFILL
}
163 { &hf_aim_signon_challenge
,
164 { "Signon challenge", "aim_signon.challenge", FT_STRING
, BASE_NONE
, NULL
, 0x0, NULL
, HFILL
}
168 /* Setup protocol subtree array */
169 static gint
*ett
[] = {
173 /* Register the protocol name and description */
174 proto_aim_signon
= proto_register_protocol("AIM Signon", "AIM Signon", "aim_signon");
176 /* Required function calls to register the header fields and subtrees used */
177 proto_register_field_array(proto_aim_signon
, hf
, array_length(hf
));
178 proto_register_subtree_array(ett
, array_length(ett
));
182 proto_reg_handoff_aim_signon(void)
184 aim_init_family(proto_aim_signon
, ett_aim_signon
, FAMILY_SIGNON
, aim_fnac_family_signon
);