Ethereal-dev: [Ethereal-dev] packet-aim patch
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Ralf Holzer <ralf@xxxxxxxx>
Date: Thu, 23 Nov 2000 16:10:55 -0500
Hi, the attached patch fixes some minor bugs and adds simple support for signon/offs and chats rooms. regards, Ralf
Index: packet-aim.c =================================================================== RCS file: /cvsroot/ethereal/packet-aim.c,v retrieving revision 1.3 diff -u -3 -p -r1.3 packet-aim.c --- packet-aim.c 2000/11/19 08:53:54 1.3 +++ packet-aim.c 2000/11/23 20:54:05 @@ -75,15 +75,17 @@ #define FAMILY_TRANSLATE 0x000C #define FAMILY_CHAT_NAV 0x000D #define FAMILY_CHAT 0x000E +#define FAMILY_SIGNON 0x0017 /* messaging */ -#define MSG_FROM_CLIENT 0x006 -#define MSG_TO_CLIENT 0x007 +#define MSG_TO_CLIENT 0x006 +#define MSG_FROM_CLIENT 0x007 static void dissect_aim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree); -void get_message( u_char *msg, tvbuff_t *tvb, int msg_offset, int msg_length); -int get_buddyname( char *name, tvbuff_t *tvb, int len_offset, int name_offset); +static void get_message( u_char *msg, tvbuff_t *tvb, int msg_offset, int msg_length); +static int get_buddyname( char *name, tvbuff_t *tvb, int len_offset, int name_offset); + /* Initialize the protocol and registered fields */ static int proto_aim = -1; static int hf_aim_cmd_start = -1; @@ -179,7 +181,7 @@ static void dissect_aim(tvbuff_t *tvb, p } if( tree ) { - ti1 = proto_tree_add_text(aim_tree, tvb, 6, tvb_length(tvb), "FNAC"); + ti1 = proto_tree_add_text(aim_tree, tvb, 6, tvb_length(tvb) - 6, "FNAC"); aim_tree_fnac = proto_item_add_subtree(ti1, ett_aim_fnac); proto_tree_add_uint(aim_tree_fnac, hf_aim_fnac_family, tvb, 6, 2, family); proto_tree_add_uint(aim_tree_fnac, hf_aim_fnac_subtype, tvb, 8, 2, subtype); @@ -191,6 +193,46 @@ static void dissect_aim(tvbuff_t *tvb, p switch(family) { + case FAMILY_SIGNON: + switch(subtype) + { + case 0x0002: + buddyname_length = get_buddyname( buddyname, tvb, 19, 20 ); + + if (check_col(pinfo->fd, COL_INFO)) { + col_add_fstr(pinfo->fd, COL_INFO, "Login"); + col_append_fstr(pinfo->fd, COL_INFO, ": %s", buddyname); + } + + if( tree ) + { + proto_tree_add_text(aim_tree_fnac, tvb, 20, buddyname_length, "Screen Name: %s", buddyname); + } + + break; + case 0x0003: + if (check_col(pinfo->fd, COL_INFO)) col_add_fstr(pinfo->fd, COL_INFO, "Login information reply"); + break; + case 0x0006: + buddyname_length = get_buddyname( buddyname, tvb, 19, 20 ); + + if (check_col(pinfo->fd, COL_INFO)) { + col_add_fstr(pinfo->fd, COL_INFO, "Sign-on"); + col_append_fstr(pinfo->fd, COL_INFO, ": %s", buddyname); + } + + if( tree ) + { + proto_tree_add_text(aim_tree_fnac, tvb, 20, buddyname_length, "Screen Name: %s", buddyname); + } + + break; + case 0x0007: + if (check_col(pinfo->fd, COL_INFO)) col_add_fstr(pinfo->fd, COL_INFO, "Sign-on reply"); + break; + } + break; + case FAMILY_GENERIC: switch(subtype) { @@ -248,7 +290,7 @@ static void dissect_aim(tvbuff_t *tvb, p buddyname_length = get_buddyname( buddyname, tvb, 16, 17 ); if (check_col(pinfo->fd, COL_INFO)) { - col_add_str(pinfo->fd, COL_INFO, "Oncoming Buddy"); + col_add_fstr(pinfo->fd, COL_INFO, "Oncoming Buddy"); col_append_fstr(pinfo->fd, COL_INFO, ": %s", buddyname); } @@ -264,7 +306,7 @@ static void dissect_aim(tvbuff_t *tvb, p buddyname_length = get_buddyname( buddyname, tvb, 16, 17 ); if (check_col(pinfo->fd, COL_INFO)) { - col_add_str(pinfo->fd, COL_INFO, "Offgoing Buddy"); + col_add_fstr(pinfo->fd, COL_INFO, "Offgoing Buddy"); col_append_fstr(pinfo->fd, COL_INFO, ": %s", buddyname); } @@ -338,17 +380,50 @@ static void dissect_aim(tvbuff_t *tvb, p } break; + case FAMILY_CHAT: + switch(subtype) + { + case 0x005: + /* channel message from client */ + get_message( msg, tvb, 40 + buddyname_length, tvb_length(tvb) - 40 - buddyname_length ); + + if (check_col(pinfo->fd, COL_INFO)) { + col_add_fstr(pinfo->fd, COL_INFO, "Chat Message "); + col_append_fstr(pinfo->fd, COL_INFO, " -> %s", msg); + } + break; + + case 0x006: + /* channel message to client */ + buddyname_length = get_buddyname( buddyname, tvb, 30, 31 ); + get_message( msg, tvb, 36 + buddyname_length, tvb_length(tvb) - 36 - buddyname_length ); + + if (check_col(pinfo->fd, COL_INFO)) { + col_add_fstr(pinfo->fd, COL_INFO, "Chat Message "); + col_append_fstr(pinfo->fd, COL_INFO, "from: %s", buddyname); + col_append_fstr(pinfo->fd, COL_INFO, " -> %s", msg); + } + + if( tree ) + { + proto_tree_add_text(aim_tree_fnac, tvb, 31, buddyname_length, "Screen Name: %s", buddyname); + } + break; + } + break; + + case FAMILY_MESSAGING: switch(subtype) { - case MSG_FROM_CLIENT: + case MSG_TO_CLIENT: buddyname_length = get_buddyname( buddyname, tvb, 26, 27 ); get_message( msg, tvb, 36 + buddyname_length, tvb_length(tvb) - 36 - buddyname_length ); if (check_col(pinfo->fd, COL_INFO)) { - col_add_str(pinfo->fd, COL_INFO, "Message "); - col_append_fstr(pinfo->fd, COL_INFO, "from: %s", buddyname); + col_add_fstr(pinfo->fd, COL_INFO, "Message "); + col_append_fstr(pinfo->fd, COL_INFO, "to: %s", buddyname); col_append_fstr(pinfo->fd, COL_INFO, " -> %s", msg); } @@ -359,14 +434,14 @@ static void dissect_aim(tvbuff_t *tvb, p break; - case MSG_TO_CLIENT: + case MSG_FROM_CLIENT: buddyname_length = get_buddyname( buddyname, tvb, 26, 27 ); get_message( msg, tvb, 36 + buddyname_length, tvb_length(tvb) - 36 - buddyname_length); if (check_col(pinfo->fd, COL_INFO)) { - col_add_str(pinfo->fd, COL_INFO, "Message"); - col_append_fstr(pinfo->fd, COL_INFO, " to: %s", buddyname); + col_add_fstr(pinfo->fd, COL_INFO, "Message"); + col_append_fstr(pinfo->fd, COL_INFO, " from: %s", buddyname); col_append_fstr(pinfo->fd, COL_INFO, " -> %s", msg); } @@ -409,7 +484,7 @@ static void dissect_aim(tvbuff_t *tvb, p } -int get_buddyname( char *name, tvbuff_t *tvb, int len_offset, int name_offset) +static int get_buddyname( char *name, tvbuff_t *tvb, int len_offset, int name_offset) { guint8 buddyname_length; @@ -423,7 +498,7 @@ int get_buddyname( char *name, tvbuff_t } -void get_message( u_char *msg, tvbuff_t *tvb, int msg_offset, int msg_length) +static void get_message( u_char *msg, tvbuff_t *tvb, int msg_offset, int msg_length) { int i,j,c; int bracket = FALSE; @@ -502,7 +577,8 @@ void get_message( u_char *msg, tvbuff_t /* Register the protocol with Ethereal */ -void proto_register_aim(void) +void +proto_register_aim(void) { /* Setup list of header fields */
- Follow-Ups:
- Re: [Ethereal-dev] packet-aim patch
- From: Guy Harris
- Re: [Ethereal-dev] packet-aim patch
- From: Guy Harris
- Re: [Ethereal-dev] packet-aim patch
- Prev by Date: [Ethereal-dev] manuf just got bigger
- Next by Date: RE: [Ethereal-dev] Update to Packet Fence (Version 1.1)
- Previous by thread: Re: [Ethereal-dev] manuf just got bigger
- Next by thread: Re: [Ethereal-dev] packet-aim patch
- Index(es):