这篇教程C++ tvb_get_ntohl函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中tvb_get_ntohl函数的典型用法代码示例。如果您正苦于以下问题:C++ tvb_get_ntohl函数的具体用法?C++ tvb_get_ntohl怎么用?C++ tvb_get_ntohl使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了tvb_get_ntohl函数的26个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: add_ethernet_trailer//.........这里部分代码省略......... if (fcs_len == 4 || (tvb_reported_length(tvb) >= 64 && trailer_reported_length >= 4)) { /* Either we know we have an FCS, or we believe we have an FCS. */ if (trailer_length < trailer_reported_length) { /* The packet is claimed to have enough data for a 4-byte FCS, but we didn't capture all of the packet. Slice off the 4-byte FCS from the reported length, and trim the captured length so it's no more than the reported length; that will slice off what of the FCS, if any, is in the captured packet. */ trailer_reported_length -= 4; if (trailer_length > trailer_reported_length) trailer_length = trailer_reported_length; has_fcs = TRUE; } else { /* We captured all of the packet, including what appears to be a 4-byte FCS. Slice it off. */ trailer_length -= 4; trailer_reported_length -= 4; has_fcs = TRUE; } } } /* Create a new tvb without the padding and/or the (assumed) fcs */ if (fcs_len==4) real_trailer_tvb = tvb_new_subset(trailer_tvb, padding_length, trailer_length, trailer_reported_length); else real_trailer_tvb = tvb_new_subset_remaining(trailer_tvb, padding_length); /* Call all ethernet trailer dissectors to dissect the trailer if we actually have a trailer. */ if (tvb_reported_length(real_trailer_tvb) != 0) { if (dissector_try_heuristic(eth_trailer_subdissector_list, real_trailer_tvb, pinfo, tree, NULL) ) { /* If we're not sure that there is a FCS, all trailer data has been given to the ethernet-trailer dissector, so stop dissecting here */ if (fcs_len!=4) return; } else { /* No luck with the trailer dissectors, so just display the extra bytes as general trailer */ if (trailer_length != 0) { tvb_ensure_bytes_exist(tvb, 0, trailer_length); proto_tree_add_item(fh_tree, trailer_id, real_trailer_tvb, 0, trailer_length, ENC_NA); } } } if (has_fcs) { guint32 sent_fcs = tvb_get_ntohl(trailer_tvb, padding_length+trailer_length); if(eth_check_fcs){ guint32 fcs = crc32_802_tvb(tvb, tvb_length(tvb) - 4); if (fcs == sent_fcs) { item = proto_tree_add_uint_format(fh_tree, hf_eth_fcs, trailer_tvb, padding_length+trailer_length, 4, sent_fcs, "Frame check sequence: 0x%08x [correct]", sent_fcs); checksum_tree = proto_item_add_subtree(item, ett_eth_fcs); item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_good, trailer_tvb, padding_length+trailer_length, 4, TRUE); PROTO_ITEM_SET_GENERATED(item); item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, trailer_tvb, padding_length+trailer_length, 4, FALSE); PROTO_ITEM_SET_GENERATED(item); } else { item = proto_tree_add_uint_format(fh_tree, hf_eth_fcs, trailer_tvb, padding_length+trailer_length, 4, sent_fcs, "Frame check sequence: 0x%08x [incorrect, should be 0x%08x]", sent_fcs, fcs); checksum_tree = proto_item_add_subtree(item, ett_eth_fcs); item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_good, trailer_tvb, padding_length+trailer_length, 4, FALSE); PROTO_ITEM_SET_GENERATED(item); item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, trailer_tvb, padding_length+trailer_length, 4, TRUE); PROTO_ITEM_SET_GENERATED(item); expert_add_info(pinfo, item, &ei_eth_fcs_bad); col_append_str(pinfo->cinfo, COL_INFO, " [ETHERNET FRAME CHECK SEQUENCE INCORRECT]"); } }else{ item = proto_tree_add_uint_format(fh_tree, hf_eth_fcs, trailer_tvb, padding_length+trailer_length, 4, sent_fcs, "Frame check sequence: 0x%08x [validiation disabled]", sent_fcs); checksum_tree = proto_item_add_subtree(item, ett_eth_fcs); item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_good, trailer_tvb, padding_length+trailer_length, 4, FALSE); PROTO_ITEM_SET_GENERATED(item); item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, trailer_tvb, padding_length+trailer_length, 4, FALSE); PROTO_ITEM_SET_GENERATED(item); } trailer_length += 4; } proto_tree_set_appendix(fh_tree, tvb, tvb_length(tvb) - padding_length - trailer_length, padding_length + trailer_length); }}
开发者ID:Biamp-Systems,项目名称:wireshark,代码行数:101,
示例2: col_set_str col_set_str(pinfo->cinfo, COL_INFO, "Continuation"); if (tree) { proto_tree_add_item(tree, proto_tuxedo, tvb, 0, -1, ENC_NA); } } }}static gbooleandissect_tuxedo_heur(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_){ if (tvb_captured_length(tvb) >= 8) { guint32 magic; magic = tvb_get_ntohl(tvb, 0); if (magic == TUXEDO_MAGIC || magic == TUXEDO_SMAGIC) { /* Register this dissector for this conversation */ conversation_t *conversation = NULL; conversation = find_or_create_conversation(pinfo); conversation_set_dissector(conversation, tuxedo_handle); dissect_tuxedo(tvb, pinfo, tree); return TRUE; } } return FALSE;}void
开发者ID:ajitlakhwani,项目名称:wireshark,代码行数:31,
示例3: gluster_gd_mgmt_dissect_uuid/* the UUID is the same as a GlusterFS GFID, except it's encoded per byte */static intgluster_gd_mgmt_dissect_uuid(tvbuff_t *tvb, proto_tree *tree, int hfindex, int offset){ if (tree) { e_guid_t uuid; int start_offset = offset; uuid.data1 = (tvb_get_ntohl(tvb, offset) & 0xff) << 24 | (tvb_get_ntohl(tvb, offset+4) & 0xff) << 16 | (tvb_get_ntohl(tvb, offset+8) & 0xff) << 8 | (tvb_get_ntohl(tvb, offset+12) & 0xff); offset += 16; uuid.data2 = (tvb_get_ntohl(tvb, offset) & 0xff) << 8 | (tvb_get_ntohl(tvb, offset+4) & 0xff); offset += 8; uuid.data3 = (tvb_get_ntohl(tvb, offset) & 0xff) << 8 | (tvb_get_ntohl(tvb, offset+4) & 0xff); offset += 8; uuid.data4[0] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[1] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[2] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[3] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[4] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[5] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[6] = tvb_get_ntohl(tvb, offset); offset += 4; uuid.data4[7] = tvb_get_ntohl(tvb, offset); offset += 4; proto_tree_add_guid(tree, hfindex, tvb, start_offset, 4*16, &uuid); } else offset += 16 * 4; return offset;}
开发者ID:home201448,项目名称:wireshark,代码行数:42,
示例4: dissect_pgsql_fe_msgstatic void dissect_pgsql_fe_msg(guchar type, guint length, tvbuff_t *tvb, gint n, proto_tree *tree, pgsql_conn_data_t *conv_data){ guchar c; gint i, siz; char *s; proto_tree *shrub; switch (type) { /* Password */ case 'p': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_passwd, tvb, n, siz, ENC_ASCII|ENC_NA); break; /* Simple query */ case 'Q': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_query, tvb, n, siz, ENC_ASCII|ENC_NA); break; /* Parse */ case 'P': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_statement, tvb, n, siz, ENC_ASCII|ENC_NA); n += siz; siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_query, tvb, n, siz, ENC_ASCII|ENC_NA); n += siz; i = tvb_get_ntohs(tvb, n); shrub = proto_tree_add_subtree_format(tree, tvb, n, 2, ett_values, NULL, "Parameters: %d", i); n += 2; while (i-- > 0) { proto_tree_add_item(shrub, hf_typeoid, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; } break; /* Bind */ case 'B': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_portal, tvb, n, siz, ENC_ASCII|ENC_NA); n += siz; siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_statement, tvb, n, siz, ENC_ASCII|ENC_NA); n += siz; i = tvb_get_ntohs(tvb, n); shrub = proto_tree_add_subtree_format(tree, tvb, n, 2, ett_values, NULL, "Parameter formats: %d", i); n += 2; while (i-- > 0) { proto_tree_add_item(shrub, hf_format, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; } i = tvb_get_ntohs(tvb, n); shrub = proto_tree_add_subtree_format(tree, tvb, n, 2, ett_values, NULL, "Parameter values: %d", i); n += 2; while (i-- > 0) { siz = tvb_get_ntohl(tvb, n); proto_tree_add_int(shrub, hf_val_length, tvb, n, 4, siz); n += 4; if (siz > 0) { proto_tree_add_item(shrub, hf_val_data, tvb, n, siz, ENC_NA); n += siz; } } i = tvb_get_ntohs(tvb, n); shrub = proto_tree_add_subtree_format(tree, tvb, n, 2, ett_values, NULL, "Result formats: %d", i); n += 2; while (i-- > 0) { proto_tree_add_item(shrub, hf_format, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; } break; /* Execute */ case 'E': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_portal, tvb, n, siz, ENC_ASCII|ENC_NA); n += siz; i = tvb_get_ntohl(tvb, n); if (i == 0) proto_tree_add_uint_format_value(tree, hf_return, tvb, n, 4, i, "all rows"); else proto_tree_add_uint_format_value(tree, hf_return, tvb, n, 4, i, "%d rows", i); break; /* Describe, Close */ case 'D': case 'C': c = tvb_get_guint8(tvb, n); if (c == 'P') i = hf_portal;//.........这里部分代码省略.........
开发者ID:CharaD7,项目名称:wireshark,代码行数:101,
示例5: dissect_ipxwan//.........这里部分代码省略......... } break; case OPT_RIP_SAP_INFO_EXCHANGE: if (option_data_len != 54) { proto_tree_add_text(option_tree, tvb, offset, option_data_len, "Bogus length: %u, should be 54", option_data_len); } else { wan_link_delay = tvb_get_ntohs(tvb, offset); proto_tree_add_uint_format(option_tree, hf_ipxwan_wan_link_delay, tvb, offset, 2, wan_link_delay, "WAN Link Delay: %ums", wan_link_delay); proto_tree_add_item(option_tree, hf_ipxwan_common_network_number, tvb, offset+2, 4, FALSE); proto_tree_add_item(option_tree, hf_ipxwan_router_name, tvb, offset+6, 48, FALSE); } break; case OPT_NLSP_INFORMATION: if (option_data_len != 8) { proto_tree_add_text(option_tree, tvb, offset, option_data_len, "Bogus length: %u, should be 8", option_data_len); } else { delay = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(option_tree, hf_ipxwan_delay, tvb, offset, 4, delay, "Delay: %uus", delay); throughput = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(option_tree, hf_ipxwan_throughput, tvb, offset, 4, throughput, "Throughput: %uus", throughput); } break; case OPT_NLSP_RAW_THROUGHPUT_DATA: if (option_data_len != 8) { proto_tree_add_text(option_tree, tvb, offset, option_data_len, "Bogus length: %u, should be 8", option_data_len); } else { proto_tree_add_item(option_tree, hf_ipxwan_request_size, tvb, offset, 4, FALSE); delta_time = tvb_get_ntohl(tvb, offset); proto_tree_add_uint_format(option_tree, hf_ipxwan_delta_time, tvb, offset, 4, delta_time, "Delta Time: %uus", delta_time); } break;
开发者ID:RazZziel,项目名称:wireshark-dplay,代码行数:66,
示例6: dissect_nbd_tcp_pdustatic voiddissect_nbd_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree){ guint32 magic, error, packet; guint32 handle[2]; guint64 from; int offset=0; proto_tree *tree=NULL; proto_item *item=NULL; conversation_t *conversation; nbd_conv_info_t *nbd_info; nbd_transaction_t *nbd_trans=NULL; emem_tree_key_t hkey[3]; col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBD"); col_clear(pinfo->cinfo, COL_INFO); item = proto_tree_add_item(parent_tree, proto_nbd, tvb, 0, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_nbd); magic=tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_nbd_magic, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* grab what we need to do the request/response matching */ switch(magic){ case NBD_REQUEST_MAGIC: case NBD_RESPONSE_MAGIC: handle[0]=tvb_get_ntohl(tvb, offset+4); handle[1]=tvb_get_ntohl(tvb, offset+8); break; default: return; } conversation = find_or_create_conversation(pinfo); /* * Do we already have a state structure for this conv */ nbd_info = conversation_get_proto_data(conversation, proto_nbd); if (!nbd_info) { /* No. Attach that information to the conversation, and add * it to the list of information structures. */ nbd_info = se_alloc(sizeof(nbd_conv_info_t)); nbd_info->unacked_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "nbd_unacked_pdus"); nbd_info->acked_pdus=se_tree_create_non_persistent(EMEM_TREE_TYPE_RED_BLACK, "nbd_acked_pdus"); conversation_add_proto_data(conversation, proto_nbd, nbd_info); } if(!pinfo->fd->flags.visited){ if(magic==NBD_REQUEST_MAGIC){ /* This is a request */ nbd_trans=se_alloc(sizeof(nbd_transaction_t)); nbd_trans->req_frame=pinfo->fd->num; nbd_trans->rep_frame=0; nbd_trans->req_time=pinfo->fd->abs_ts; nbd_trans->type=tvb_get_ntohl(tvb, offset); nbd_trans->datalen=tvb_get_ntohl(tvb, offset+20); hkey[0].length=2; hkey[0].key=handle; hkey[1].length=0; se_tree_insert32_array(nbd_info->unacked_pdus, hkey, (void *)nbd_trans); } else if(magic==NBD_RESPONSE_MAGIC){ hkey[0].length=2; hkey[0].key=handle; hkey[1].length=0; nbd_trans=se_tree_lookup32_array(nbd_info->unacked_pdus, hkey); if(nbd_trans){ nbd_trans->rep_frame=pinfo->fd->num; hkey[0].length=1; hkey[0].key=&nbd_trans->rep_frame; hkey[1].length=2; hkey[1].key=handle; hkey[2].length=0; se_tree_insert32_array(nbd_info->acked_pdus, hkey, (void *)nbd_trans); hkey[0].length=1; hkey[0].key=&nbd_trans->req_frame; hkey[1].length=2; hkey[1].key=handle; hkey[2].length=0; se_tree_insert32_array(nbd_info->acked_pdus, hkey, (void *)nbd_trans); } } } else { packet=pinfo->fd->num; hkey[0].length=1; hkey[0].key=&packet; hkey[1].length=2; hkey[1].key=handle; hkey[2].length=0;//.........这里部分代码省略.........
开发者ID:dogphilly,项目名称:wireshark,代码行数:101,
示例7: dissect_pw_cesopsn//.........这里部分代码省略......... { /*allow any size of payload*/ } } } /* fill up columns*/ col_set_str(pinfo->cinfo, COL_PROTOCOL, shortname); col_clear(pinfo->cinfo, COL_INFO); if (properties & PWC_ANYOF_CW_BAD) { col_set_str(pinfo->cinfo, COL_INFO, "CW:Bad, "); } else if (properties & PWC_ANYOF_CW_SUSPECT) { col_append_str(pinfo->cinfo, COL_INFO, "CW:Suspect, "); } if (properties & PWC_PAY_SIZE_BAD) { col_append_str(pinfo->cinfo, COL_INFO, "Payload size:Bad, "); } col_append_fstr(pinfo->cinfo, COL_INFO, "TDM octets:%d", (int)payload_size); if (padding_size != 0) { col_append_fstr(pinfo->cinfo, COL_INFO, ", Padding:%d", (int)padding_size); } { proto_item* item; item = proto_tree_add_item(tree, proto, tvb_original, 0, -1, ENC_NA); pwc_item_append_cw(item,tvb_get_ntohl(tvb_original, 0),TRUE); pwc_item_append_text_n_items(item,(int)payload_size,"octet"); { proto_tree* tree2; tree2 = proto_item_add_subtree(item, ett); { tvbuff_t* tvb; proto_item* item2; tvb = tvb_new_subset_length(tvb_original, 0, PWC_SIZEOF_CW); item2 = proto_tree_add_item(tree2, hf_cw, tvb, 0, -1, ENC_NA); pwc_item_append_cw(item2,tvb_get_ntohl(tvb, 0),FALSE); { proto_tree* tree3; tree3 = proto_item_add_subtree(item, ett); { proto_item* item3; if (properties & PWC_CW_BAD_BITS03) /*display only if value is wrong*/ { item3 = proto_tree_add_item(tree3, hf_cw_bits03, tvb, 0, 1, ENC_BIG_ENDIAN); expert_add_info(pinfo, item3, &ei_cw_bits03); } item3 = proto_tree_add_item(tree3, hf_cw_lm, tvb, 0, 1, ENC_BIG_ENDIAN); if (properties & PWC_CW_SUSPECT_LM) { expert_add_info(pinfo, item3, &ei_cw_lm); } proto_tree_add_item(tree3, hf_cw_r, tvb, 0, 1, ENC_BIG_ENDIAN); item3 = proto_tree_add_item(tree3, hf_cw_frg, tvb, 1, 1, ENC_BIG_ENDIAN); if (properties & PWC_CW_BAD_FRAG) {
开发者ID:DHODoS,项目名称:wireshark,代码行数:67,
示例8: dissect_llrp_messagestatic voiddissect_llrp_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 type, guint offset){ guint8 requested_data; guint16 antenna_id, gpi_port, gpo_port; guint32 spec_id; proto_item *ti; switch (type) { /* Simple cases just have normal TLV or TV parameters */ case LLRP_TYPE_CLOSE_CONNECTION_RESPONSE: case LLRP_TYPE_GET_READER_CAPABILITES_RESPONSE: case LLRP_TYPE_ADD_ROSPEC: case LLRP_TYPE_ADD_ROSPEC_RESPONSE: case LLRP_TYPE_DELETE_ROSPEC_RESPONSE: case LLRP_TYPE_START_ROSPEC_RESPONSE: case LLRP_TYPE_STOP_ROSPEC_RESPONSE: case LLRP_TYPE_ENABLE_ROSPEC_RESPONSE: case LLRP_TYPE_DISABLE_ROSPEC_RESPONSE: case LLRP_TYPE_GET_ROSPECS_RESPONSE: case LLRP_TYPE_ADD_ACCESSSPEC: case LLRP_TYPE_ADD_ACCESSSPEC_RESPONSE: case LLRP_TYPE_DELETE_ACCESSSPEC_RESPONSE: case LLRP_TYPE_ENABLE_ACCESSSPEC_RESPONSE: case LLRP_TYPE_DISABLE_ACCESSSPEC_RESPONSE: case LLRP_TYPE_GET_ACCESSSPECS: case LLRP_TYPE_CLIENT_REQUEST_OP: case LLRP_TYPE_CLIENT_RESQUEST_OP_RESPONSE: case LLRP_TYPE_RO_ACCESS_REPORT: case LLRP_TYPE_READER_EVENT_NOTIFICATION: case LLRP_TYPE_ERROR_MESSAGE: case LLRP_TYPE_GET_READER_CONFIG_RESPONSE: case LLRP_TYPE_SET_READER_CONFIG_RESPONSE: case LLRP_TYPE_SET_PROTOCOL_VERSION_RESPONSE: case LLRP_TYPE_GET_ACCESSSPECS_RESPONSE: case LLRP_TYPE_GET_REPORT: case LLRP_TYPE_ENABLE_EVENTS_AND_REPORTS: dissect_llrp_parameters(tvb, pinfo, tree, offset); break; /* Some just have an ROSpec ID */ case LLRP_TYPE_START_ROSPEC: case LLRP_TYPE_STOP_ROSPEC: case LLRP_TYPE_ENABLE_ROSPEC: case LLRP_TYPE_DISABLE_ROSPEC: case LLRP_TYPE_DELETE_ROSPEC: spec_id = tvb_get_ntohl(tvb, offset); if (spec_id == LLRP_ROSPEC_ALL) proto_tree_add_uint_format(tree, hf_llrp_rospec, tvb, offset, 4, spec_id, "All ROSpecs (%u)", spec_id); else proto_tree_add_item(tree, hf_llrp_rospec, tvb, offset, 4, ENC_BIG_ENDIAN); break; /* Some just have an AccessSpec ID */ case LLRP_TYPE_ENABLE_ACCESSSPEC: case LLRP_TYPE_DELETE_ACCESSSPEC: case LLRP_TYPE_DISABLE_ACCESSSPEC: spec_id = tvb_get_ntohl(tvb, offset); if (spec_id == LLRP_ACCESSSPEC_ALL) proto_tree_add_uint_format(tree, hf_llrp_accessspec, tvb, offset, 4, spec_id, "All Access Specs (%u)", spec_id); else proto_tree_add_item(tree, hf_llrp_accessspec, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_llrp_accessspec, tvb, offset, 4, ENC_BIG_ENDIAN); break; case LLRP_TYPE_GET_READER_CAPABILITES: proto_tree_add_item(tree, hf_llrp_req_cap, tvb, offset, 1, ENC_NA); offset++; dissect_llrp_parameters(tvb, pinfo, tree, offset); break; /* GET_READER_CONFIG is complicated */ case LLRP_TYPE_GET_READER_CONFIG: requested_data = tvb_get_guint8(tvb, offset + 2); switch (requested_data) { case LLRP_CONF_ALL: antenna_id = tvb_get_ntohs(tvb, offset); if (antenna_id == LLRP_ANTENNA_ALL) proto_tree_add_uint_format(tree, hf_llrp_antenna_id, tvb, offset, 2, antenna_id, "All Antennas (%u)", antenna_id); else proto_tree_add_item(tree, hf_llrp_antenna_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_llrp_req_conf, tvb, offset, 1, ENC_NA); offset++; gpi_port = tvb_get_ntohs(tvb, offset); if (gpi_port == LLRP_GPI_PORT_ALL) proto_tree_add_uint_format(tree, hf_llrp_gpi_port, tvb, offset, 2, gpi_port, "All GPI Ports (%u)", gpi_port); else proto_tree_add_item(tree, hf_llrp_gpi_port, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; gpo_port = tvb_get_ntohs(tvb, offset); if (gpo_port == LLRP_GPO_PORT_ALL)//.........这里部分代码省略.........
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:101,
示例9: dissect_dcc//.........这里部分代码省略......... D_TARGET(); } D_SIGNATURE(); break; case DCC_OP_ADMN: if ( is_response ) { int left_local = tvb_length_remaining(tvb, offset) - sizeof(DCC_SIGNATURE); if ( left_local == sizeof(DCC_ADMN_RESP_CLIENTS) ) { D_LABEL("Addr", 16); D_LABEL("Id", sizeof(DCC_CLNT_ID)); D_LABEL("Last Used", 4); D_LABEL("Requests", 4); } else { D_TEXT("Response Text", sizeof(DCC_SIGNATURE)); } D_SIGNATURE(); } else { int aop; D_DATE(); aop = tvb_get_guint8(tvb, offset+4); proto_tree_add_item(dcc_optree, hf_dcc_adminop, tvb, offset+4, 1, FALSE); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(tvb_get_guint8(tvb,offset+4), dcc_adminop_vals, "Unknown (%u)")); } if (aop == DCC_AOP_TRACE_ON || aop == DCC_AOP_TRACE_OFF ) { ti = proto_tree_add_item(dcc_optree, hf_dcc_trace, tvb, offset, 4, FALSE); dcc_tracetree = proto_item_add_subtree(ti, ett_dcc_trace); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_admin, tvb, offset, 4, FALSE); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_anon, tvb, offset, 4, FALSE); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_client, tvb, offset, 4, FALSE); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_rlim, tvb, offset, 4, FALSE); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_query, tvb, offset, 4, FALSE); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_ridc, tvb, offset, 4, FALSE); proto_tree_add_item(dcc_tracetree, hf_dcc_trace_flood, tvb, offset, 4, FALSE); } else if ( aop == DCC_AOP_FLOD ) { proto_tree_add_item(dcc_optree, hf_dcc_floodop, tvb, offset, 4, FALSE); if (check_col(pinfo->cinfo, COL_INFO)) { col_append_fstr(pinfo->cinfo, COL_INFO, ", %s", val_to_str(tvb_get_ntohl(tvb,offset), dcc_floodop_vals, "Unknown (%u)")); } } else { proto_tree_add_item(dcc_optree, hf_dcc_adminval, tvb, offset, 4, FALSE); } offset += 4; offset += 1; /* admin op we did in reverse order */ D_LABEL("Pad", 3); D_SIGNATURE(); } break; case DCC_OP_OK: proto_tree_add_item(dcc_optree, hf_dcc_max_pkt_vers, tvb, offset, 1, FALSE); offset += 1; D_LABEL("Unused", 1); proto_tree_add_item(dcc_optree, hf_dcc_qdelay_ms, tvb, offset, 2, FALSE); offset += 2; proto_tree_add_item(dcc_optree, hf_dcc_brand, tvb, offset, sizeof(DCC_BRAND), FALSE); offset += sizeof(DCC_BRAND); D_SIGNATURE(); break; default: /* do nothing */ break; } } return TRUE;}
开发者ID:AkhilaAG,项目名称:gluster-wireshark-1.4,代码行数:101,
示例10: dissect_v2_link_status_messagestatic voiddissect_v2_link_status_message(tvbuff_t *message_data_tvb, packet_info *pinfo, proto_tree *m2pa_tree){ col_append_fstr(pinfo->cinfo, COL_INFO, "(%s) ", val_to_str_const(tvb_get_ntohl(message_data_tvb, STATUS_OFFSET), v2_link_status_values, "Unknown")); proto_tree_add_item(m2pa_tree, hf_v2_status, message_data_tvb, STATUS_OFFSET, STATUS_LENGTH, ENC_BIG_ENDIAN);}
开发者ID:CharaD7,项目名称:wireshark,代码行数:6,
示例11: dissect_omapistatic voiddissect_omapi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ proto_item *ti; proto_tree *omapi_tree; ptvcursor_t* cursor; guint32 authlength; guint32 msglength; guint32 objlength; col_set_str(pinfo->cinfo, COL_PROTOCOL, "OMAPI"); col_clear(pinfo->cinfo, COL_INFO); ti = proto_tree_add_item(tree, proto_omapi, tvb, 0, -1, ENC_NA); omapi_tree = proto_item_add_subtree(ti, ett_omapi); cursor = ptvcursor_new(omapi_tree, tvb, 0); if (tvb_reported_length_remaining(tvb, 0) < 8) { /* Payload too small for OMAPI */ DISSECTOR_ASSERT_NOT_REACHED(); } else if (tvb_reported_length_remaining(tvb, 0) < 24) { /* This is a startup message */ ptvcursor_add(cursor, hf_omapi_version, 4, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_hlength, 4, ENC_BIG_ENDIAN); col_set_str(pinfo->cinfo, COL_INFO, "Status message"); proto_item_append_text(ti, ", Status message"); return; } else if ( !(tvb_get_ntohl(tvb, 8) || tvb_get_ntohl(tvb, 12)) ) { /* This is a startup message, and more */ ptvcursor_add(cursor, hf_omapi_version, 4, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_hlength, 4, ENC_BIG_ENDIAN); col_append_str(pinfo->cinfo, COL_INFO, "Status message"); proto_item_append_text(ti, ", Status message"); } ptvcursor_add(cursor, hf_omapi_auth_id, 4, ENC_BIG_ENDIAN); authlength = tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_omapi_auth_len, 4, ENC_BIG_ENDIAN); col_append_sep_str(pinfo->cinfo, COL_INFO, NULL, val_to_str(tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)), omapi_opcode_vals, "Unknown opcode (0x%04x)")); proto_item_append_text(ti, ", Opcode: %s", val_to_str(tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)), omapi_opcode_vals, "Unknown opcode (0x%04x)")); ptvcursor_add(cursor, hf_omapi_opcode, 4, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_handle, 4, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_id, 4, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_rid, 4, ENC_BIG_ENDIAN); msglength = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); while (msglength) { ptvcursor_add(cursor, hf_omapi_msg_name_len, 2, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_msg_name, msglength, ENC_ASCII|ENC_NA); msglength = tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_omapi_msg_value_len, 4, ENC_BIG_ENDIAN); if (msglength == 0) { proto_tree_add_text(omapi_tree, tvb, 0, 0, "Empty string"); } else if (msglength == (guint32)~0) { proto_tree_add_text(omapi_tree, tvb, 0, 0, "No value"); } else { ptvcursor_add(cursor, hf_omapi_msg_value, msglength, ENC_ASCII|ENC_NA); } msglength = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); } proto_tree_add_text(omapi_tree, tvb, ptvcursor_current_offset(cursor), 2, "Message end tag"); ptvcursor_advance(cursor, 2); objlength = tvb_get_ntohs(tvb, ptvcursor_current_offset(cursor)); while (objlength) { ptvcursor_add(cursor, hf_omapi_obj_name_len, 2, ENC_BIG_ENDIAN); ptvcursor_add(cursor, hf_omapi_obj_name, objlength, ENC_ASCII|ENC_NA); objlength = tvb_get_ntohl(tvb, ptvcursor_current_offset(cursor)); ptvcursor_add(cursor, hf_omapi_obj_value_len, 4, ENC_BIG_ENDIAN); if (objlength == 0) { proto_tree_add_text(omapi_tree, tvb, 0, 0, "Empty string");//.........这里部分代码省略.........
开发者ID:LucaBongiorni,项目名称:LTE_monitor_c2xx,代码行数:101,
示例12: 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, tvb_rlen; itl_nexus_t *itl = NULL; proto_item *hidden_item; /* 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; } hidden_item = proto_tree_add_uint(tree, hf_fcp_type, tvb, offset, 0, 0); PROTO_ITEM_SET_HIDDEN(hidden_item); 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 (fchdr->itlq) fchdr->itlq->lun = lun; itl = (itl_nexus_t *)se_tree_lookup32(fcp_conv_data->luns, lun); if (!itl) { itl = se_alloc(sizeof(itl_nexus_t)); itl->cmdset = 0xff; itl->conversation = conversation; se_tree_insert32(fcp_conv_data->luns, lun, itl); } 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 (fchdr->itlq) { if (rwflags & 0x02) { fchdr->itlq->task_flags |= SCSI_DATA_READ; } if (rwflags & 0x01) { fchdr->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); if (tvb_len > (16 + add_len)) tvb_len = 16 + add_len; tvb_rlen = tvb_reported_length_remaining(tvb, offset+12); if (tvb_rlen > (16 + add_len)) tvb_rlen = 16 + add_len; cdb_tvb = tvb_new_subset(tvb, offset+12, tvb_len, tvb_rlen); dissect_scsi_cdb(cdb_tvb, pinfo, parent_tree, SCSI_DEV_UNKNOWN, fchdr->itlq, itl); proto_tree_add_item(tree, hf_fcp_dl, tvb, offset+12+16+add_len, 4, ENC_BIG_ENDIAN); if (fchdr->itlq) { fchdr->itlq->data_length = tvb_get_ntohl(tvb, offset+12+16+add_len); } if ( ((rwflags & 0x03) == 0x03) && tvb_length_remaining(tvb, offset+12+16+add_len+4) >= 4) { proto_tree_add_item(tree, hf_fcp_bidir_dl, tvb, offset+12+16+add_len+4, 4, ENC_BIG_ENDIAN); if (fchdr->itlq) { fchdr->itlq->bidir_data_length = tvb_get_ntohl(tvb, offset+12+16+add_len+4); } }}
开发者ID:hubolo,项目名称:wireshark-1.8.0,代码行数:93,
示例13: dissect_pgsql_be_msg//.........这里部分代码省略......... case 'T': i = tvb_get_ntohs(tvb, n); ti = proto_tree_add_item(tree, hf_field_count, tvb, n, 2, ENC_BIG_ENDIAN); shrub = proto_item_add_subtree(ti, ett_values); n += 2; while (i-- > 0) { proto_tree *twig; siz = tvb_strsize(tvb, n); ti = proto_tree_add_item(shrub, hf_val_name, tvb, n, siz, ENC_ASCII|ENC_NA); twig = proto_item_add_subtree(ti, ett_values); n += siz; proto_tree_add_item(twig, hf_tableoid, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; proto_tree_add_item(twig, hf_val_idx, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; proto_tree_add_item(twig, hf_typeoid, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; proto_tree_add_item(twig, hf_val_length, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; proto_tree_add_item(twig, hf_val_mod, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; proto_tree_add_item(twig, hf_format, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; } break; /* Data row */ case 'D': i = tvb_get_ntohs(tvb, n); ti = proto_tree_add_item(tree, hf_field_count, tvb, n, 2, ENC_BIG_ENDIAN); shrub = proto_item_add_subtree(ti, ett_values); n += 2; while (i-- > 0) { siz = tvb_get_ntohl(tvb, n); proto_tree_add_int(shrub, hf_val_length, tvb, n, 4, siz); n += 4; if (siz > 0) { proto_tree_add_item(shrub, hf_val_data, tvb, n, siz, ENC_NA); n += siz; } } break; /* Command completion */ case 'C': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_tag, tvb, n, siz, ENC_ASCII|ENC_NA); break; /* Ready */ case 'Z': proto_tree_add_item(tree, hf_status, tvb, n, 1, ENC_BIG_ENDIAN); break; /* Error, Notice */ case 'E': case 'N': length -= 4; while ((signed)length > 0) { c = tvb_get_guint8(tvb, n); if (c == '/0') break; s = tvb_get_stringz_enc(wmem_packet_scope(), tvb, n+1, &siz, ENC_ASCII); i = hf_text; switch (c) { case 'S': i = hf_severity; break;
开发者ID:michaeloed,项目名称:wireshark,代码行数:67,
示例14: dissect_dsmcc_diistatic voiddissect_dsmcc_dii(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset){ guint8 module_info_len; guint16 modules, private_data_len; guint16 module_id; guint8 module_version; guint module_size; guint i; proto_item *pi; proto_tree *mod_tree; proto_tree_add_item(tree, hf_dsmcc_dii_download_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_dsmcc_dii_block_size, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_dsmcc_dii_window_size, tvb, offset, 1, ENC_BIG_ENDIAN); offset +=1; proto_tree_add_item(tree, hf_dsmcc_dii_ack_period, tvb, offset, 1, ENC_BIG_ENDIAN); offset +=1; proto_tree_add_item(tree, hf_dsmcc_dii_t_c_download_window, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_dsmcc_dii_t_c_download_scenario, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; offset += dissect_dsmcc_dii_compat_desc(tvb, pinfo, tree, offset); proto_tree_add_item(tree, hf_dsmcc_dii_number_of_modules, tvb, offset, 2, ENC_BIG_ENDIAN); modules = tvb_get_ntohs(tvb, offset); offset += 2; for (i = 0; i < modules; i++ ) { module_id = tvb_get_ntohs(tvb, offset); module_size = tvb_get_ntohl(tvb, 2+offset); module_version = tvb_get_guint8(tvb, 6+offset); pi = proto_tree_add_text(tree, tvb, offset, -1, "Module Id: 0x%x, Version: %u, Size: %u", module_id, module_version, module_size); mod_tree = proto_item_add_subtree(pi, ett_dsmcc_dii_module); proto_tree_add_item(mod_tree, hf_dsmcc_dii_module_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(mod_tree, hf_dsmcc_dii_module_size, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(mod_tree, hf_dsmcc_dii_module_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset +=1; module_info_len = tvb_get_guint8(tvb, offset); proto_tree_add_item(mod_tree, hf_dsmcc_dii_module_info_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset +=1; if (0 < module_info_len) { proto_tree_add_item(mod_tree, hf_etv_module_abs_path, tvb, offset, 1, ENC_ASCII|ENC_NA); offset += module_info_len; } } private_data_len = tvb_get_ntohs(tvb, offset); proto_tree_add_item(tree, hf_dsmcc_dii_private_data_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; if (0 < private_data_len) { proto_tree_add_item(tree, hf_etv_dii_authority, tvb, offset, 1, ENC_ASCII|ENC_NA); offset += private_data_len; }}
开发者ID:Biamp-Systems,项目名称:wireshark,代码行数:66,
示例15: get_bzr_prefixed_lenstatic guint get_bzr_prefixed_len(tvbuff_t *tvb, int offset){ guint header_len; header_len = tvb_get_ntohl(tvb, offset); return 4 + header_len;}
开发者ID:dot-Sean,项目名称:wireshark-http2,代码行数:6,
示例16: get_nbd_tcp_pdu_len/* This function will try to determine the complete size of a PDU * based on the information in the header. */static guintget_nbd_tcp_pdu_len(packet_info *pinfo, tvbuff_t *tvb, int offset){ guint32 magic, type, packet; conversation_t *conversation; nbd_conv_info_t *nbd_info; nbd_transaction_t *nbd_trans=NULL; emem_tree_key_t hkey[3]; guint32 handle[2]; magic=tvb_get_ntohl(tvb, offset); switch(magic){ case NBD_REQUEST_MAGIC: type=tvb_get_ntohl(tvb, offset+4); switch(type){ case NBD_CMD_WRITE: return tvb_get_ntohl(tvb, offset+24)+28; default: return 28; } case NBD_RESPONSE_MAGIC: /* * Do we have a conversation for this connection? */ conversation = find_conversation(pinfo->fd->num, &pinfo->src, &pinfo->dst, pinfo->ptype, pinfo->srcport, pinfo->destport, 0); if (conversation == NULL) { /* No, so just return the rest of the current packet */ return tvb_length(tvb); } /* * Do we have a state structure for this conv */ nbd_info = conversation_get_proto_data(conversation, proto_nbd); if (!nbd_info) { /* No, so just return the rest of the current packet */ return tvb_length(tvb); } if(!pinfo->fd->flags.visited){ /* * Do we have a state structure for this transaction */ handle[0]=tvb_get_ntohl(tvb, offset+8); handle[1]=tvb_get_ntohl(tvb, offset+12); hkey[0].length=2; hkey[0].key=handle; hkey[1].length=0; nbd_trans=se_tree_lookup32_array(nbd_info->unacked_pdus, hkey); if(!nbd_trans){ /* No, so just return the rest of the current packet */ return tvb_length(tvb); } } else { /* * Do we have a state structure for this transaction */ handle[0]=tvb_get_ntohl(tvb, offset+8); handle[1]=tvb_get_ntohl(tvb, offset+12); packet=pinfo->fd->num; hkey[0].length=1; hkey[0].key=&packet; hkey[1].length=2; hkey[1].key=handle; hkey[2].length=0; nbd_trans=se_tree_lookup32_array(nbd_info->acked_pdus, hkey); if(!nbd_trans){ /* No, so just return the rest of the current packet */ return tvb_length(tvb); } } /* If this is a read response we must add the datalen to * the pdu size */ if(nbd_trans->type==NBD_CMD_READ){ return 16+nbd_trans->datalen; } else { return 16; } default: break; } /* Did not really look like a NBD packet after all */ return 0;}
开发者ID:dogphilly,项目名称:wireshark,代码行数:91,
示例17: dissect_fip//.........这里部分代码省略......... break; case FIP_DT_MAC: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_mac, &item); proto_tree_add_item(subtree, hf_fip_desc_mac, desc_tvb, 2, 6, ENC_NA); proto_item_append_text(item, "%s", tvb_bytes_to_ep_str_punct(desc_tvb, 2, 6, ':')); break; case FIP_DT_MAP_OUI: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_map, &item); text = tvb_fc_to_str(desc_tvb, 5); proto_tree_add_string(subtree, hf_fip_desc_map, desc_tvb, 5, 3, text); proto_item_append_text(item, "%s", text); break; case FIP_DT_NAME: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_name, &item); text = tvb_fcwwn_to_str(desc_tvb, 4); proto_tree_add_string(subtree, hf_fip_desc_name, desc_tvb, 4, 8, text); proto_item_append_text(item, "%s", text); break; case FIP_DT_FAB: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_fab, &item); proto_tree_add_item(subtree, hf_fip_desc_fab_vfid, desc_tvb, 2, 2, ENC_BIG_ENDIAN); text = tvb_fc_to_str(desc_tvb, 5); proto_tree_add_string(subtree, hf_fip_desc_fab_map, desc_tvb, 5, 3, text); text = tvb_fcwwn_to_str(desc_tvb, 8); proto_tree_add_string(subtree, hf_fip_desc_fab_name, desc_tvb, 8, 8, text); proto_item_append_text(item, "%s", text); break; case FIP_DT_FCOE_SIZE: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_mdl, &item); proto_tree_add_item(subtree, hf_fip_desc_fcoe_size, desc_tvb, 2, 2, ENC_BIG_ENDIAN); proto_item_append_text(item, "%u", tvb_get_ntohs(desc_tvb, 2)); break; case FIP_DT_FLOGI: case FIP_DT_FDISC: case FIP_DT_LOGO: case FIP_DT_ELP: { tvbuff_t *ls_tvb; fc_data_t fc_data = {ETHERTYPE_FIP, 0}; subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_caps, &item); ls_tvb = tvb_new_subset(desc_tvb, 4, dlen - 4, -1); call_dissector_with_data(fc_handle, ls_tvb, pinfo, subtree, &fc_data); proto_item_append_text(item, "%u bytes", dlen - 4); } break; case FIP_DT_VN: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_vn, &item); proto_tree_add_item(subtree, hf_fip_desc_vn_mac, desc_tvb, 2, 6, ENC_NA); proto_tree_add_item(subtree, hf_fip_desc_vn_fid, desc_tvb, 9, 3, ENC_BIG_ENDIAN); text = tvb_fcwwn_to_str(desc_tvb, 12); proto_tree_add_string(subtree, hf_fip_desc_vn_wwpn, desc_tvb, 12, 8, text); proto_item_append_text(item, "MAC %s FC_ID %6.6x", tvb_bytes_to_ep_str_punct(desc_tvb, 2, 6, ':'), tvb_get_ntoh24(desc_tvb, 9)); break; case FIP_DT_FKA: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_fka, &item); val = tvb_get_ntohl(desc_tvb, 4); proto_tree_add_uint_format_value(subtree, hf_fip_desc_fka, desc_tvb, 4, 4, val, "%u ms", val); proto_item_append_text(item, "%u ms", val); break; case FIP_DT_VEND: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_vend, &item); proto_tree_add_item(subtree, hf_fip_desc_vend, desc_tvb, 4, 8, ENC_NA); if (tvb_bytes_exist(desc_tvb, 9, -1)) { proto_tree_add_item(subtree, hf_fip_desc_vend_data, desc_tvb, 9, -1, ENC_NA); } break; case FIP_DT_VLAN: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_vlan, &item); proto_tree_add_item(subtree, hf_fip_desc_vlan, desc_tvb, 2, 2, ENC_BIG_ENDIAN); proto_item_append_text(item, "%u", tvb_get_ntohs(desc_tvb, 2)); break; case FIP_DT_FC4F: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_fc4f, &item); fip_desc_fc4f(desc_tvb, subtree, item); break; default: subtree = fip_desc_type_len(fip_tree, desc_tvb, dtype, ett_fip_dt_unk, &item); proto_tree_add_item(subtree, hf_fip_desc_unk, desc_tvb, 2, -1, ENC_NA); break; } }}
开发者ID:ARK1988,项目名称:wireshark,代码行数:101,
示例18: dissect_ldss_broadcast/* Broadcasts are searches, offers or promises. * * Searches are sent by * a peer when it needs a file (ie. while applying its policy, when it needs * files such as installers to install software.) * * Each broadcast relates to one file and each file is identified only by its * checksum - no file names are ever used. A search times out after 10 seconds * (configurable) and the peer will then attempt to act on any offers by * downloading (via push or pull - see dissect_ldss_transfer) from those peers. * * If no offers are received, the search fails and the peer fetches the file * from a remote server, generally a HTTP server on the other side of a WAN. * The protocol exists to minimize the number of WAN downloads needed. * * While downloading from WAN the peer sends promises to inform other peers * when it will be available for them to download. This prevents multiple peers * simultaneously downloading the same file. Promises also inform other peers * how much download bandwidth is being used by their download. Other peers use * this information and the configured knowledge of the WAN bandwidth to avoid * saturating the WAN link, as file downloads are a non-time-critical and * non-business-critical network function. LDSS is intended for networks of * 5-20 machines connected by slow WAN link. The current implementation of the * protocol allows administrator to configure "time windows" when WAN usage is * throttled/unthrottled, though this isn't visible in LDSS. * * Once a WAN download or a LAN transfer (see below above dissect_ldss_transfer) * has complete the peer will offer the file to other peers on the LAN so they * don't need to download it themselves. * * Peers also notify when they shut down in case any other peer is waiting for * a file. */static intdissect_ldss_broadcast(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ guint16 messageID; guint8 digest_type; guint8 compression; guint32 cookie; guint8 *digest; guint64 size; guint64 offset; guint32 targetTime; guint16 port; guint16 rate; guint16 messageDetail = INFERRED_NONE; proto_tree *ti, *ldss_tree; const gchar *packet_type, *packet_detail; messageID = tvb_get_ntohs (tvb, 0); digest_type = tvb_get_guint8 (tvb, 2); compression = tvb_get_guint8 (tvb, 3); cookie = tvb_get_ntohl (tvb, 4); digest = (guint8 *)tvb_memdup (wmem_file_scope(), tvb, 8, DIGEST_LEN); size = tvb_get_ntoh64 (tvb, 40); offset = tvb_get_ntoh64 (tvb, 48); targetTime = tvb_get_ntohl (tvb, 56); port = tvb_get_ntohs (tvb, 64); rate = tvb_get_ntohs (tvb, 66); packet_type = val_to_str_const(messageID, ldss_message_id_value, "unknown"); if (messageID == MESSAGE_ID_WILLSEND) { if (cookie == 0) { /* Shutdown: Dishonor promises from this peer. Current * implementation abuses WillSend for this. */ messageDetail = INFERRED_PEERSHUTDOWN; } else if (size == 0 && offset == 0) { /* NeedFile search failed - going to WAN */ messageDetail = INFERRED_WANDOWNLOAD; } else if (size > 0) { /* Size is known (not always the case) */ if (size == offset) { /* File is available for pull on this peer's TCP port */ messageDetail = INFERRED_OFFER; } else { /* WAN download progress announcement from this peer */ messageDetail = INFERRED_PROMISE; } } } else if (messageID == MESSAGE_ID_NEEDFILE) { messageDetail = INFERRED_SEARCH; } packet_detail = val_to_str_const(messageDetail, ldss_inferred_info, "unknown"); /* Set the info column */ col_add_fstr(pinfo->cinfo, COL_INFO, "LDSS Broadcast (%s%s)", packet_type, packet_detail); /* If we have a non-null tree (ie we are building the proto_tree * instead of just filling out the columns), then give more detail. */ ti = proto_tree_add_item(tree, proto_ldss, tvb, 0, (tvb_captured_length(tvb) > 72) ? tvb_captured_length(tvb) : 72, ENC_NA);//.........这里部分代码省略.........
开发者ID:crondaemon,项目名称:wireshark,代码行数:101,
示例19: dissect_pgsql_be_msgstatic void dissect_pgsql_be_msg(guchar type, guint length, tvbuff_t *tvb, gint n, proto_tree *tree){ guchar c; gint i, siz; char *s, *t; proto_item *ti; proto_tree *shrub; switch (type) { /* Authentication request */ case 'R': proto_tree_add_item(tree, hf_authtype, tvb, n, 4, ENC_BIG_ENDIAN); i = tvb_get_ntohl(tvb, n); if (i == 4 || i == 5) { /* i -= (6-i); :-) */ n += 4; siz = (i == 4 ? 2 : 4); proto_tree_add_item(tree, hf_salt, tvb, n, siz, ENC_NA); } break; /* Key data */ case 'K': proto_tree_add_item(tree, hf_pid, tvb, n, 4, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_key, tvb, n+4, 4, ENC_BIG_ENDIAN); break; /* Parameter status */ case 'S': s = tvb_get_stringz_enc(wmem_packet_scope(), tvb, n, &siz, ENC_ASCII); proto_tree_add_string(tree, hf_parameter_name, tvb, n, siz, s); n += siz; t = tvb_get_stringz_enc(wmem_packet_scope(), tvb, n, &i, ENC_ASCII); proto_tree_add_string(tree, hf_parameter_value, tvb, n, i, t); break; /* Parameter description */ case 't': i = tvb_get_ntohs(tvb, n); shrub = proto_tree_add_subtree_format(tree, tvb, n, 2, ett_values, NULL, "Parameters: %d", i); n += 2; while (i-- > 0) { proto_tree_add_item(shrub, hf_typeoid, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; } break; /* Row description */ case 'T': i = tvb_get_ntohs(tvb, n); ti = proto_tree_add_item(tree, hf_field_count, tvb, n, 2, ENC_BIG_ENDIAN); shrub = proto_item_add_subtree(ti, ett_values); n += 2; while (i-- > 0) { proto_tree *twig; siz = tvb_strsize(tvb, n); ti = proto_tree_add_item(shrub, hf_val_name, tvb, n, siz, ENC_ASCII|ENC_NA); twig = proto_item_add_subtree(ti, ett_values); n += siz; proto_tree_add_item(twig, hf_tableoid, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; proto_tree_add_item(twig, hf_val_idx, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; proto_tree_add_item(twig, hf_typeoid, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; proto_tree_add_item(twig, hf_val_length, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; proto_tree_add_item(twig, hf_val_mod, tvb, n, 4, ENC_BIG_ENDIAN); n += 4; proto_tree_add_item(twig, hf_format, tvb, n, 2, ENC_BIG_ENDIAN); n += 2; } break; /* Data row */ case 'D': i = tvb_get_ntohs(tvb, n); ti = proto_tree_add_item(tree, hf_field_count, tvb, n, 2, ENC_BIG_ENDIAN); shrub = proto_item_add_subtree(ti, ett_values); n += 2; while (i-- > 0) { siz = tvb_get_ntohl(tvb, n); proto_tree_add_int(shrub, hf_val_length, tvb, n, 4, siz); n += 4; if (siz > 0) { proto_tree_add_item(shrub, hf_val_data, tvb, n, siz, ENC_NA); n += siz; } } break; /* Command completion */ case 'C': siz = tvb_strsize(tvb, n); proto_tree_add_item(tree, hf_tag, tvb, n, siz, ENC_ASCII|ENC_NA); break; /* Ready */ case 'Z'://.........这里部分代码省略.........
开发者ID:CharaD7,项目名称:wireshark,代码行数:101,
示例20: dissect_zrtp//.........这里部分代码省略......... proto_tree_add_item(zrtp_tree, hf_zrtp_sequence, tvb, prime_offset+2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(zrtp_tree, hf_zrtp_cookie, tvb, prime_offset+4, 4, ENC_ASCII|ENC_NA); proto_tree_add_item(zrtp_tree, hf_zrtp_source_id, tvb, prime_offset+8, 4, ENC_BIG_ENDIAN); linelen = tvb_reported_length_remaining(tvb, msg_offset); checksum_offset = linelen-4; ti = proto_tree_add_protocol_format(zrtp_tree, proto_zrtp, tvb, msg_offset, linelen-4, "Message"); zrtp_msg_tree = proto_item_add_subtree(ti, ett_zrtp_msg); proto_tree_add_item(zrtp_msg_tree, hf_zrtp_signature, tvb, msg_offset+0, 2, ENC_BIG_ENDIAN); proto_tree_add_item(zrtp_msg_tree, hf_zrtp_msg_length, tvb, msg_offset+2, 2, ENC_BIG_ENDIAN); tvb_memcpy(tvb, (void *)message_type, msg_offset+4, 8); message_type[8] = '/0'; proto_tree_add_item(zrtp_msg_tree, hf_zrtp_msg_type, tvb, msg_offset+4, 8, ENC_ASCII|ENC_NA); linelen = tvb_reported_length_remaining(tvb, msg_offset+12); if (!strncmp(message_type, "Hello ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_Hello(tvb, pinfo, zrtp_msg_data_tree); } else if (!strncmp(message_type, "HelloACK", 8)) { dissect_HelloACK(pinfo); } else if (!strncmp(message_type, "Commit ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_Commit(tvb, pinfo, zrtp_msg_data_tree); } else if (!strncmp(message_type, "DHPart1 ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_DHPart(tvb, pinfo, zrtp_msg_data_tree, 1); } else if (!strncmp(message_type, "DHPart2 ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_DHPart(tvb, pinfo, zrtp_msg_data_tree, 2); } else if (!strncmp(message_type, "Confirm1", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_Confirm(tvb, pinfo, zrtp_msg_data_tree, 1); } else if (!strncmp(message_type, "Confirm2", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_Confirm(tvb, pinfo, zrtp_msg_data_tree, 2); } else if (!strncmp(message_type, "Conf2ACK", 8)) { dissect_Conf2ACK(pinfo); } else if (!strncmp(message_type, "Error ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_Error(tvb, pinfo, zrtp_msg_data_tree); } else if (!strncmp(message_type, "ErrorACK", 8)) { dissect_ErrorACK(pinfo); } else if (!strncmp(message_type, "GoClear ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_GoClear(tvb, pinfo, zrtp_msg_data_tree); } else if (!strncmp(message_type, "ClearACK", 8)) { dissect_ClearACK(pinfo); } else if (!strncmp(message_type, "SASrelay", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_SASrelay(tvb, pinfo, zrtp_msg_data_tree); } else if (!strncmp(message_type, "RelayACK", 8)) { dissect_RelayACK(pinfo); } else if (!strncmp(message_type, "Ping ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_Ping(tvb, pinfo, zrtp_msg_data_tree); } else if (!strncmp(message_type, "PingACK ", 8)) { ti = proto_tree_add_protocol_format(zrtp_msg_tree, proto_zrtp, tvb, msg_offset+12, linelen-4, "Data"); zrtp_msg_data_tree = proto_item_add_subtree(ti, ett_zrtp_msg_data); dissect_PingACK(tvb, pinfo, zrtp_msg_data_tree); } sent_crc = tvb_get_ntohl(tvb, msg_offset+checksum_offset); calc_crc = ~crc32c_tvb_offset_calculate(tvb, 0, msg_offset+checksum_offset, CRC32C_PRELOAD); if (sent_crc == calc_crc) { ti = proto_tree_add_uint_format_value(zrtp_tree, hf_zrtp_checksum, tvb, msg_offset+checksum_offset, 4, sent_crc, "0x%04x [correct]", sent_crc); checksum_tree = proto_item_add_subtree(ti, ett_zrtp_checksum); ti = proto_tree_add_boolean(checksum_tree, hf_zrtp_checksum_good, tvb, msg_offset+checksum_offset, 4, TRUE); PROTO_ITEM_SET_GENERATED(ti); ti = proto_tree_add_boolean(checksum_tree, hf_zrtp_checksum_bad, tvb, msg_offset+checksum_offset, 4, FALSE); PROTO_ITEM_SET_GENERATED(ti); } else { ti = proto_tree_add_uint_format_value(zrtp_tree, hf_zrtp_checksum, tvb, msg_offset+checksum_offset, 4, sent_crc, "0x%04x [incorrect, should be 0x%04x]", sent_crc, calc_crc); checksum_tree = proto_item_add_subtree(ti, ett_zrtp_checksum); ti = proto_tree_add_boolean(checksum_tree, hf_zrtp_checksum_good, tvb, msg_offset+checksum_offset, 4, FALSE); PROTO_ITEM_SET_GENERATED(ti); ti = proto_tree_add_boolean(checksum_tree, hf_zrtp_checksum_bad, tvb, msg_offset+checksum_offset, 4, TRUE); PROTO_ITEM_SET_GENERATED(ti); }}
开发者ID:danielwhite84,项目名称:wireshark,代码行数:101,
示例21: dissect_wtls_handshakestatic voiddissect_wtls_handshake(proto_tree *tree, tvbuff_t *tvb, guint offset, guint count){ char pdu_msg_type; nstime_t timeValue; int client_size = 0; guint value = 0; int size = 0; guint public_key = 0; char valStr[1024]; const char *valBulk = NULL; const char *valMac = NULL; proto_item *ti; proto_item *cli_key_item; proto_tree *wtls_msg_type_tree; proto_tree *wtls_msg_type_item_tree; proto_tree *wtls_msg_type_item_sub_tree; proto_tree *wtls_msg_type_item_sub_sub_tree; pdu_msg_type = tvb_get_guint8 (tvb, offset); ti = proto_tree_add_uint(tree, hf_wtls_hands, tvb, offset,count, pdu_msg_type); wtls_msg_type_tree = proto_item_add_subtree(ti, ett_wtls_msg_type); proto_tree_add_item (wtls_msg_type_tree, hf_wtls_hands_type, tvb,offset,1,ENC_BIG_ENDIAN); offset+=1; count = tvb_get_ntohs (tvb, offset); proto_tree_add_item (wtls_msg_type_tree, hf_wtls_hands_length, tvb,offset,2,ENC_BIG_ENDIAN); offset+=2; switch(pdu_msg_type) { case WTLS_HANDSHAKE_CLIENT_HELLO : ti = proto_tree_add_item(wtls_msg_type_tree, hf_wtls_hands_cli_hello, tvb, offset, count, ENC_NA); wtls_msg_type_item_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item); proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_version, tvb,offset,1,ENC_BIG_ENDIAN); offset++; timeValue.secs = tvb_get_ntohl (tvb, offset); timeValue.nsecs = 0; proto_tree_add_time (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_gmt, tvb, offset, 4, &timeValue); offset+=4; proto_tree_add_item (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_random, tvb,offset,12,ENC_NA); offset+=12; offset = add_session_id (wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_session, hf_wtls_hands_cli_hello_session_str, tvb, offset); /* process client_key_ids structure */ count = tvb_get_ntohs (tvb, offset); ti = proto_tree_add_item(wtls_msg_type_item_tree, hf_wtls_hands_cli_hello_cli_key_id, tvb, offset, count+2, ENC_NA); wtls_msg_type_item_sub_tree = proto_item_add_subtree(ti, ett_wtls_msg_type_item_sub); /* display length of client_key_ids structure */ proto_tree_add_item(wtls_msg_type_item_sub_tree, hf_wtls_hands_cli_hello_cli_key_len, tvb,offset,2,ENC_BIG_ENDIAN); offset+=2; /* cycle through client_key_ids entries */ for (;count > 0;count-=client_size) { /* get encryption suite id (one byte) */ value = tvb_get_guint8 (tvb, offset); cli_key_item = proto_tree_add_uint(wtls_msg_type_item_sub_tree, hf_wtls_hands_cli_hello_key_exchange, tvb, offset,1, value); client_size=1; wtls_msg_type_item_sub_sub_tree = proto_item_add_subtree(cli_key_item, ett_wtls_msg_type_item_sub_sub); proto_tree_add_uint(wtls_msg_type_item_sub_sub_tree, hf_wtls_hands_cli_hello_key_exchange_suite, tvb,offset,1,value); offset++;#ifdef DEBUG fprintf(stderr, "encryption suite = %d, client_size = %d/n", value, client_size);#endif /* DEBUG */ /* get parameter index (one byte) */ value = tvb_get_guint8 (tvb, offset); proto_tree_add_item(wtls_msg_type_item_sub_sub_tree, hf_wtls_hands_cli_hello_key_parameter_index, tvb,offset,1,ENC_BIG_ENDIAN); offset++; client_size++;#ifdef DEBUG fprintf(stderr, "parameter index = %d, client_size = %d/n", value, client_size);#endif /* DEBUG */ /* explicit parameters present in next field */ if (value == 0xff) { size = tvb_get_ntohs (tvb, offset); proto_tree_add_item(wtls_msg_type_item_sub_sub_tree, hf_wtls_hands_cli_hello_key_parameter_set, tvb,offset,size+2,ENC_ASCII|ENC_NA);//.........这里部分代码省略.........
开发者ID:P1sec,项目名称:LTE_monitor_c2xx,代码行数:101,
示例22: Code/* 5.1.1 Picture Start Code (PSC) (22 bits) PSC is a word of 22 bits. Its value is 0000 0000 0000 0000 1 00000. All picture start codes shall be byte aligned. ( 1000 00xx) End Of Sequence (EOS) (22 bits) A codeword of 22 bits. Its value is 0000 0000 0000 0000 1 11111. ( 1111 11xx ) Group of Block Start Code (GBSC) (17 bits) A word of 17 bits. Its value is 0000 0000 0000 0000 1. ( 1xxx xxxx ) End Of Sub-Bitstream code (EOSBS) (23 bits) The EOSBS code is a codeword of 23 bits. Its value is 0000 0000 0000 0000 1 11110 0. ( 1111 100x ) Slice Start Code (SSC) (17 bits) A word of 17 bits. Its value is 0000 0000 0000 0000 1. ( 1xxx xxxx ) */static void dissect_h263_data( tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree ){ guint offset = 0; proto_item *h263_payload_item = NULL; proto_tree *h263_payload_tree = NULL; guint32 data; guint8 startcode; int length; col_append_str( pinfo->cinfo, COL_INFO, "H263 payload "); if( tree ) { h263_payload_item = proto_tree_add_item( tree, proto_h263_data, tvb, offset, -1, ENC_NA ); h263_payload_tree = proto_item_add_subtree( h263_payload_item, ett_h263_payload ); } length = tvb_reported_length_remaining(tvb,0); if(length<4){ if( tree ) proto_tree_add_item( h263_payload_tree, hf_h263_data, tvb, offset, -1, ENC_NA ); return; } /* Check for PSC, PSC is a word of 22 bits. Its value is 0000 0000 0000 0000' 1000 00xx xxxx xxxx. */ data = tvb_get_ntohl(tvb, offset); if (( data & 0xffff8000) == 0x00008000 ) { /* Start Code found * * Startc code holds bit 17 -23 of the codeword */ startcode = tvb_get_guint8(tvb,offset+2)&0xfe; if (startcode & 0x80){ switch(startcode){ case 0xf8: /* End Of Sub-Bitstream code (EOSBS) * ( 1111 100. ) */ break; case 0x80: case 0x82: /* Picture Start Code (PSC) * ( 1000 00x.) */ col_append_str( pinfo->cinfo, COL_INFO, "(PSC) "); offset = dissect_h263_picture_layer( tvb, pinfo, h263_payload_tree, offset, -1, ENC_NA); break; case 0xfc: case 0xfe: /* End Of Sequence (EOS) * ( 1111 11x. ) */ default: /* Group of Block Start Code (GBSC) or * Slice Start Code (SSC) */ col_append_str( pinfo->cinfo, COL_INFO, "(GBSC) "); offset = dissect_h263_group_of_blocks_layer( tvb, h263_payload_tree, offset,FALSE); break; } }else{ /* Error */ } } if( tree ) proto_tree_add_item( h263_payload_tree, hf_h263_data, tvb, offset, -1, ENC_NA );}
开发者ID:kailiu-bupt2005,项目名称:wireshark,代码行数:88,
示例23: dissect_redbackstatic voiddissect_redback(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ guint16 l3off, dataoff, proto; proto_item *ti, *protocol_item; proto_tree *rbtree = NULL; tvbuff_t *next_tvb; col_set_str(pinfo->cinfo,COL_PROTOCOL,"RBN"); dataoff = tvb_get_ntohs(tvb, 20); l3off = tvb_get_ntohs(tvb, 22); ti = proto_tree_add_item(tree, hfi_redback, tvb, 0, -1, ENC_NA); rbtree = proto_item_add_subtree(ti, ett_redback); proto_tree_add_item(rbtree, &hfi_redback_context, tvb, 0, 4, ENC_BIG_ENDIAN); proto_tree_add_item(rbtree, &hfi_redback_flags, tvb, 4, 4, ENC_BIG_ENDIAN); proto_tree_add_item(rbtree, &hfi_redback_circuit, tvb, 8, 8, ENC_BIG_ENDIAN); proto_tree_add_item(rbtree, &hfi_redback_length, tvb, 16, 2, ENC_BIG_ENDIAN); protocol_item = proto_tree_add_item(rbtree, &hfi_redback_protocol, tvb, 18, 2, ENC_BIG_ENDIAN); proto_tree_add_item(rbtree, &hfi_redback_dataoffset, tvb, 20, 2, ENC_BIG_ENDIAN); proto_tree_add_item(rbtree, &hfi_redback_l3offset, tvb, 22, 2, ENC_BIG_ENDIAN); if (dataoff > 24) { proto_tree_add_item(rbtree, &hfi_redback_padding, tvb, 24, dataoff-24, ENC_NA); } proto = tvb_get_ntohs(tvb, 18); switch(proto) { case 0x01: /* * IP on Ethernet - Incoming data points to an ethernet header * outgoing we have a pure IPv4 Packet */ next_tvb = tvb_new_subset_remaining(tvb, dataoff); if (dataoff == l3off) call_dissector(ipv4_handle, next_tvb, pinfo, tree); else if (dataoff+2 == l3off) call_dissector(ppp_handle, next_tvb, pinfo, tree); else if (dataoff+4 == l3off) call_dissector(ppphdlc_handle, next_tvb, pinfo, tree); else call_dissector(ethnofcs_handle, next_tvb, pinfo, tree); break; case 0x02: /* * This is ISIS - Either incoming with ethernet FCS * and CLNP - passed to the eth dissector or in case * of outgoing it's pure ISIS and the linecard attaches * the ethernet and CLNP headers ... * */ next_tvb = tvb_new_subset_remaining(tvb, dataoff); if (l3off > dataoff) { call_dissector(ethnofcs_handle, next_tvb, pinfo, tree); } else { guint8 nlpid = tvb_get_guint8(tvb, dataoff); if(dissector_try_uint(osinl_incl_subdissector_table, nlpid, next_tvb, pinfo, tree)) break; next_tvb = tvb_new_subset_remaining(tvb, dataoff+1); if(dissector_try_uint(osinl_excl_subdissector_table, nlpid, next_tvb, pinfo, tree)) break; next_tvb = tvb_new_subset_remaining(tvb, dataoff); call_dissector(data_handle, next_tvb, pinfo, tree); } break; case 0x06: { /* * PPP Messages e.g. LCP, IPCP etc - possibly on ethernet in case of PPPoE. * PPPoE messages are Protocol 8 ... */ guint32 flags; flags = tvb_get_ntohl(tvb, 4); if (flags & 0x04000000) { next_tvb = tvb_new_subset_remaining(tvb, dataoff); } else { if (tree) proto_tree_add_item(rbtree, &hfi_redback_unknown, tvb, dataoff, 4, ENC_NA); next_tvb = tvb_new_subset_remaining(tvb, dataoff+4); } if (l3off == dataoff) { call_dissector(ppp_handle, next_tvb, pinfo, tree); } else { call_dissector(ethnofcs_handle, next_tvb, pinfo, tree); } break; } case 0x03: /* Unicast Ethernet tx - Seen with PPPoE PADO */ case 0x04: /* Unicast Ethernet rx - Seen with ARP */ case 0x08: /* Broadcast Ethernet rx - Seen with PPPoE PADI */ next_tvb = tvb_new_subset_remaining(tvb, dataoff); call_dissector(ethnofcs_handle, next_tvb, pinfo, tree); break; case 0x09: /* IPv6 either encapsulated as ethernet or native ip */ next_tvb = tvb_new_subset_remaining(tvb, dataoff); if (dataoff == l3off) call_dissector(ipv6_handle, next_tvb, pinfo, tree);//.........这里部分代码省略.........
开发者ID:MultipathDTLS,项目名称:wireshark,代码行数:101,
示例24: dissect_wsmpstatic voiddissect_wsmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree){ /* Set up structures needed to add the protocol subtree and manage it */ proto_item *ti, *wsmdata_item; proto_tree *wsmp_tree, *wsmdata_tree; tvbuff_t *wsmdata_tvb; guint16 wsmlength, offset; guint32 psidLen, psid; guint8 elemenId, elemenLen, msb, supLen; /* Make entries in Protocol column and Info column on summary display */ col_set_str(pinfo->cinfo, COL_PROTOCOL, "WSMP"); col_set_str(pinfo->cinfo, COL_INFO, "WAVE Short Message Protocol IEEE P1609.3"); /* create display subtree for the protocol */ ti = proto_tree_add_item(tree, proto_wsmp, tvb, 0, -1, ENC_NA); wsmp_tree = proto_item_add_subtree(ti, ett_wsmp); offset = 0; proto_tree_add_item(wsmp_tree, hf_wsmp_version, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; psid = tvb_get_guint8(tvb, offset); psidLen = (guint32)wme_getpsidlen((guint8*)&psid); if (psidLen == 2) psid = tvb_get_ntohs(tvb, offset); else if (psidLen == 3) { psid = tvb_get_ntohl(tvb, offset); psid = psid & 0x00FFFF; /* three bytes */ } else if (psidLen == 4) psid = tvb_get_ntohl(tvb, offset); proto_tree_add_item(wsmp_tree, hf_wsmp_psid, tvb, offset, psidLen, ENC_BIG_ENDIAN); offset += psidLen; elemenId = tvb_get_guint8(tvb, offset); while ((elemenId != WSMP) && (elemenId != WSMP_S) && (elemenId != WSMP_I)) { offset++; if (elemenId == CHANNUM) { /* channel number */ elemenLen = tvb_get_guint8(tvb, offset); offset++; proto_tree_add_item(wsmp_tree, hf_wsmp_channel, tvb, offset, elemenLen, ENC_BIG_ENDIAN); offset += elemenLen; } else if (elemenId == DATARATE) { /* Data rate */ elemenLen = tvb_get_guint8(tvb, offset); offset++; proto_tree_add_item(wsmp_tree, hf_wsmp_rate, tvb, offset, elemenLen, ENC_BIG_ENDIAN); offset += elemenLen; } else if (elemenId == TRANSMITPW) { /* Transmit power */ elemenLen = tvb_get_guint8(tvb, offset); offset++; proto_tree_add_item(wsmp_tree, hf_wsmp_txpower, tvb, offset, elemenLen, ENC_BIG_ENDIAN); offset += elemenLen; } elemenId = tvb_get_guint8(tvb, offset); } proto_tree_add_item(wsmp_tree, hf_wsmp_WAVEid, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; wsmlength = tvb_get_letohs( tvb, offset); proto_tree_add_item(wsmp_tree, hf_wsmp_wsmlength, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; if (elemenId == WSMP_S) { msb = 1; supLen = 0; while (msb) { msb = tvb_get_guint8(tvb, offset + supLen); msb = msb & 0x80; supLen++; } proto_tree_add_item(wsmp_tree,//.........这里部分代码省略.........
开发者ID:lubing521,项目名称:wireshark,代码行数:101,
示例25: dissect_kdpstatic void dissect_kdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint body_len; guint8 version = 0; guint8 header_len = 0; guint8 packet_flags = 0; guint8 packet_errors = 0; guint32 sequence_number = G_MAXUINT32; guint32 ack_number = G_MAXUINT32; guint32 src_flowid = G_MAXUINT32; int offset; col_set_str(pinfo->cinfo, COL_PROTOCOL, "KDP"); col_clear(pinfo->cinfo, COL_INFO); if (tree) { proto_item *ti; proto_tree *kdp_tree, *flags_tree; ti = NULL; kdp_tree = NULL; flags_tree = NULL; ti = proto_tree_add_item(tree, proto_kdp, tvb, 0, -1, ENC_NA); kdp_tree = proto_item_add_subtree(ti, ett_kdp); version = tvb_get_guint8(tvb, 0); if (version != 2) { /* Version other than 2 is really SDDP in UDP */ proto_tree_add_item(kdp_tree, hf_kdp_version, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(kdp_tree, hf_kdp_xml_body, tvb, 0, -1, ENC_ASCII|ENC_NA); } else { header_len = tvb_get_guint8(tvb, 1) * 4; body_len = tvb_reported_length(tvb); if (header_len > body_len) { body_len = 0; /* malformed packet */ } else { body_len = body_len - header_len; } packet_flags = tvb_get_guint8(tvb, 2); packet_errors = tvb_get_guint8(tvb, 3); proto_tree_add_item(kdp_tree, hf_kdp_version, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(kdp_tree, hf_kdp_headerlen, tvb, 1, 1, ENC_BIG_ENDIAN); ti = proto_tree_add_item(kdp_tree, hf_kdp_flags, tvb, 2, 1, ENC_BIG_ENDIAN); flags_tree = proto_item_add_subtree(ti, ett_kdp_flags); proto_tree_add_item(flags_tree, hf_kdp_drop_flag, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flags_tree, hf_kdp_syn_flag, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flags_tree, hf_kdp_ack_flag, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flags_tree, hf_kdp_rst_flag, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flags_tree, hf_kdp_bcst_flag, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flags_tree, hf_kdp_dup_flag, tvb, 2, 1, ENC_BIG_ENDIAN); proto_tree_add_item(kdp_tree, hf_kdp_errors, tvb, 3, 1, ENC_BIG_ENDIAN); if (header_len > 4) { offset = 4; if (packet_flags & KDP_ACK_FLAG) { proto_tree_add_item(kdp_tree, hf_kdp_destflowid, tvb, offset, 4, ENC_BIG_ENDIAN); offset = offset + 4; } if (packet_flags & (KDP_SYN_FLAG | KDP_BCST_FLAG)) { proto_tree_add_item(kdp_tree, hf_kdp_srcflowid, tvb, offset, 4, ENC_BIG_ENDIAN); src_flowid = tvb_get_ntohl(tvb, offset); offset = offset + 4; } proto_tree_add_item(kdp_tree, hf_kdp_sequence, tvb, offset, 4, ENC_BIG_ENDIAN); sequence_number = tvb_get_ntohl(tvb, offset); offset = offset + 4; if (packet_flags & KDP_ACK_FLAG) { proto_tree_add_item(kdp_tree, hf_kdp_ack, tvb, offset, 4, ENC_BIG_ENDIAN); ack_number = tvb_get_ntohl(tvb, offset); offset = offset + 4; } if (packet_flags & KDP_SYN_FLAG) { proto_tree_add_item(kdp_tree, hf_kdp_maxsegmentsize, tvb, offset, 4, ENC_BIG_ENDIAN); offset = offset + 4; } while (offset < ((body_len > 0) ? header_len - 4 : header_len)) { guint8 option_number; guint8 option_len = 0; option_number = tvb_get_guint8(tvb, offset); proto_tree_add_item(kdp_tree, hf_kdp_optionnumber, tvb, offset, 1, ENC_BIG_ENDIAN); offset = offset + 1; if (option_number > 0) { option_len = tvb_get_guint8(tvb, offset); proto_tree_add_item(kdp_tree, hf_kdp_optionlen, tvb, offset, 1, ENC_BIG_ENDIAN); offset = offset + 1; } switch (option_number) { case 0: break; case 1: proto_tree_add_item(kdp_tree, hf_kdp_option1, tvb, offset, 2, ENC_BIG_ENDIAN);//.........这里部分代码省略.........
开发者ID:hashbrowncipher,项目名称:wireshark,代码行数:101,
示例26: col_set_str proto_tree *tree=NULL; proto_item *item=NULL; conversation_t *conversation; nbd_conv_info_t *nbd_info; nbd_transaction_t *nbd_trans=NULL; wmem_tree_key_t hkey[3]; col_set_str(pinfo->cinfo, COL_PROTOCOL, "NBD"); col_clear(pinfo->cinfo, COL_INFO); item = proto_tree_add_item(parent_tree, proto_nbd, tvb, 0, -1, ENC_NA); tree = proto_item_add_subtree(item, ett_nbd); magic=tvb_get_ntohl(tvb, offset); proto_tree_add_item(tree, hf_nbd_magic, tvb, offset, 4, ENC_BIG_ENDIAN); offset+=4; /* grab what we need to do the request/response matching */ switch(magic){ case NBD_REQUEST_MAGIC: case NBD_RESPONSE_MAGIC: handle[0]=tvb_get_ntohl(tvb, offset+4); handle[1]=tvb_get_ntohl(tvb, offset+8); break; default: return 4; }
开发者ID:danielwhite84,项目名称:wireshark,代码行数:30,
注:本文中的tvb_get_ntohl函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ tvb_get_ptr函数代码示例 C++ tvb_get_letohs函数代码示例 |