Ethereal-dev: [Ethereal-dev] packet-tds.c patch / [off-topic] - a unified diff tool for Win32
Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.
From: Yaniv Kaul <ykaul@xxxxxxxxxxxx>
Date: Sun, 01 Feb 2004 17:37:34 +0200
This patch to packet-tds.c (over CVS nightly tarball from Jan20) adds
dissection to result token, login_ack token, corrects a small bug in the
login packet dissection and a partial dissection to query packet.
Q - I'm trying to set up a complete work environment on Win32. I've managed to get the CVS client but I'm having problems getting a diff tool that will create the unified diff. Any suggestions?
298d297 < static gint ett_tds7_query = 0; 369c368 < {TDS7_RESULT_TOKEN, "TDS7+ Results"}, --- > {TDS7_RESULT_TOKEN, "Results"}, 469,493d467 < dissect_tds_query_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) < { < guint offset, len; < gboolean is_unicode = TRUE; < char *msg; < < proto_item *query_hdr; < proto_tree *query_tree; < < offset = 0; < query_hdr = proto_tree_add_text(tree, tvb, offset, -1, "TDS Query Packet"); < query_tree = proto_item_add_subtree(query_hdr, ett_tds7_query); < len = tvb_reported_length_remaining(tvb, offset); < if((len < 2) || tvb_get_guint8(tvb, offset+1) !=0) < is_unicode = FALSE; < < if (is_unicode) { < msg = tvb_fake_unicode(tvb, offset, len/2, TRUE); < proto_tree_add_text(query_tree, tvb, offset, len, "Query: %s", msg); < g_free(msg); < offset += len; < } < } < < static void 581,594c555,565 < if( i != 2) { < if (is_unicode == TRUE) { < val = tvb_fake_unicode(tvb, offset2, len, TRUE); < len *= 2; < } else < val = tvb_get_string(tvb, offset2, len); < proto_tree_add_text(login_tree, tvb, offset2, len, "%s: %s", val_to_str(i, login_field_names, "Unknown"), val); < g_free(val); < } < else { < if (is_unicode) < len *= 2; < proto_tree_add_text(login_tree, tvb, offset2, len, "%s", val_to_str(i, login_field_names, "Unknown")); < } --- > if (is_unicode == TRUE) { > val = tvb_fake_unicode(tvb, offset2, len, > TRUE); > len *= 2; > } else > val = tvb_get_string(tvb, offset2, len); > proto_tree_add_text(login_tree, tvb, offset2, len, > "%s: %s", > val_to_str(i, login_field_names, "Unknown"), > val); > g_free(val); 632d602 < case TDS7_RESULT_TOKEN: 983,1066d952 < dissect_tds_login_ack_token(tvbuff_t *tvb, guint offset, guint token_sz, proto_tree *tree) < { < guint8 msg_len; < char *msg; < gboolean is_unicode = FALSE; < < proto_tree_add_text(tree, tvb, offset, 1, "Ack: %u", tvb_get_guint8(tvb, offset)); < offset +=1; < proto_tree_add_text(tree, tvb, offset, 1, "Major version (may be incorrect): %d", tvb_get_guint8(tvb, offset)); < offset +=1; < proto_tree_add_text(tree, tvb, offset, 1, "Minor version (may be incorrect): %d", tvb_get_guint8(tvb, offset)); < offset +=1; < proto_tree_add_text(tree, tvb, offset, 2, "zero usually"); < offset +=2; < < msg_len = tvb_get_guint8(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 1, "Text length: %u characters", msg_len); < offset +=1; < < if(msg_len + 6U + 3U != token_sz - 1) /* 6 is the length of ack(1), version (4), text length (1) fields */ < is_unicode = TRUE; < proto_tree_add_text(tree, tvb, offset, 0, "msg_len: %d, token_sz: %d, total: %d",msg_len, token_sz, msg_len + 6U + 3U); < if(is_unicode) { < msg = tvb_fake_unicode(tvb, offset, msg_len, TRUE); < msg_len *= 2; < } else { < msg = tvb_get_string(tvb, offset, msg_len); < } < proto_tree_add_text(tree, tvb, offset, msg_len, "Text: %s", format_text(msg, strlen(msg))); < g_free(msg); < offset += msg_len; < < proto_tree_add_text(tree, tvb, offset, 4, "Server Version"); < offset += 4; < } < < int < dissect_tds7_results_token(tvbuff_t *tvb, guint offset, guint token_sz, proto_tree *tree) < { < guint16 num_columns; < guint8 type, msg_len; < int i; < char *msg; < guint16 collate_codepage, collate_flags; < guint8 collate_charset_id; < < num_columns = tvb_get_letohs(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 2, "Columns: %u", tvb_get_letohs(tvb, offset)); < offset +=2; < for(i=0; i != num_columns; i++) { < proto_tree_add_text(tree, tvb, offset, 2, "usertype: %d", tvb_get_letohs(tvb, offset)); < offset +=2; < proto_tree_add_text(tree, tvb, offset, 2, "flags: %d", tvb_get_letohs(tvb, offset)); < offset +=2; < type = tvb_get_guint8(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 1, "Type: %d", type); < offset +=1; < if(type > 128) { < proto_tree_add_text(tree, tvb, offset, 2, "Large type size: 0x%x", tvb_get_letohs(tvb, offset)); < offset += 2; < collate_codepage = tvb_get_letohs(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 2, "Codepage: %u" , collate_codepage); < offset += 2; < collate_flags = tvb_get_letohs(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 2, "Flags: 0x%x", collate_flags); < offset += 2; < collate_charset_id = tvb_get_guint8(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 1, "Charset ID: %u", collate_charset_id); < offset +=1; < } < msg_len = tvb_get_guint8(tvb, offset); < proto_tree_add_text(tree, tvb, offset, 1, "message length: %d",msg_len); < offset += 1; < if(msg_len != 0) { < msg = tvb_fake_unicode(tvb, offset, msg_len, TRUE); < proto_tree_add_text(tree, tvb, offset, msg_len*2, "Text: %s", format_text(msg, strlen(msg))); < g_free(msg); < offset += msg_len*2; < } < } < return offset; < } < < static void 1180,1185d1065 < case TDS_LOGIN_ACK_TOKEN: < dissect_tds_login_ack_token(tvb, pos + 3, token_sz - 3, token_tree); < break; < case TDS7_RESULT_TOKEN: < pos = (dissect_tds7_results_token(tvb, pos + 1, token_sz - 1, token_tree)-1); < break; 1299,1301c1179 < case TDS_QUERY_PKT: < dissect_tds_query_packet(next_tvb, pinfo, tds_tree); < break; --- >
- Follow-Ups:
- Prev by Date: Re: [Ethereal-dev] Implemented rudimentary Drag and Drop support.
- Next by Date: RE: [Ethereal-dev] Capturing from multiple interfaces, and why we need this.
- Previous by thread: Re: [Ethereal-dev] randpkt.c patch
- Next by thread: Re: [Ethereal-dev] packet-tds.c patch / [off-topic] - a unified diff tool for Win32
- Index(es):