这篇教程C++ tvb_length_remaining函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tvb_length_remaining函数的典型用法代码示例。如果您正苦于以下问题:C++ tvb_length_remaining函数的具体用法?C++ tvb_length_remaining怎么用?C++ tvb_length_remaining使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tvb_length_remaining函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: dissect_sss_requestvoiddissect_sss_request(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, ncp_req_hash_value *request_value){ guint8 /*func,*/ subfunc = 0; guint32 subverb=0; guint32 msg_length=0; guint32 foffset= 0; proto_tree *atree; proto_item *aitem; if (tvb_length_remaining(tvb, foffset)<4) { return; } foffset = 6; /*func = tvb_get_guint8(tvb, foffset);*/ foffset += 1; subfunc = tvb_get_guint8(tvb, foffset); foffset += 1; /* Fill in the PROTOCOL & INFO columns. */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "NSSS"); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "C SecretStore - %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)")); } switch (subfunc) { case 1: aitem = proto_tree_add_text(ncp_tree, tvb, foffset, tvb_length_remaining(tvb, foffset), "Packet Type: %s", val_to_str(subfunc, sss_func_enum, "Unknown (%d)")); atree = proto_item_add_subtree(aitem, ett_sss); proto_tree_add_item(atree, hf_ping_version, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; proto_tree_add_item(atree, hf_flags, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; break; case 2: proto_tree_add_item(ncp_tree, hf_frag_handle, tvb, foffset, 4, ENC_LITTLE_ENDIAN); if (tvb_get_letohl(tvb, foffset)==0xffffffff) /* Fragment handle of -1 means no fragment. So process packet */ { foffset += 4; proto_tree_add_item(ncp_tree, hf_buffer_size, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; proto_tree_add_item(ncp_tree, hf_length, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; foffset += 12; /* Blank Context */ subverb = tvb_get_letohl(tvb, foffset); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(subverb, sss_verb_enum, "Unknown (%d)")); } aitem = proto_tree_add_item(ncp_tree, hf_verb, tvb, foffset, 4, ENC_LITTLE_ENDIAN); atree = proto_item_add_subtree(aitem, ett_sss); if (request_value) { request_value->req_nds_flags=subverb; } foffset += 4; process_flags(atree, tvb, foffset); foffset += 4; proto_tree_add_item(atree, hf_context, tvb, foffset, 4, ENC_BIG_ENDIAN); foffset += 4; switch (subverb) { case 0: foffset += 4; foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0); break; case 1: foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0); msg_length = tvb_get_letohl(tvb, foffset); foffset += (msg_length+4); /* Unsure of what this length and parameter are */ /* A bad secret of length greater then 256 characters will cause frag packets and then we will see these as malformed packets. So check to make sure we still have data in the packet anytime we read a secret. */ if (tvb_length_remaining(tvb, foffset) > 4) { foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0); } break; case 2: foffset += 4; foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0); if (tvb_length_remaining(tvb, foffset) > 4) { msg_length = tvb_get_letohl(tvb, foffset); foffset += 4; if (tvb_length_remaining(tvb, foffset) < (gint) msg_length) { proto_tree_add_item(atree, hf_enc_data, tvb, foffset, -1, ENC_NA); } else { proto_tree_add_item(atree, hf_enc_data, tvb, foffset, msg_length, ENC_NA); } } break; case 3: case 4: foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, 0); if (tvb_length_remaining(tvb, foffset) > 4) { foffset = sss_string(tvb, hf_user, atree, foffset, TRUE, 0); }//.........这里部分代码省略.........
开发者ID:mcrotty,项目名称:stack,代码行数:101,
示例2: dissect_turbocellstatic void dissect_turbocell(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ proto_item *ti, *name_item; proto_tree *turbocell_tree = NULL, *network_tree; tvbuff_t *next_tvb; int i=0; guint8 packet_type; guint8 * str_name; guint str_len; gint remaining_length; packet_type = tvb_get_guint8(tvb, 0); if (!(packet_type & 0x0F)){ col_set_str(pinfo->cinfo, COL_INFO, "Turbocell Packet (Beacon)"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "Turbocell"); } else if ( packet_type == TURBOCELL_TYPE_MANAGEMENT ) { col_set_str(pinfo->cinfo, COL_INFO, "Turbocell Packet (Management)"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "Turbocell"); } else if ( packet_type == TURBOCELL_TYPE_DATA ) { col_set_str(pinfo->cinfo, COL_INFO, "Turbocell Packet (Data)"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "Turbocell"); } else { col_set_str(pinfo->cinfo, COL_INFO, "Turbocell Packet (Unknown)"); col_set_str(pinfo->cinfo, COL_PROTOCOL, "Turbocell"); } if (tree) { ti = proto_tree_add_item(tree, proto_turbocell, tvb, 0, 20, ENC_NA); turbocell_tree = proto_item_add_subtree(ti, ett_turbocell); proto_tree_add_item(turbocell_tree, hf_turbocell_type, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(turbocell_tree, hf_turbocell_satmode, tvb, 1, 1, ENC_BIG_ENDIAN); proto_tree_add_item(turbocell_tree, hf_turbocell_nwid, tvb, 1, 1, ENC_BIG_ENDIAN); /* it seem when we have this magic number,that means an alternate header version */ if (tvb_get_bits64(tvb, 64,48,ENC_BIG_ENDIAN) != G_GINT64_CONSTANT(0x000001fe23dc45ba)){ proto_tree_add_item(turbocell_tree, hf_turbocell_counter, tvb, 0x02, 2, ENC_BIG_ENDIAN); proto_tree_add_item(turbocell_tree, hf_turbocell_dst, tvb, 0x04, 6, ENC_NA); proto_tree_add_item(turbocell_tree, hf_turbocell_timestamp, tvb, 0x0A, 3, ENC_BIG_ENDIAN); } else { proto_tree_add_item(turbocell_tree, hf_turbocell_timestamp, tvb, 0x02, 3, ENC_BIG_ENDIAN); proto_tree_add_item(turbocell_tree, hf_turbocell_counter, tvb, 0x05, 3, ENC_BIG_ENDIAN); proto_tree_add_item(turbocell_tree, hf_turbocell_dst, tvb, 0x08, 6, ENC_NA); } proto_tree_add_item(turbocell_tree, hf_turbocell_unknown, tvb, 0x0E, 2, ENC_BIG_ENDIAN); proto_tree_add_item(turbocell_tree, hf_turbocell_ip, tvb, 0x10, 4, ENC_BIG_ENDIAN); } remaining_length=tvb_length_remaining(tvb, 0x14); if (remaining_length > 6) { /* If the first character is a printable character that means we have a payload with network info */ /* I couldn't find anything in the header that would definitvely indicate if payload is either data or network info */ /* Since the frame size is limited this should work ok */ if (tvb_get_guint8(tvb, 0x14)>=0x20){ name_item = proto_tree_add_item(turbocell_tree, hf_turbocell_name, tvb, 0x14, 30, ENC_ASCII|ENC_NA); network_tree = proto_item_add_subtree(name_item, ett_network); str_name=tvb_get_stringz(wmem_packet_scope(), tvb, 0x14, &str_len); col_append_fstr(pinfo->cinfo, COL_INFO, ", Network=/"%s/"",format_text(str_name, str_len-1)); while(tvb_get_guint8(tvb, 0x34 + 8*i)==0x00 && (tvb_length_remaining(tvb,0x34 + 8*i) > 6) && (i<32)) { proto_tree_add_item(network_tree, hf_turbocell_station[i], tvb, 0x34+8*i, 6, ENC_NA); i++; } /*Couldn't make sense of the apparently random data in the end*/ next_tvb = tvb_new_subset_remaining(tvb, 0x34 + 8*i); call_dissector(data_handle, next_tvb, pinfo, tree); } else { tvbuff_t *volatile msdu_tvb = NULL; guint32 msdu_offset = 0x04; guint16 j = 1; guint16 msdu_length; proto_item *parent_item; proto_tree *mpdu_tree; proto_tree *subframe_tree; next_tvb = tvb_new_subset(tvb, 0x14, -1, tvb_get_ntohs(tvb, 0x14)); parent_item = proto_tree_add_protocol_format(tree, proto_aggregate, next_tvb, 0, tvb_reported_length_remaining(next_tvb, 0), "Turbocell Aggregate Frames"); mpdu_tree = proto_item_add_subtree(parent_item, ett_msdu_aggregation_parent_tree); proto_tree_add_item(mpdu_tree, hf_turbocell_aggregate_len, next_tvb, 0x00, 2, ENC_BIG_ENDIAN); proto_tree_add_item(mpdu_tree, hf_turbocell_aggregate_unknown1, next_tvb, 0x02, 2, ENC_BIG_ENDIAN); remaining_length=tvb_length_remaining(next_tvb, msdu_offset);//.........这里部分代码省略.........
开发者ID:AndresVelasco,项目名称:wireshark,代码行数:101,
示例3: dissect_icep_replystatic void dissect_icep_reply(tvbuff_t *tvb, guint32 offset, packet_info *pinfo, proto_tree *icep_tree, proto_item* icep_item){ /* p. 614, chapter 23.3.4: * * struct ReplyData { * int requestId; * byte replyStatus; * [... messageSize - 19 bytes ... ] * } */ gint32 messageSize = 0; guint32 tvb_data_remained = 0; guint32 reported_reply_data = 0; proto_item *ti = NULL; proto_tree *icep_sub_tree = NULL; DBG0("dissect reply/n"); /* get at least a full reply message header */ if ( !tvb_bytes_exist(tvb, offset, ICEP_MIN_REPLY_SIZE) ) { if (icep_item) expert_add_info_format(pinfo, icep_item, PI_MALFORMED, PI_ERROR, "too short header"); col_append_str(mypinfo->cinfo, COL_INFO, " (too short header)"); return; } /* got 5 bytes, then data */ /* create display subtree for this message type */ if (icep_tree) { ti = proto_tree_add_text(icep_tree, tvb, offset, -1, "Reply Message Body"); icep_sub_tree = proto_item_add_subtree(ti, ett_icep_msg); proto_tree_add_item(icep_sub_tree, hf_icep_request_id, tvb, offset, 4, ENC_LITTLE_ENDIAN); } if ( check_col(mypinfo->cinfo, COL_INFO) ) { col_append_fstr(mypinfo->cinfo, COL_INFO, "(%d):", tvb_get_letohl(tvb, offset)); } offset += 4; if (icep_tree) proto_tree_add_item(icep_sub_tree, hf_icep_reply_status, tvb, offset, 1, ENC_LITTLE_ENDIAN); if ( check_col(mypinfo->cinfo, COL_INFO) ) { col_append_fstr(mypinfo->cinfo, COL_INFO, " %s", val_to_str_const(tvb_get_guint8(tvb, offset), icep_replystatus_vals, "unknown reply status")); } offset++; DBG1("consumed --> %d/n", 5); /* check if I got all reply data */ tvb_data_remained = tvb_length_remaining(tvb, offset); messageSize = tvb_get_letohl(tvb, 10); reported_reply_data = messageSize - (ICEP_HEADER_SIZE + ICEP_MIN_REPLY_SIZE); /* no */ if ( tvb_data_remained < reported_reply_data ) { if (icep_sub_tree) expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Reply Data (missing %d bytes out of %d)", reported_reply_data - tvb_data_remained, reported_reply_data); if ( check_col(mypinfo->cinfo, COL_INFO) ) { col_append_fstr(mypinfo->cinfo, COL_INFO, " (missing reply data, %d bytes)", reported_reply_data - tvb_data_remained); } /*offset += tvb_data_remained;*/ DBG1("consumed --> %d/n", tvb_data_remained); return; } /* yes (reported_reply_data can be 0) */ if (icep_sub_tree) { proto_tree_add_item(icep_sub_tree, hf_icep_reply_data, tvb, offset, reported_reply_data, ENC_NA); } /*offset += reported_reply_data;*/ DBG1("consumed --> %d/n", reported_reply_data);//.........这里部分代码省略.........
开发者ID:SayCV,项目名称:wireshark,代码行数:101,
示例4: dissect_dccreqstatic voiddissect_dccreq (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree){ guint16 pos; guint8 type, length; proto_tree *dcc_tree; proto_item *dcc_item; guint16 len; len = tvb_length_remaining (tvb, 0); col_set_str(pinfo->cinfo, COL_INFO, "DCC-REQ Message: "); if (tree) { dcc_item = proto_tree_add_protocol_format (tree, proto_docsis_dccreq, tvb, 0, -1, "DCC-REQ Message"); dcc_tree = proto_item_add_subtree (dcc_item, ett_docsis_dccreq); proto_tree_add_item (dcc_tree, hf_docsis_dccreq_tran_id, tvb, 0, 2, ENC_BIG_ENDIAN); pos = 2; while (pos < len) { type = tvb_get_guint8 (tvb, pos++); length = tvb_get_guint8 (tvb, pos++); switch (type) { case DCCREQ_UP_CHAN_ID: if (length == 1) { proto_tree_add_item (dcc_tree, hf_docsis_dccreq_up_chan_id, tvb, pos, length, ENC_BIG_ENDIAN); } else { THROW (ReportedBoundsError); } break; case DCCREQ_DS_PARAMS: dissect_dccreq_ds_params (tvb , dcc_tree , pos , length ); break; case DCCREQ_INIT_TECH: if (length == 1) { proto_tree_add_item (dcc_tree, hf_docsis_dccreq_init_tech, tvb, pos, length, ENC_BIG_ENDIAN); } else { THROW (ReportedBoundsError); } break; case DCCREQ_UCD_SUB: proto_tree_add_item (dcc_tree, hf_docsis_dccreq_ucd_sub, tvb, pos, length, ENC_NA); break; case DCCREQ_SAID_SUB: if (length == 4) { proto_tree_add_item (dcc_tree, hf_docsis_dccreq_said_sub_cur, tvb, pos, 2, ENC_BIG_ENDIAN); proto_tree_add_item (dcc_tree, hf_docsis_dccreq_said_sub_new, tvb, pos + 2, 2, ENC_BIG_ENDIAN); } else { THROW (ReportedBoundsError); } break; case DCCREQ_SF_SUB: dissect_dccreq_sf_sub (tvb , dcc_tree , pos , length ); break; case DCCREQ_CMTS_MAC_ADDR: if (length == 6) { proto_tree_add_item (dcc_tree, hf_docsis_dccreq_cmts_mac_addr, tvb, pos, length, ENC_NA); } else { THROW (ReportedBoundsError); } break; case DCCREQ_KEY_SEQ_NUM: if (length == 1) { proto_tree_add_item (dcc_tree, hf_docsis_dccreq_key_seq_num, tvb, pos, length, ENC_BIG_ENDIAN); } else { THROW (ReportedBoundsError); } break; case DCCREQ_HMAC_DIGEST: if (length == 20) { proto_tree_add_item (dcc_tree, hf_docsis_dccreq_hmac_digest, tvb,//.........这里部分代码省略.........
开发者ID:jiangxilong,项目名称:wireshark-1,代码行数:101,
示例5: dissect_sndcp//.........这里部分代码省略......... npdu_field_tree = proto_item_add_subtree(npdu_field_item, ett_sndcp_npdu_field); proto_tree_add_uint(npdu_field_tree, hf_sndcp_npdu1, tvb, offset, 1, npdu_field1 ); } offset++; } } /* get segment and N-PDU number from next two bytes for unacknowledged mode */ if (unack) { npdu_field2 = tvb_get_ntohs(tvb, offset); segment = (npdu_field2 & 0xF000) >> 12; npdu = (npdu_field2 & 0x0FFF); if (check_col(pinfo->cinfo, COL_INFO)) col_add_fstr(pinfo->cinfo, COL_INFO, "SN-UNITDATA N-PDU %d (segment %d)", npdu, segment); if (tree) { npdu_field_item = proto_tree_add_text(sndcp_tree, tvb, offset,2, "Unacknowledged mode, N-PDU %d (segment %d)", npdu, segment ); npdu_field_tree = proto_item_add_subtree(npdu_field_item, ett_sndcp_npdu_field); proto_tree_add_uint(npdu_field_tree, hf_sndcp_segment, tvb, offset, 2, npdu_field2 ); proto_tree_add_uint(npdu_field_tree, hf_sndcp_npdu2, tvb, offset, 2, npdu_field2 ); } offset += 2; } /* handle N-PDU data, reassemble if necessary */ if (first && !more_frags) { next_tvb = tvb_new_subset_remaining (tvb, offset); if (!dcomp && !pcomp) { call_dissector(ip_handle, next_tvb, pinfo, tree); } else { call_dissector(data_handle, next_tvb, pinfo, tree); } } else { /* Try reassembling fragments */ fragment_data *fd_npdu = NULL; guint32 reassembled_in = 0; gboolean save_fragmented = pinfo->fragmented; len = tvb_length_remaining(tvb, offset); if(len<=0){ return; } pinfo->fragmented = TRUE; if (unack) fd_npdu = fragment_add_seq_check(tvb, offset, pinfo, npdu, npdu_fragment_table, sndcp_reassembled_table, segment, len, more_frags); else fd_npdu = fragment_add(tvb, offset, pinfo, npdu, npdu_fragment_table, offset, len, more_frags); npdu_tvb = process_reassembled_data(tvb, offset, pinfo, "Reassembled N-PDU", fd_npdu, &npdu_frag_items, NULL, sndcp_tree); if (fd_npdu) { /* Reassembled */ reassembled_in = fd_npdu->reassembled_in; if (pinfo->fd->num == reassembled_in) { /* Reassembled in this very packet: * We can safely hand the tvb to the IP dissector */ call_dissector(ip_handle, npdu_tvb, pinfo, tree); } else { /* Not reassembled in this packet */ if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, " (N-PDU payload reassembled in packet %u)", fd_npdu->reassembled_in); } if (tree) { proto_tree_add_text(sndcp_tree, tvb, offset, -1, "Payload"); } } } else { /* Not reassembled yet, or not reassembled at all */ if (check_col(pinfo->cinfo, COL_INFO)) { if (unack) col_append_fstr(pinfo->cinfo, COL_INFO, " (Unreassembled fragment %u)", segment); else col_append_str(pinfo->cinfo, COL_INFO, " (Unreassembled fragment)"); } if (tree) { proto_tree_add_text(sndcp_tree, tvb, offset, -1, "Payload"); } } /* Now reset fragmentation information in pinfo */ pinfo->fragmented = save_fragmented; }}
开发者ID:dogphilly,项目名称:wireshark,代码行数:101,
示例6: dissect_rsh//.........这里部分代码省略......... if(check_col(pinfo->cinfo, COL_INFO)){ /* First, clear the info column */ col_clear(pinfo->cinfo, COL_INFO); /* Client username */ if(hash_info->client_username && preference_info_show_client_username == TRUE){ col_append_fstr(pinfo->cinfo, COL_INFO, "Client username:%s ", hash_info->client_username); } /* Server username */ if(hash_info->server_username && preference_info_show_server_username == TRUE){ col_append_fstr(pinfo->cinfo, COL_INFO, "Server username:%s ", hash_info->server_username); } /* Command */ if(hash_info->command && preference_info_show_command == TRUE){ col_append_fstr(pinfo->cinfo, COL_INFO, "Command:%s ", hash_info->command); } } /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_rsh, tvb, 0, -1, ENC_NA); rsh_tree = proto_item_add_subtree(ti, ett_rsh); /* If this packet doesn't end with a null terminated string, * then it must be session data only and we can skip looking * for the other fields. */ if(tvb_find_guint8(tvb, tvb_length(tvb)-1, 1, '/0') == -1){ hash_info->state = WAIT_FOR_DATA; } if(hash_info->state == WAIT_FOR_STDERR_PORT && tvb_length_remaining(tvb, offset)){ field_stringz = tvb_get_ephemeral_stringz(tvb, offset, &length); /* Check if this looks like the stderr_port field. * It is optional, so it may only be 1 character long * (the NULL) */ if(length == 1 || (isdigit_string(field_stringz) && length <= RSH_STDERR_PORT_LEN)){ proto_tree_add_string(rsh_tree, hf_rsh_stderr_port, tvb, offset, length, (gchar*)field_stringz); /* Next field we need */ hash_info->state = WAIT_FOR_CLIENT_USERNAME; } else { /* Since the data doesn't match this field, it must be data only */ hash_info->state = WAIT_FOR_DATA; } /* Used if the next field is in the same packet */ offset += length; } if(hash_info->state == WAIT_FOR_CLIENT_USERNAME && tvb_length_remaining(tvb, offset)){ field_stringz = tvb_get_ephemeral_stringz(tvb, offset, &length); /* Check if this looks like the username field */ if(length != 1 && length <= RSH_CLIENT_USERNAME_LEN && isprint_string(field_stringz)){ proto_tree_add_string(rsh_tree, hf_rsh_client_username, tvb, offset, length, (gchar*)field_stringz); /* Store the client username so we can display it in the * info column of the entire conversation
开发者ID:dogphilly,项目名称:wireshark,代码行数:67,
示例7: dissect_sbcstatic gintdissect_sbc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data){ proto_item *ti; proto_tree *sbc_tree; proto_item *pitem; proto_tree *rtree; gint offset = 0; guint8 number_of_frames; guint8 syncword; guint8 byte; guint8 blocks; guint8 channels; guint8 subbands; guint8 bitpool; guint frequency; guint8 sbc_blocks; gint sbc_channels; guint8 sbc_subbands; gint val; gint counter = 1; gint frame_length; gint expected_speed_data; gdouble frame_duration; gdouble cummulative_frame_duration = 0; bta2dp_codec_info_t *info; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SBC"); info = (bta2dp_codec_info_t *) data; ti = proto_tree_add_item(tree, proto_sbc, tvb, offset, -1, ENC_NA); sbc_tree = proto_item_add_subtree(ti, ett_sbc); proto_tree_add_item(sbc_tree, hf_sbc_fragmented, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(sbc_tree, hf_sbc_starting_packet, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(sbc_tree, hf_sbc_last_packet, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(sbc_tree, hf_sbc_rfa, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(sbc_tree, hf_sbc_number_of_frames, tvb, offset, 1, ENC_BIG_ENDIAN); number_of_frames = tvb_get_guint8(tvb, offset) & 0x0F; offset += 1; while (tvb_length_remaining(tvb, offset) > 0) { byte = tvb_get_guint8(tvb, offset + 1); frequency = (byte & 0xC0) >> 6; blocks = (byte & 0x30) >> 4; channels = (byte & 0x0C)>> 2; subbands = byte & 0x01; bitpool = tvb_get_guint8(tvb, offset + 2); if (channels == CHANNELS_MONO) sbc_channels = 1; else sbc_channels = 2; switch (frequency) { case FREQUENCY_16000: frequency = 16000; break; case FREQUENCY_32000: frequency = 32000; break; case FREQUENCY_44100: frequency = 44100; break; case FREQUENCY_48000: frequency = 48000; break; default: frequency = 0; } sbc_subbands = 4 * (subbands + 1); sbc_blocks = 4 * (blocks + 1); frame_length = (4 * sbc_subbands * sbc_channels) / 8; if (sbc_channels == 1) val = sbc_blocks * sbc_channels * bitpool; else val = (((channels == CHANNELS_JOINT_STEREO) ? 1 : 0) * sbc_subbands + sbc_blocks * bitpool); frame_length += val / 8; if (val % 8) frame_length += 1; expected_speed_data = (frame_length * frequency) / (sbc_subbands * sbc_blocks); rtree = proto_tree_add_subtree_format(sbc_tree, tvb, offset, 4 + frame_length, ett_sbc_list, NULL, "Frame: %3u/%3u", counter, number_of_frames); pitem = proto_tree_add_item(rtree, hf_sbc_syncword, tvb, offset, 1, ENC_BIG_ENDIAN); syncword = tvb_get_guint8(tvb, offset); if (syncword != 0x9C) { expert_add_info(pinfo, pitem, &ei_sbc_syncword); } offset += 1; proto_tree_add_item(rtree, hf_sbc_sampling_frequency, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(rtree, hf_sbc_blocks, tvb, offset, 1, ENC_BIG_ENDIAN);//.........这里部分代码省略.........
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:101,
示例8: dissect_msdp_sa/* Both Source-Active and Source-Active Response have the same format * with one exception. Encapsulated multicast data is not allowed in * SA Response. */static void dissect_msdp_sa(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int *offset, int length){ guint8 entries; if (length < 1) return; entries = tvb_get_guint8(tvb, *offset); proto_tree_add_uint(tree, hf_msdp_sa_entry_count, tvb, *offset, 1, entries); *offset += 1; length -= 1; if (length < 4) { *offset += length; length = 0; return; } proto_tree_add_item(tree, hf_msdp_sa_rp_addr, tvb, *offset, 4, FALSE); *offset += 4; length -= 4; /* Put each of the (S,G) entries in their own subtree. * This is probably visually better. */ while (entries-- > 0) { proto_item *ei; proto_tree *entry_tree; if (length < 12) { *offset += length; length = 0; return; } ei = proto_tree_add_text(tree, tvb, *offset, 12, "(S,G) block: %s/%u -> %s", ip_to_str(tvb_get_ptr(tvb, *offset + 8, 4)), tvb_get_guint8(tvb, *offset + 3), ip_to_str(tvb_get_ptr(tvb, *offset + 4, 4))); entry_tree = proto_item_add_subtree(ei, ett_msdp_sa_entry); proto_tree_add_item(entry_tree, hf_msdp_sa_reserved, tvb, *offset, 3, FALSE); *offset += 3; length -= 3; proto_tree_add_item(entry_tree, hf_msdp_sa_sprefix_len, tvb, *offset, 1, FALSE); *offset += 1; length -= 1; proto_tree_add_item(entry_tree, hf_msdp_sa_group_addr, tvb, *offset, 4, FALSE); *offset += 4; length -= 4; proto_tree_add_item(entry_tree, hf_msdp_sa_src_addr, tvb, *offset, 4, FALSE); *offset += 4; length -= 4; } /* * Check if an encapsulated multicast IPv4 packet follows */ if (length > 0) { proto_item *ei; proto_tree *enc_tree; gint available_length, reported_length; tvbuff_t *next_tvb; ei = proto_tree_add_text(tree, tvb, *offset, length, "Encapsulated IPv4 packet: %u bytes", length); enc_tree = proto_item_add_subtree(ei, ett_msdp_sa_enc_data); available_length = tvb_length_remaining(tvb, *offset); reported_length = tvb_reported_length_remaining(tvb, *offset); DISSECTOR_ASSERT(available_length >= 0); DISSECTOR_ASSERT(reported_length >= 0); if (available_length > reported_length) available_length = reported_length; if (available_length > length) available_length = length; if (reported_length > length) reported_length = length; next_tvb = tvb_new_subset(tvb, *offset, available_length, reported_length); /* Set the information columns read-only so that they * reflect the MSDP packet rather than the * encapsulated packet. */ col_set_writable(pinfo->cinfo, FALSE); call_dissector(ip_handle, next_tvb, pinfo, enc_tree); } *offset += length; return;}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:95,
示例9: dissect_msdpstatic voiddissect_msdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ proto_item *ti; proto_tree *msdp_tree; int offset; col_set_str(pinfo->cinfo, COL_PROTOCOL, "MSDP"); if (check_col(pinfo->cinfo, COL_INFO)) col_add_str(pinfo->cinfo, COL_INFO, val_to_str(tvb_get_guint8(tvb, 0), msdp_types, "<Unknown MSDP message type>")); if (tree) { guint8 type; guint16 length; ti = proto_tree_add_item(tree, proto_msdp, tvb, 0, -1, FALSE); msdp_tree = proto_item_add_subtree(ti, ett_msdp); offset = 0; while (tvb_reported_length_remaining(tvb, offset) >= 3) { type = tvb_get_guint8(tvb, offset); length = tvb_get_ntohs(tvb, offset + 1); if (length < 3) break; proto_tree_add_uint(msdp_tree, hf_msdp_type, tvb, offset, 1, type); proto_tree_add_uint(msdp_tree, hf_msdp_length, tvb, offset + 1, 2, length); offset += 3; length -= 3; switch (type) { case MSDP_SA: case MSDP_SA_RSP: dissect_msdp_sa(tvb, pinfo, msdp_tree, &offset, length); break; case MSDP_SA_REQ: proto_tree_add_item(msdp_tree, hf_msdp_sa_req_res, tvb, offset, 1, FALSE); proto_tree_add_item(msdp_tree, hf_msdp_sa_req_group, tvb, offset + 1, 4, FALSE); offset += 5; break; case MSDP_NOTIFICATION: dissect_msdp_notification(tvb, pinfo, msdp_tree, &offset, length); break; default: if (length > 0) proto_tree_add_text(msdp_tree, tvb, offset, length, "TLV contents"); offset += length; break; } } if (tvb_length_remaining(tvb, offset) > 0) proto_tree_add_text(msdp_tree, tvb, offset, -1, "Trailing junk"); } return;}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:61,
示例10: dissect_sss_replyvoiddissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint8 subfunc, ncp_req_hash_value *request_value){ guint32 foffset=0; guint32 subverb=0; guint32 msg_length=0; guint32 return_code=0; guint32 number_of_items=0; gint32 length_of_string=0; guint32 i = 0; const gchar *str; proto_tree *atree; proto_item *aitem; proto_item *expert_item; foffset = 8; col_set_str(pinfo->cinfo, COL_PROTOCOL, "NSSS"); if (tvb_length_remaining(tvb, foffset)<4) { return; } aitem = proto_tree_add_text(ncp_tree, tvb, foffset, -1, "Function: %s", val_to_str_const(subfunc, sss_func_enum, "Unknown")); atree = proto_item_add_subtree(aitem, ett_sss); switch (subfunc) { case 1: proto_tree_add_item(atree, hf_flags, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; proto_tree_add_item(atree, hf_sss_version, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; break; case 2: if (request_value) { subverb = request_value->req_nds_flags; str = try_val_to_str(subverb, sss_verb_enum); if (str) { proto_tree_add_text(atree, tvb, foffset, tvb_length_remaining(tvb, foffset), "Verb: %s", str); } } proto_tree_add_item(atree, hf_length, tvb, foffset, 4, ENC_LITTLE_ENDIAN); msg_length = tvb_get_letohl(tvb, foffset); return_code = tvb_get_ntohl(tvb, foffset+msg_length); foffset += 4; proto_tree_add_item(atree, hf_frag_handle, tvb, foffset, 4, ENC_LITTLE_ENDIAN); foffset += 4; msg_length -= 4; if ((tvb_get_letohl(tvb, foffset-4)==0xffffffff) && (msg_length > 4)) { foffset += 4; return_code = tvb_get_letohl(tvb, foffset); str = try_val_to_str(return_code, sss_errors_enum); if (str) { expert_item = proto_tree_add_item(atree, hf_return_code, tvb, foffset, 4, ENC_LITTLE_ENDIAN); expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "SSS Error: %s", str); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "R Error - %s", val_to_str(return_code, sss_errors_enum, "Unknown (%d)")); } foffset+=4; } else { proto_tree_add_text(atree, tvb, foffset, 4, "Return Code: Success (0x00000000)"); if (tvb_length_remaining(tvb, foffset) > 8) { foffset += 4; if (request_value && subverb == 6) { foffset += 4; number_of_items = tvb_get_letohl(tvb, foffset); foffset += 8; for (i=0; i<number_of_items; i++) { length_of_string = find_delimiter(tvb, foffset); if (length_of_string > tvb_length_remaining(tvb, foffset)) { return; } foffset = sss_string(tvb, hf_secret, atree, foffset, TRUE, length_of_string); if (tvb_length_remaining(tvb, foffset) < 8) { return; } foffset++; } } else { proto_tree_add_item(atree, hf_enc_data, tvb, foffset, tvb_length_remaining(tvb, foffset), ENC_NA); } } } } else { proto_tree_add_text(atree, tvb, foffset, 4, "Return Code: Success (0x00000000)"); if (tvb_length_remaining(tvb, foffset) > 8) { foffset += 4; proto_tree_add_item(atree, hf_enc_data, tvb, foffset, tvb_length_remaining(tvb, foffset), ENC_NA); }//.........这里部分代码省略.........
开发者ID:mcrotty,项目名称:stack,代码行数:101,
示例11: dissect_starteamstatic voiddissect_starteam(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ gint offset = 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "StarTeam"); if(check_col(pinfo->cinfo, COL_INFO)){ /* This is a trick to know whether this is the first PDU in this packet or not */ if(iPreviousFrameNumber != (gint) pinfo->fd->num){ col_clear(pinfo->cinfo, COL_INFO); } else { col_append_str(pinfo->cinfo, COL_INFO, " | "); } } iPreviousFrameNumber = pinfo->fd->num; if(tvb_length(tvb) >= 16){ guint32 iCommand = 0; gboolean bRequest = FALSE; if(tvb_get_ntohl(tvb, offset + 0) == STARTEAM_MAGIC){ /* This packet is a response */ bRequest = FALSE; if(check_col(pinfo->cinfo, COL_INFO)){ col_append_fstr(pinfo->cinfo, COL_INFO, "Reply: %d bytes", tvb_length(tvb)); } } else if(tvb_length_remaining(tvb, offset) >= 28 && tvb_get_ntohl(tvb, offset + 20) == STARTEAM_MAGIC){ /* This packet is a request */ bRequest = TRUE; if(tvb_length_remaining(tvb, offset) >= 66){ iCommand = tvb_get_letohl(tvb, offset + 62); } if(check_col(pinfo->cinfo, COL_INFO)){ col_append_str(pinfo->cinfo, COL_INFO, val_to_str_ext(iCommand, &starteam_opcode_vals_ext, "Unknown (0x%02x)")); } } if(tree){ proto_tree *starteam_tree; proto_tree *starteamroot_tree; proto_item *ti; ti = proto_tree_add_item(tree, proto_starteam, tvb, offset, -1, ENC_NA); if (bRequest) proto_item_append_text(ti, " (%s)", val_to_str_ext(iCommand, &starteam_opcode_vals_ext, "Unknown (0x%02x)")); starteamroot_tree = proto_item_add_subtree(ti, ett_starteam); if(bRequest){ if(tvb_length_remaining(tvb, offset) >= 20){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 20, STARTEAM_TEXT_MDH); starteam_tree = proto_item_add_subtree(ti, ett_starteam_mdh); proto_tree_add_item(starteam_tree, hf_starteam_mdh_session_tag, tvb, offset + 0, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_mdh_ctimestamp, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_mdh_flags, tvb, offset + 8, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_mdh_keyid, tvb, offset + 12, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_mdh_reserved, tvb, offset + 16, 4, ENC_LITTLE_ENDIAN); offset += 20; } } if(tvb_length_remaining(tvb, offset) >= 16){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 16, STARTEAM_TEXT_PH); starteam_tree = proto_item_add_subtree(ti, ett_starteam_ph); proto_tree_add_item(starteam_tree, hf_starteam_ph_signature, tvb, offset + 0, 4, ENC_ASCII|ENC_NA); proto_tree_add_item(starteam_tree, hf_starteam_ph_packet_size, tvb, offset + 4, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_ph_data_size, tvb, offset + 8, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_ph_data_flags, tvb, offset + 12, 4, ENC_LITTLE_ENDIAN); offset += 16; if(bRequest){ if(tvb_length_remaining(tvb, offset) >= 38){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, 38, STARTEAM_TEXT_ID); starteam_tree = proto_item_add_subtree(ti, ett_starteam_id); proto_tree_add_item(starteam_tree, hf_starteam_id_revision_level, tvb, offset + 0, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_id_client, tvb, offset + 2, 16, ENC_ASCII|ENC_NA); proto_tree_add_item(starteam_tree, hf_starteam_id_connect, tvb, offset + 18, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_id_component, tvb, offset + 22, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_id_command, tvb, offset + 26, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_id_command_time, tvb, offset + 30, 4, ENC_LITTLE_ENDIAN); proto_tree_add_item(starteam_tree, hf_starteam_id_command_userid, tvb, offset + 34, 4, ENC_LITTLE_ENDIAN); offset += 38; } } if(tvb_length_remaining(tvb, offset) > 0){ ti = proto_tree_add_text(starteamroot_tree, tvb, offset, -1, STARTEAM_TEXT_DATA); starteam_tree = proto_item_add_subtree(ti, ett_starteam_data); proto_tree_add_item(starteam_tree, hf_starteam_data_data, tvb, offset, tvb_length_remaining(tvb, offset), ENC_ASCII|ENC_NA); } } } }}
开发者ID:SayCV,项目名称:wireshark,代码行数:95,
示例12: dissect_openvpn_msg_commonstatic intdissect_openvpn_msg_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *openvpn_tree, proto_tree *parent_tree, gint offset){ gboolean tls_auth; guint openvpn_keyid; guint openvpn_opcode; guint32 msg_mpid = -1; guint32 msg_sessionid = -1; guint8 openvpn_predict_tlsauth_arraylength; proto_item *ti2, *ti3; proto_tree *packetarray_tree, *type_tree; guint32 msg_length_remaining; gboolean msg_lastframe; fragment_head *frag_msg; tvbuff_t *new_tvb; gboolean save_fragmented; /* Clear out stuff in the info column */ col_set_str(pinfo->cinfo, COL_PROTOCOL, PSNAME); col_clear(pinfo->cinfo,COL_INFO); /* read opcode and write to info column */ openvpn_opcode = tvb_get_bits8(tvb, offset*8, 5); col_append_fstr(pinfo->cinfo, COL_INFO, "MessageType: %s", val_to_str_const(openvpn_opcode, openvpn_message_types, "Unknown Messagetype")); openvpn_keyid = tvb_get_bits8(tvb, offset*8 + 5, 3); proto_item_append_text(parent_tree, ", Opcode: %s, Key ID: %d", val_to_str(openvpn_opcode, openvpn_message_types, "Unknown (0x%02x)"), openvpn_keyid); ti2 = proto_tree_add_item(openvpn_tree, hf_openvpn_pdu_type, tvb, offset, 1, ENC_BIG_ENDIAN); proto_item_append_text(ti2, " [opcode/key_id]"); type_tree = proto_item_add_subtree(ti2, ett_openvpn_type); proto_tree_add_item(type_tree, hf_openvpn_opcode, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(type_tree, hf_openvpn_keyid, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; /* if we have a P_CONTROL or P_ACK packet */ if (openvpn_opcode != P_DATA_V1) { /* read sessionid */ msg_sessionid = tvb_get_bits32(tvb, offset*8+32, 32, ENC_BIG_ENDIAN); proto_tree_add_item(openvpn_tree, hf_openvpn_sessionid, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; /* tls-auth detection (this can be overridden by preferences */ openvpn_predict_tlsauth_arraylength = tvb_get_guint8(tvb, offset); /* if the first 4 bytes that would, if tls-auth is used, contain part of the hmac, lack entropy, we asume no tls-auth is used */ if (pref_tls_auth_override == FALSE) { if ((openvpn_opcode != P_DATA_V1) && (openvpn_predict_tlsauth_arraylength > 0) && check_for_valid_hmac(tvb_get_ntohl(tvb, offset))) { tls_auth = TRUE; } else { tls_auth = FALSE; } } else { tls_auth = pref_tls_auth; } if (tls_auth == TRUE) { proto_tree_add_item(openvpn_tree, hf_openvpn_hmac, tvb, offset, tls_auth_hmac_size, ENC_NA); offset += tls_auth_hmac_size; if (tvb_length_remaining(tvb, offset) >= 8) { proto_tree_add_item(openvpn_tree, hf_openvpn_pid, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; if (pref_long_format) { proto_tree_add_item(openvpn_tree, hf_openvpn_net_time, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } } } if (tvb_length_remaining(tvb, offset) >= 1) { /* read P_ACK packet-id array length */ gint pid_arraylength = tvb_get_guint8(tvb, offset); gint i; proto_tree_add_item(openvpn_tree, hf_openvpn_mpid_arraylength, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (pid_arraylength > 0) { ti3 = proto_tree_add_text(openvpn_tree, tvb, offset, 0, "Packet-ID Array"); packetarray_tree = proto_item_add_subtree(ti3, ett_openvpn_packetarray); for (i = 0; i < pid_arraylength; i++) { proto_tree_add_item(packetarray_tree, hf_openvpn_mpid_arrayelement, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } if (tvb_length_remaining(tvb, offset) >= 8) { proto_tree_add_item(openvpn_tree, hf_openvpn_rsessionid, tvb, offset, 8, ENC_BIG_ENDIAN); offset += 8; } } }//.........这里部分代码省略.........
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:101,
示例13: check_and_get_checksumcksum_status_tcheck_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, int offset_check, guint16* result) { const gchar *buffer; guint available_len; const guint8 *p; guint8 discard = 0; guint32 c0, c1, factor; guint seglen, initlen = len; guint i; int block, x, y; if ( 0 == checksum ) return( NO_CKSUM ); available_len = tvb_length_remaining( tvb, offset ); offset_check -= offset; if ( ( available_len < len ) || ( offset_check < 0 ) || ( (guint)(offset_check+2) > len ) ) return( DATA_MISSING ); buffer = tvb_get_ptr( tvb, offset, len ); block = offset_check / 5803; /* * The maximum values of c0 and c1 will occur if all bytes have the * value 255; if so, then c0 will be len*255 and c1 will be * (len*255 + (len-1)*255 + ... + 255), which is * (len + (len - 1) + ... + 1)*255, or 255*(len*(len + 1))/2. * This means it can overflow if "len" is 5804 or greater. * * (A+B) mod 255 = ((A mod 255) + (B mod 255) mod 255, so * we can solve this by taking c0 and c1 mod 255 every * 5803 bytes. */ p = buffer; c0 = 0; c1 = 0; while (len != 0) { seglen = len; if ( block-- == 0 ) { seglen = offset_check % 5803; discard = 1; } else if ( seglen > 5803 ) seglen = 5803; for (i = 0; i < seglen; i++) { c0 = c0 + *(p++); c1 += c0; } if ( discard ) { /* * This works even if (offset_check % 5803) == 5802 */ p += 2; c1 += 2*c0; len -= 2; discard = 0; } c0 = c0 % 255; c1 = c1 % 255; len -= seglen; } factor = ( initlen - offset_check ) * c0; x = factor - c0 - c1; y = c1 - factor - 1; /* * This algorithm uses the 8 bits one's complement arithmetic. * Therefore, we must correct an effect produced * by the "standard" arithmetic (two's complement) */ if (x < 0 ) x--; if (y > 0 ) y++; x %= 255; y %= 255; if (x == 0) x = 0xFF; if (y == 0) y = 0x01; *result = ( x << 8 ) | ( y & 0xFF ); if (*result != checksum) return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */ else return( CKSUM_OK );}
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:90,
示例14: dissect_btsmpstatic voiddissect_btsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ int offset = 0; proto_item *ti; proto_tree *st; guint8 opcode; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SMP"); switch (pinfo->p2p_dir) { case P2P_DIR_SENT: col_add_str(pinfo->cinfo, COL_INFO, "Sent "); break; case P2P_DIR_RECV: col_add_str(pinfo->cinfo, COL_INFO, "Rcvd "); break; default: col_add_fstr(pinfo->cinfo, COL_INFO, "Unknown direction %d ", pinfo->p2p_dir); break; } if (tvb_length_remaining(tvb, 0) < 1) return; ti = proto_tree_add_item(tree, proto_btsmp, tvb, 0, -1, ENC_NA); st = proto_item_add_subtree(ti, ett_btsmp); proto_tree_add_item(st, hf_btsmp_opcode, tvb, 0, 1, ENC_LITTLE_ENDIAN); opcode = tvb_get_guint8(tvb, 0); offset++; col_append_fstr(pinfo->cinfo, COL_INFO, "%s", val_to_str_const(opcode, opcode_vals, "<unknown>")); switch (opcode) { case 0x01: /* Pairing Request */ case 0x02: /* Pairing Response */ { col_append_fstr(pinfo->cinfo, COL_INFO, ": "); proto_tree_add_item(st, hf_btsmp_io_capabilities, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; proto_tree_add_item(st, hf_btsmp_oob_data_flags, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; offset = dissect_btsmp_auth_req(tvb, offset, pinfo, st); proto_tree_add_item(st, hf_btsmp_max_enc_key_size, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset++; offset = dissect_btsmp_key_dist(tvb, offset, pinfo, st, TRUE); offset = dissect_btsmp_key_dist(tvb, offset, pinfo, st, FALSE); break; } case 0x03: /* Pairing Confirm */ proto_tree_add_item(st, hf_btsmp_cfm_value, tvb, offset, 16, ENC_NA); offset += 16; break; case 0x04: /* Pairing Random */ proto_tree_add_item(st, hf_btsmp_random, tvb, offset, 16, ENC_NA); offset += 16; break; case 0x05: /* Pairing Failed */ proto_tree_add_item(st, hf_btsmp_reason, tvb, offset, 1, ENC_LITTLE_ENDIAN); col_append_fstr(pinfo->cinfo, COL_INFO, ": %s", val_to_str_const(tvb_get_guint8(tvb, offset), reason_vals, "<unknown>")); offset++; break; case 0x06: /* Encryption Information */ proto_tree_add_item(st, hf_btsmp_long_term_key, tvb, offset, 16, ENC_NA); offset += 16; break; case 0x07: /* Master Identification */ proto_tree_add_item(st, hf_btsmp_ediv, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(st, hf_btsmp_random, tvb, offset, 8, ENC_NA); offset += 8; break; case 0x08: /* Identity Information */ proto_tree_add_item(st, hf_btsmp_id_resolving_key, tvb, offset, 16, ENC_NA); offset += 16; break; case 0x0a: /* Signing Informationn */ proto_tree_add_item(st, hf_btsmp_signature_key, tvb, offset, 16, ENC_NA); offset += 16; break; case 0x0b: /* Security Request */ col_append_fstr(pinfo->cinfo, COL_INFO, ": "); offset = dissect_btsmp_auth_req(tvb, offset, pinfo, st); break; default://.........这里部分代码省略.........
开发者ID:SayCV,项目名称:wireshark,代码行数:101,
示例15: dissect_report_segmentstatic intdissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree, int frame_offset) { guint64 rpt_sno; guint64 chkp_sno; guint64 upper_bound; guint64 lower_bound; int rcpt_clm_cnt; guint64 offset; guint64 length; int rpt_sno_size; int chkp_sno_size; int upper_bound_size; int lower_bound_size; int rcpt_clm_cnt_size; int offset_size; int length_size; int segment_offset = 0; int i; proto_item *ltp_rpt_item; proto_item *ltp_rpt_clm_item; proto_tree *ltp_rpt_tree; proto_tree *ltp_rpt_clm_tree; /* Create the subtree for report segment under the main LTP tree and all the report segment fields under it */ ltp_rpt_item = proto_tree_add_text(ltp_tree, tvb, frame_offset, -1, "Report Segment"); ltp_rpt_tree = proto_item_add_subtree(ltp_rpt_item, ett_rpt_segm); /* Extract the report segment info */ rpt_sno = evaluate_sdnv_64(tvb, frame_offset, &rpt_sno_size); proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_sno, tvb, frame_offset + segment_offset, rpt_sno_size, rpt_sno); segment_offset += rpt_sno_size; chkp_sno = evaluate_sdnv_64(tvb, frame_offset + segment_offset, &chkp_sno_size); proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_chkp, tvb, frame_offset + segment_offset, chkp_sno_size, chkp_sno); segment_offset += chkp_sno_size; upper_bound = evaluate_sdnv(tvb, frame_offset + segment_offset, &upper_bound_size); proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_ub, tvb, frame_offset + segment_offset, upper_bound_size, upper_bound); segment_offset += upper_bound_size; lower_bound = evaluate_sdnv(tvb, frame_offset + segment_offset, &lower_bound_size); proto_tree_add_uint64(ltp_rpt_tree, hf_ltp_rpt_lb, tvb, frame_offset + segment_offset, lower_bound_size, lower_bound); segment_offset += lower_bound_size; rcpt_clm_cnt = evaluate_sdnv(tvb, frame_offset + segment_offset, &rcpt_clm_cnt_size); if (rcpt_clm_cnt < 0){ proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset); expert_add_info_format_text(pinfo, ltp_tree, &ei_ltp_neg_reception_claim_count, "Negative reception claim count: %d", rcpt_clm_cnt); return 0; } /* Each reception claim is at least 2 bytes, so if the count is larger than the * max number of claims we can possibly squeeze into the remaining tvbuff, then * the packet is malformed. */ if (rcpt_clm_cnt > tvb_length_remaining(tvb, frame_offset + segment_offset) / 2) { proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset); expert_add_info_format_text(pinfo, ltp_tree, &ei_ltp_mal_reception_claim, "Reception claim count impossibly large: %d > %d", rcpt_clm_cnt, tvb_length_remaining(tvb, frame_offset + segment_offset) / 2); return 0; } proto_tree_add_uint(ltp_rpt_tree, hf_ltp_rpt_clm_cnt, tvb, frame_offset + segment_offset, rcpt_clm_cnt_size, rcpt_clm_cnt); segment_offset += rcpt_clm_cnt_size; ltp_rpt_clm_item = proto_tree_add_text(ltp_rpt_tree, tvb, frame_offset + segment_offset, -1, "Reception claims"); ltp_rpt_clm_tree = proto_item_add_subtree(ltp_rpt_clm_item, ett_rpt_clm); /* There can be multiple reception claims in the same report segment */ for(i = 0; i<rcpt_clm_cnt; i++){ offset = evaluate_sdnv(tvb,frame_offset + segment_offset, &offset_size); proto_tree_add_uint64_format(ltp_rpt_clm_tree, hf_ltp_rpt_clm_off, tvb, frame_offset + segment_offset, offset_size, offset, "Offset[%d] : %"G_GINT64_MODIFIER"d", i, offset); segment_offset += offset_size; length = evaluate_sdnv(tvb,frame_offset + segment_offset, &length_size); proto_tree_add_uint64_format(ltp_rpt_clm_tree, hf_ltp_rpt_clm_len, tvb, frame_offset + segment_offset, length_size, length, "Length[%d] : %"G_GINT64_MODIFIER"d",i, length); segment_offset += length_size; } proto_item_set_end(ltp_rpt_clm_item, tvb, frame_offset + segment_offset); proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset); return segment_offset;}
开发者ID:Biamp-Systems,项目名称:wireshark,代码行数:88,
示例16: dissect_fcp_cmndstatic voiddissect_fcp_cmnd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, proto_tree *tree, conversation_t *conversation, fc_hdr *fchdr, fcp_conv_data_t *fcp_conv_data){ int offset = 0; int add_len = 0; guint8 flags, rwflags, lun0; guint16 lun = 0xffff; tvbuff_t *cdb_tvb; int tvb_len; fcp_request_data_t *request_data = NULL; itl_nexus_t itl; fcp_proto_data_t *proto_data; /* Determine the length of the FCP part of the packet */ flags = tvb_get_guint8(tvb, offset+10); if (flags) { add_len = tvb_get_guint8(tvb, offset+11) & 0x7C; add_len = add_len >> 2; } lun0 = tvb_get_guint8(tvb, offset); /* Display single-level LUNs in decimal for clarity */ /* I'm taking a shortcut here by assuming that if the first byte of the * LUN field is 0, it is a single-level LUN. This is not true. For a * real single-level LUN, all 8 bytes except byte 1 must be 0. */ if (lun0) { proto_tree_add_item(tree, hf_fcp_multilun, tvb, offset, 8, ENC_NA); lun = tvb_get_guint8(tvb, offset) & 0x3f; lun <<= 8; lun |= tvb_get_guint8(tvb, offset+1); } else { proto_tree_add_item(tree, hf_fcp_singlelun, tvb, offset+1, 1, ENC_BIG_ENDIAN); lun = tvb_get_guint8(tvb, offset+1); } if (!pinfo->fd->flags.visited) { proto_data = wmem_new(wmem_file_scope(), fcp_proto_data_t); proto_data->lun = lun; p_add_proto_data(wmem_file_scope(), pinfo, proto_fcp, 0, proto_data); } request_data = (fcp_request_data_t*)wmem_map_lookup(fcp_conv_data->luns, GUINT_TO_POINTER((guint)lun)); if (!request_data) { request_data = wmem_new(wmem_file_scope(), fcp_request_data_t); request_data->request_frame = pinfo->fd->num; request_data->response_frame = 0; request_data->request_time = pinfo->fd->abs_ts; request_data->itlq = wmem_new(wmem_file_scope(), itlq_nexus_t); request_data->itlq->first_exchange_frame=0; request_data->itlq->last_exchange_frame=0; request_data->itlq->lun=lun; request_data->itlq->scsi_opcode=0xffff; request_data->itlq->task_flags=0; request_data->itlq->data_length=0; request_data->itlq->bidir_data_length=0; request_data->itlq->fc_time=pinfo->fd->abs_ts; request_data->itlq->flags=0; request_data->itlq->alloc_len=0; request_data->itlq->extra_data=NULL; wmem_map_insert(fcp_conv_data->luns, GUINT_TO_POINTER((guint)lun), request_data); } /* populate the exchange struct */ if(!pinfo->fd->flags.visited){ if(fchdr->fctl&FC_FCTL_EXCHANGE_FIRST){ request_data->itlq->first_exchange_frame=pinfo->fd->num; request_data->itlq->fc_time = pinfo->fd->abs_ts; } if(fchdr->fctl&FC_FCTL_EXCHANGE_LAST){ request_data->itlq->last_exchange_frame=pinfo->fd->num; } } if (request_data->itlq) request_data->itlq->lun = lun; fchdr->lun = lun; proto_tree_add_item(tree, hf_fcp_crn, tvb, offset+8, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_fcp_taskattr, tvb, offset+9, 1, ENC_BIG_ENDIAN); dissect_task_mgmt_flags(pinfo, tree, tvb, offset+10); proto_tree_add_item(tree, hf_fcp_addlcdblen, tvb, offset+11, 1, ENC_BIG_ENDIAN); rwflags = tvb_get_guint8(tvb, offset+11); if (request_data->itlq) { if (rwflags & 0x02) { request_data->itlq->task_flags |= SCSI_DATA_READ; } if (rwflags & 0x01) { request_data->itlq->task_flags |= SCSI_DATA_WRITE; } } proto_tree_add_item(tree, hf_fcp_rddata, tvb, offset+11, 1, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_fcp_wrdata, tvb, offset+11, 1, ENC_BIG_ENDIAN); tvb_len = tvb_length_remaining(tvb, offset+12);//.........这里部分代码省略.........
开发者ID:ARK1988,项目名称:wireshark,代码行数:101,
示例17: dissect_pktgen/* entry point */static gboolean dissect_pktgen(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ proto_item *ti = NULL; proto_item *tmp = NULL; proto_tree *pktgen_tree = NULL; guint32 offset = 0; nstime_t tstamp; /* check for min size */ if(tvb_length(tvb) < 16) { /* Not a PKTGEN packet. */ return FALSE; } /* check for magic number */ if(tvb_memeql(tvb, 0, pktgen_magic, 4) == -1) { /* Not a PKTGEN packet. */ return FALSE; } /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "PKTGEN"); if(check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "Seq: %u", tvb_get_ntohl(tvb, 4)); } if(tree) { /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_pktgen, tvb, 0, -1, FALSE); pktgen_tree = proto_item_add_subtree(ti, ett_pktgen); /* add items to the subtree */ proto_tree_add_item(pktgen_tree, hf_pktgen_magic, tvb, offset, 4, FALSE); offset+=4; proto_tree_add_item(pktgen_tree, hf_pktgen_seqnum, tvb, offset, 4, FALSE); offset+=4; tstamp.secs = tvb_get_ntohl(tvb, offset); tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvsec, tvb, offset, 4, FALSE); PROTO_ITEM_SET_GENERATED(tmp); offset+=4; tstamp.nsecs = tvb_get_ntohl(tvb, offset) /* microsecond on the wire so... */ * 1000; tmp = proto_tree_add_item(pktgen_tree, hf_pktgen_tvusec, tvb, offset, 4, FALSE); PROTO_ITEM_SET_GENERATED(tmp); offset+=4; proto_tree_add_time(pktgen_tree, hf_pktgen_timestamp, tvb, offset - 8, 8, &tstamp); #if 0 if(tvb_length_remaining(tvb, offset)) /* random data */ proto_tree_add_text(pktgen_tree, tvb, offset, -1, "Data (%u bytes)", tvb_length_remaining(tvb, offset));#else if(tvb_length_remaining(tvb, offset)) /* random data */ call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, pktgen_tree);#endif } return TRUE;}
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:68,
示例18: dissect_beep_treestatic intdissect_beep_tree(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, struct beep_request_val *request_val, struct beep_proto_data *beep_frame_data){ proto_tree *ti = NULL, *hdr = NULL; proto_item *hidden_item; int st_offset, msgno, ansno, seqno, size, channel, ackno, window, cc, more; const char * cmd_temp = NULL; int is_ANS = 0; st_offset = offset; if (tvb_strneql(tvb, offset, "MSG ", 4) == 0) cmd_temp = "Command: MSG"; if (tvb_strneql(tvb, offset, "RPY ", 4) == 0) cmd_temp = "Command: RPY"; if (tvb_strneql(tvb, offset, "ERR ", 4) == 0) cmd_temp = "Command: ERR"; if (tvb_strneql(tvb, offset, "NUL ", 4) == 0) cmd_temp = "Command: NUL"; if (tvb_strneql(tvb, offset, "ANS ", 4) == 0) { cmd_temp = "Command: ANS"; is_ANS = 1; } if (cmd_temp != NULL) { if (tree) { ti = proto_tree_add_text(tree, tvb, offset, header_len(tvb, offset) + 2, "Header"); hdr = proto_item_add_subtree(ti, ett_header); hidden_item = proto_tree_add_boolean(hdr, hf_beep_req, tvb, offset, 3, TRUE); proto_tree_add_text(hdr, tvb, offset, 3, "%s", cmd_temp); } offset += 4; /* Get the channel */ offset += dissect_beep_int(tvb, offset, hdr, hf_beep_channel, &channel, req_chan_hfa); offset += 1; /* Skip the space */ /* Dissect the message number */ offset += dissect_beep_int(tvb, offset, hdr, hf_beep_msgno, &msgno, req_msgno_hfa); offset += 1; /* skip the space */ /* Insert the more elements ... */ if ((more = dissect_beep_more(tvb, offset, hdr)) >= 0) { /* Figure out which direction this is in and what mime_hdr flag to * add to the beep_frame_data. If there are missing segments, this code * will get it wrong! */ set_mime_hdr_flags(more, request_val, beep_frame_data, pinfo); } else { /* Protocol violation, so dissect rest as undisectable */ if (tree) { proto_tree_add_text(hdr, tvb, offset, tvb_length_remaining(tvb, offset), "Undissected Payload: %s", tvb_format_text(tvb, offset, tvb_length_remaining(tvb, offset) ) ); } return -1; } offset += 2; /* Skip the flag and the space ... */ /* now for the seqno */ offset += dissect_beep_int(tvb, offset, hdr, hf_beep_seqno, &seqno, req_seqno_hfa); offset += 1; /* skip the space */ offset += dissect_beep_int(tvb, offset, hdr, hf_beep_size, &size, req_size_hfa); if (request_val) /* FIXME, is this the right order ... */ request_val -> size = size; /* Stash this away */ else { beep_frame_data->pl_size = size; if (beep_frame_data->pl_size < 0) beep_frame_data->pl_size = 0; /* FIXME: OK? */ } /* offset += 1; skip the space */ if (is_ANS) { /* We need to put in the ansno */ offset += 1; /* skip the space */ /* Dissect the message number */ offset += dissect_beep_int(tvb, offset, hdr, hf_beep_ansno, &ansno, req_ansno_hfa); } if ((cc = check_term(tvb, offset, hdr)) <= 0) { /* We dissect the rest as data and bail ... */ if (tree) { proto_tree_add_text(hdr, tvb, offset, tvb_length_remaining(tvb, offset), "Undissected Payload: %s", tvb_format_text(tvb, offset,//.........这里部分代码省略.........
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:101,
示例19: dissect_beepstatic voiddissect_beep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ int offset; struct beep_proto_data *beep_frame_data = NULL; proto_tree *beep_tree = NULL, *ti = NULL; conversation_t *conversation = NULL; struct beep_request_key request_key, *new_request_key; struct beep_request_val *request_val = NULL; offset = 0; /* If we have per frame data, use that, else, we must have lost the per- * frame data, and we have to do a full dissect pass again. * * The per-frame data tells us how much of this frame is left over from a * previous frame, so we dissect it as payload and then try to dissect the * rest. * * We use the conversation to build up info on the first pass over the * packets of type BEEP, and record anything that is needed if the user * does random dissects of packets in per packet data. * * Once we have per-packet data, we don't need the conversation stuff * anymore, but if per-packet data and conversation stuff gets deleted, as * it does under some circumstances when a rescan is done, it all gets * rebuilt. */ /* Find out what conversation this packet is part of ... but only * if we have no information on this packet, so find the per-frame * info first. */ beep_frame_data = p_get_proto_data(pinfo->fd, proto_beep); if (!beep_frame_data) { conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); if (conversation == NULL) { /* No conversation, create one */ conversation = conversation_new(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); } /* * Check for and insert an entry in the request table if does not exist */ request_key.conversation = conversation->index; request_val = (struct beep_request_val *)g_hash_table_lookup(beep_request_hash, &request_key); if (!request_val) { /* Create one */ new_request_key = se_alloc(sizeof(struct beep_request_key)); new_request_key->conversation = conversation->index; request_val = se_alloc(sizeof(struct beep_request_val)); request_val->processed = 0; request_val->size = 0; g_hash_table_insert(beep_request_hash, new_request_key, request_val); } } col_set_str(pinfo->cinfo, COL_PROTOCOL, "BEEP"); if (check_col(pinfo->cinfo, COL_INFO)) { /* Check the type ... */ /* "tvb_format_text()" is passed a value that won't go past the end * of the packet, so it won't throw an exception. */ col_add_str(pinfo->cinfo, COL_INFO, tvb_format_text(tvb, offset, tvb_length_remaining(tvb, offset))); } /* Here, we parse the message so we can retrieve the info we need, which * is that there is some payload left from a previous segment on the * front of this segment ... This all depends on TCP segments not getting * out of order ... * * As a huge kludge, we push the checking for the tree down into the code * and process as if we were given a tree but not call the routines that * adorn the protocol tree if they were NULL. */ if (tree) { /* Build the tree info ... */ ti = proto_tree_add_item(tree, proto_beep, tvb, offset, -1, FALSE); beep_tree = proto_item_add_subtree(ti, ett_beep); } /* Check the per-frame data and the conversation for any left-over * payload from the previous frame * * We check that per-frame data exists first, and if so, use it, * else we use the conversation data.//.........这里部分代码省略.........
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:101,
示例20: dissect_clnp//.........这里部分代码省略......... /* Get a tvbuff for the payload. Set its length to the segment length, and flag it as a fragment, so going past the end reports FragmentBoundsError, i.e. "there's data missing because this isn't reassembled", not ReportedBoundsError, i.e. "the dissector ran past the end of the packet, so the packet must not have been constructed properly". */ next_tvb = tvb_new_subset_length(tvb, offset, segment_length - cnf_hdr_len); tvb_set_fragment(next_tvb); /* * If this is the first segment, but not the only segment, * tell the next protocol that. */ if ((cnf_type & (CNF_SEG_OK|CNF_MORE_SEGS)) == (CNF_SEG_OK|CNF_MORE_SEGS)) pinfo->fragmented = TRUE; else pinfo->fragmented = FALSE; } } if (next_tvb == NULL) { /* Just show this as a segment. */ col_add_fstr(pinfo->cinfo, COL_INFO, "Fragmented %s NPDU %s(off=%u)", pdu_type_string, flag_string, segment_offset); /* As we haven't reassembled anything, we haven't changed "pi", so we don't have to restore it. */ call_dissector(data_handle, tvb_new_subset_remaining(tvb, offset), pinfo, tree); pinfo->fragmented = save_fragmented; return; } if (tvb_offset_exists(tvb, offset)) { switch (cnf_type & CNF_TYPE) { case DT_NPDU: case MD_NPDU: /* Continue with COTP if any data. XXX - if this isn't the first Derived PDU of a segmented Initial PDU, skip that? */ if (nsel==NSEL_NET && tvb_get_guint8(next_tvb, 0)==NLPID_ISO10747_IDRP) { if(call_dissector(idrp_handle, next_tvb, pinfo, tree) != 0) { pinfo->fragmented = save_fragmented; return; } } if (nsel == (guchar)tp_nsap_selector || always_decode_transport) { if (call_dissector(ositp_handle, next_tvb, pinfo, tree) != 0) { pinfo->fragmented = save_fragmented; return; /* yes, it appears to be COTP or CLTP */ } } if (dissector_try_heuristic(clnp_heur_subdissector_list, next_tvb, pinfo, tree, NULL)) { pinfo->fragmented = save_fragmented; return; /* yes, it appears to be one of the protocols in the heuristic list */ } break; case ER_NPDU: /* The payload is the header and "none, some, or all of the data part of the discarded PDU", i.e. it's like an ICMP error; dissect it as a CLNP PDU. */ col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); next_length = tvb_length_remaining(tvb, offset); if (next_length != 0) { /* We have payload; dissect it. */ ti = proto_tree_add_text(clnp_tree, tvb, offset, next_length, "Discarded PDU"); discpdu_tree = proto_item_add_subtree(ti, ett_clnp_disc_pdu); /* Save the current value of the "we're inside an error packet" flag, and set that flag; subdissectors may treat packets that are the payload of error packets differently from "real" packets. */ save_in_error_pkt = pinfo->flags.in_error_pkt; pinfo->flags.in_error_pkt = TRUE; call_dissector(clnp_handle, next_tvb, pinfo, discpdu_tree); /* Restore the "we're inside an error packet" flag. */ pinfo->flags.in_error_pkt = save_in_error_pkt; } pinfo->fragmented = save_fragmented; return; /* we're done with this PDU */ case ERQ_NPDU: case ERP_NPDU: /* XXX - dissect this */ break; } } col_add_fstr(pinfo->cinfo, COL_INFO, "%s NPDU %s", pdu_type_string, flag_string); call_dissector(data_handle,next_tvb, pinfo, tree); pinfo->fragmented = save_fragmented;} /* dissect_clnp */
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:101,
示例21: sss_stringstatic intsss_string(tvbuff_t* tvb, int hfinfo, proto_tree *sss_tree, int offset, gboolean little, guint32 length){ int foffset = offset; guint32 str_length; char buffer[1024]; guint32 i; guint8 c_char; gint length_remaining; if (length==0) { if (little) { str_length = tvb_get_letohl(tvb, foffset); } else { str_length = tvb_get_ntohl(tvb, foffset); } foffset += 4; } else { str_length = length; } length_remaining = tvb_length_remaining(tvb, foffset); if (length_remaining <= 0) { return foffset; } if (str_length > (guint)length_remaining || str_length > (sizeof(buffer)-1)) { proto_tree_add_string(sss_tree, hfinfo, tvb, foffset, length_remaining + 4, "<String too long to process>"); foffset += length_remaining; return foffset; } if (str_length == 0) { proto_tree_add_string(sss_tree, hfinfo, tvb, offset, 4, "<Not Specified>"); return foffset; } for ( i = 0; i < str_length; i++ ) { c_char = tvb_get_guint8(tvb, foffset); if (isprint(c_char)) { buffer[i] = c_char; } else { if (c_char) { buffer[i] = '.'; } else { /* Skip NULL-terminators */ i--; str_length--; } } foffset++; } buffer[i] = '/0'; if (length==0) { if (little) { str_length = tvb_get_letohl(tvb, offset); } else { str_length = tvb_get_ntohl(tvb, offset); } offset += 4; } else { str_length = length; } proto_tree_add_string(sss_tree, hfinfo, tvb, offset, str_length, buffer); return foffset;}
开发者ID:mcrotty,项目名称:stack,代码行数:64,
注:本文中的tvb_length_remaining函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tvb_memcpy函数代码示例 C++ tvb_get_string_enc函数代码示例 |