static void dissect_path_data_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset) { proto_item *ti, *flag_item; guint length_TLV, IDcount, i; guint16 type, flag; proto_tree *tlv_tree, *path_data_tree, *flag_tree; while (tvb_reported_length_remaining(tvb, offset) >= TLV_TL_LENGTH) { tlv_tree = proto_tree_add_subtree(tree, tvb, offset, TLV_TL_LENGTH, ett_forces_path_data_tlv, &ti, "TLV"); type = tvb_get_ntohs(tvb, offset); proto_tree_add_item(tlv_tree, hf_forces_lfbselect_tlv_type_operation_path_type, tvb, offset, 2, ENC_BIG_ENDIAN); length_TLV = tvb_get_ntohs(tvb, offset+2); proto_tree_add_item(tlv_tree, hf_forces_lfbselect_tlv_type_operation_path_length, tvb, offset+2, 2, ENC_BIG_ENDIAN); if (length_TLV < TLV_TL_LENGTH) { expert_add_info_format(pinfo, ti, &ei_forces_lfbselect_tlv_type_operation_path_length, "Bogus TLV length: %u", length_TLV); break; } proto_item_set_len(ti, length_TLV); if (type == PATH_DATA_TLV) { path_data_tree = proto_tree_add_subtree(tree, tvb, offset+TLV_TL_LENGTH, length_TLV-TLV_TL_LENGTH, ett_forces_path_data_tlv, NULL, "Path Data TLV"); flag = tvb_get_ntohs(tvb, offset+TLV_TL_LENGTH); flag_item = proto_tree_add_item(path_data_tree, hf_forces_lfbselect_tlv_type_operation_path_flags, tvb, offset+TLV_TL_LENGTH, 2, ENC_BIG_ENDIAN); flag_tree = proto_item_add_subtree(flag_item, ett_forces_path_data_tlv_flags); proto_tree_add_item(flag_tree, hf_forces_lfbselect_tlv_type_operation_path_flags_selector, tvb, offset+TLV_TL_LENGTH, 2, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_forces_lfbselect_tlv_type_operation_path_flags_reserved, tvb, offset+TLV_TL_LENGTH, 2, ENC_BIG_ENDIAN); IDcount = tvb_get_ntohs(tvb, offset + TLV_TL_LENGTH + 2); proto_tree_add_item(path_data_tree, hf_forces_lfbselect_tlv_type_operation_path_IDcount, tvb, offset+TLV_TL_LENGTH+2, 2, ENC_BIG_ENDIAN); for (i = 0; i < IDcount; i++) proto_tree_add_item(path_data_tree, hf_forces_lfbselect_tlv_type_operation_path_IDs, tvb, offset+TLV_TL_LENGTH+2+(i*4), 4, ENC_BIG_ENDIAN); } else { flag = 0; proto_tree_add_item(tree, hf_forces_lfbselect_tlv_type_operation_path_data, tvb, offset+TLV_TL_LENGTH, length_TLV-TLV_TL_LENGTH, ENC_NA); } if ((flag & FLAG_SELECTOR) == 0) break; offset += length_TLV; } }
static void dissect_aodv_rerr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *aodv_tree, gboolean is_ipv6) { int offset = 1; proto_item *tj; proto_tree *aodv_flags_tree; proto_tree *aodv_unreach_dest_tree; guint8 flags; guint8 dest_count; int i; flags = tvb_get_guint8(tvb, offset); if (aodv_tree) { aodv_flags_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, 1, ett_aodv_flags, &tj, "Flags:"); proto_tree_add_boolean(aodv_flags_tree, hf_aodv_flags_rerr_nodelete, tvb, offset, 1, flags); if (flags & RERR_NODEL) proto_item_append_text(tj, " N"); } offset += 2; /* skip reserved byte */ dest_count = tvb_get_guint8(tvb, offset); if (aodv_tree) proto_tree_add_uint(aodv_tree, hf_aodv_destcount, tvb, offset, 1, dest_count); col_append_fstr(pinfo->cinfo, COL_INFO, ", Dest Count=%u", dest_count); offset += 1; if (is_ipv6) { aodv_unreach_dest_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, (INET6_ADDRLEN + 4)*dest_count, ett_aodv_unreach_dest, NULL, "Unreachable Destinations"); for (i = 0; i < dest_count; i++) { proto_tree_add_item(aodv_unreach_dest_tree, hf_aodv_unreach_dest_ipv6, tvb, offset, INET6_ADDRLEN, ENC_NA); offset += INET6_ADDRLEN; proto_tree_add_item(aodv_unreach_dest_tree, hf_aodv_dest_seqno, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } } else { aodv_unreach_dest_tree = proto_tree_add_subtree(aodv_tree, tvb, offset, (4 + 4)*dest_count, ett_aodv_unreach_dest, NULL, "Unreachable Destinations"); for (i = 0; i < dest_count; i++) { proto_tree_add_item(aodv_unreach_dest_tree, hf_aodv_unreach_dest_ip, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(aodv_unreach_dest_tree, hf_aodv_dest_seqno, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; } } }
static void dissect_dsmcc_adaptation_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { tvbuff_t *sub_tvb; guint offset = 0; proto_item *pi; proto_tree *sub_tree; guint8 type, tmp; guint16 ca_len; type = tvb_get_guint8(tvb, offset); if (1 == type) { sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_dsmcc_adaptation_header, NULL, "Adaptation Header"); proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset +=1; tmp = tvb_get_guint8(tvb, offset); pi = proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_ca_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (0xff != tmp) { expert_add_info_format(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } offset +=1; proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_ca_system_id, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; ca_len = tvb_get_ntohs(tvb, offset); proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_ca_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; sub_tvb = tvb_new_subset_length(tvb, offset, ca_len); call_dissector(data_handle, sub_tvb, pinfo, tree); } else if (2 == type) { sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_dsmcc_adaptation_header, NULL, "Adaptation Header"); proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_type, tvb, offset, 1, ENC_BIG_ENDIAN); offset +=1; tmp = tvb_get_guint8(tvb, offset); pi = proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_user_id_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); if (0xff != tmp) { expert_add_info_format(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } /*offset +=1;*/ /* TODO: handle the userId */ } else { sub_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_dsmcc_adaptation_header, NULL, "Unknown Adaptation Header"); proto_tree_add_item(sub_tree, hf_dsmcc_adaptation_type, tvb, offset, 1, ENC_BIG_ENDIAN); } }
/** *ZigBee Device Profile dissector for the end device bind * *@param tvb pointer to buffer containing raw packet. *@param pinfo pointer to packet information fields *@param tree pointer to data tree Wireshark uses to display packet. */ void dissect_zbee_zdp_req_end_device_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version) { guint sizeof_cluster = (version >= ZBEE_VERSION_2007)?(int)sizeof(guint16):(int)sizeof(guint8); guint i; proto_tree *field_tree = NULL; guint offset = 0; guint32 target, in_count, out_count; guint64 ext_addr = 0; proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_target, tvb, offset, 2, ENC_LITTLE_ENDIAN, &target); offset += 2; if (version >= ZBEE_VERSION_2007) { /* Extended address present on ZigBee 2006 & later. */ ext_addr = zbee_parse_eui64(tree, hf_zbee_zdp_ext_addr, tvb, &offset, (guint)sizeof(guint64), NULL); } proto_tree_add_item(tree, hf_zbee_zdp_endpoint, tvb, offset, 1, ENC_LITTLE_ENDIAN); offset += 1; proto_tree_add_item(tree, hf_zbee_zdp_profile, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_in_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &in_count); offset += 1; if ((tree) && (in_count)) { field_tree = proto_tree_add_subtree(tree, tvb, offset, (int)(in_count*sizeof_cluster), ett_zbee_zdp_bind_end_in, NULL, "Input Cluster List"); } for (i=0; i<in_count; i++) { proto_tree_add_item(field_tree, hf_zbee_zdp_in_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN); offset += sizeof_cluster; } proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_out_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &out_count); offset += 1; if ((tree) && (out_count)) { field_tree = proto_tree_add_subtree(tree, tvb, offset, (int)(out_count*sizeof_cluster), ett_zbee_zdp_bind_end_out, NULL, "Output Cluster List"); } for (i=0; i<out_count; i++) { proto_tree_add_item(field_tree, hf_zbee_zdp_out_cluster, tvb, offset, sizeof_cluster, ENC_LITTLE_ENDIAN); offset += sizeof_cluster; } if (version >= ZBEE_VERSION_2007) { zbee_append_info(tree, pinfo, " Src: %s", eui64_to_display(wmem_packet_scope(), ext_addr)); } zbee_append_info(tree, pinfo, ", Target: 0x%04x", target); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); } /* dissect_zbee_zdp_req_end_device_bind */
/* code to dissect NORM cmd(cc) packets */ static guint dissect_norm_cmd_cc(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, guint offset, guint8 hlen) { proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; proto_tree_add_item(tree, hf_cc_sequence, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_cc_sts, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; proto_tree_add_item(tree, hf_cc_stus, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; if (offset < hdrlen2bytes(hlen)) { offset = dissect_norm_hdrext(tree, pinfo, tvb, offset, hlen); } while (offset < hdrlen2bytes(hlen)) { proto_item *tif; proto_tree *cc_tree, *flag_tree; double grtt; cc_tree = proto_tree_add_subtree(tree, tvb, offset, 8, ett_congestioncontrol, NULL, "Congestion Control"); proto_tree_add_item(cc_tree, hf_cc_node_id, tvb, offset, 4, ENC_BIG_ENDIAN); offset += 4; tif = proto_tree_add_item(cc_tree, hf_cc_flags, tvb, offset, 1, ENC_BIG_ENDIAN); flag_tree = proto_item_add_subtree(tif, ett_flags); proto_tree_add_item(flag_tree, hf_cc_flags_clr, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_cc_flags_plr, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_cc_flags_rtt, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_cc_flags_start, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_cc_flags_leave, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; grtt = UnquantizeRtt(tvb_get_guint8(tvb, offset)); proto_tree_add_double(cc_tree, hf_cc_rtt, tvb, offset, 1, grtt); offset += 1; grtt = rmt_decode_send_rate(tvb_get_ntohs(tvb, offset)); proto_tree_add_double(cc_tree, hf_cc_rate, tvb, offset, 2, grtt); offset += 2; } return offset; }
static guint dissect_nack_data(proto_tree *tree, tvbuff_t *tvb, guint offset, packet_info *pinfo) { proto_item *ti, *tif; proto_tree *nack_tree, *flag_tree; guint16 len; nack_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_nackdata, &ti, "NACK Data"); proto_tree_add_item(nack_tree, hf_nack_form, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; tif = proto_tree_add_item(nack_tree, hf_nack_flags, tvb, offset, 1, ENC_BIG_ENDIAN); flag_tree = proto_item_add_subtree(tif, ett_flags); proto_tree_add_item(flag_tree, hf_nack_flags_segment, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_nack_flags_block, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_nack_flags_info, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(flag_tree, hf_nack_flags_object, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; len = tvb_get_ntohs(tvb, offset); proto_tree_add_item(nack_tree, hf_nack_length, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_item_set_len(ti, 4+len); if (len > 4) { dissect_feccode(nack_tree, tvb, offset, pinfo, 1); } offset += len; return offset; }
static guint dissect_data_payload(tvbuff_t *tvb, proto_item *tree, guint offset, guint len) { guint end = offset + len; guint blklen = 0; guint xdmx, stc; while(offset < end) { proto_item *ti; proto_tree *data_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_pp_data, &ti, "xDMX Data: "); proto_tree_add_item(data_tree, hf_pp_data_encoding, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; blklen = tvb_get_ntohs(tvb, offset); proto_tree_add_item(data_tree, hf_pp_data_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(data_tree, hf_pp_reserved, tvb, offset++, 1, ENC_NA); stc = tvb_get_guint8(tvb, offset); proto_tree_add_item(data_tree, hf_pp_data_start_code, tvb, offset++, 1, ENC_BIG_ENDIAN); xdmx = tvb_get_ntohs(tvb, offset); proto_tree_add_item(data_tree, hf_pp_data_dst, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(data_tree, hf_pp_data_levels, tvb, offset, blklen, ENC_NA); proto_item_append_text(ti, "%d Channels at xDMX %d (Univ %d.%d) StartCode: %d ", blklen, xdmx, xdmx / 512 + 1, xdmx % 512, stc); offset += roof4(blklen); } return len; }
static int dissect_report_ack_segment(proto_tree *ltp_tree, tvbuff_t *tvb,int frame_offset){ gint64 rpt_sno; int rpt_sno_size; int segment_offset = 0; proto_tree *ltp_rpt_ack_tree; /* Extracing receipt serial number info */ rpt_sno = evaluate_sdnv_64(tvb,frame_offset, &rpt_sno_size); /* XXX - verify that this does not overflow */ segment_offset += rpt_sno_size; if((unsigned)(frame_offset + segment_offset) > tvb_captured_length(tvb)){ return 0; } /* Creating tree for the report ack segment */ ltp_rpt_ack_tree = proto_tree_add_subtree(ltp_tree, tvb,frame_offset, segment_offset, ett_rpt_ack_segm, NULL, "Report Ack Segment"); proto_tree_add_uint64(ltp_rpt_ack_tree, hf_ltp_rpt_ack_sno, tvb, frame_offset,rpt_sno_size, (guint64)rpt_sno); return segment_offset; }
static void dissect_getnamebyaddr_request(tvbuff_t* tvb, proto_tree* lwres_tree) { guint32 flags,family; guint16 addrlen, slen; const char* addrs; proto_tree* nba_request_tree; flags = tvb_get_ntohl(tvb, LWRES_LWPACKET_LENGTH); family = tvb_get_ntohl(tvb, LWRES_LWPACKET_LENGTH + 4); addrlen = tvb_get_ntohs(tvb, LWRES_LWPACKET_LENGTH + 8); addrs = tvb_ip_to_str(tvb, LWRES_LWPACKET_LENGTH + 10); slen = (int)strlen(addrs); if (lwres_tree == NULL) return; nba_request_tree = proto_tree_add_subtree(lwres_tree,tvb,LWRES_LWPACKET_LENGTH,LWRES_LWPACKET_LENGTH+14, ett_nba_request,NULL,"getnamebyaddr parameters"); proto_tree_add_uint(nba_request_tree, hf_adn_flags, tvb, LWRES_LWPACKET_LENGTH, 4, flags); proto_tree_add_uint(nba_request_tree, hf_adn_family, tvb, LWRES_LWPACKET_LENGTH + 4, 4, family); proto_tree_add_uint(nba_request_tree, hf_adn_addr_len, tvb, LWRES_LWPACKET_LENGTH + 8, 2, addrlen); proto_tree_add_string(nba_request_tree, hf_adn_addr_addr, tvb, LWRES_LWPACKET_LENGTH + 10, slen, addrs); }
static int dissect_unregister_pdu(tvbuff_t *tvb, proto_tree *tree, int offset, int len, guint8 flags) { proto_tree* subtree; guint encoding = (flags & NETWORK_BYTE_ORDER) ? ENC_BIG_ENDIAN : ENC_LITTLE_ENDIAN; subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_unregister, NULL, "Unregister-PDU"); if(flags & NON_DEFAULT_CONTEXT) { /* show context */ offset += dissect_octet_string(tvb, subtree, offset, flags); } proto_tree_add_item(subtree, hf_unreg_timeout, tvb, offset, 1, encoding); proto_tree_add_item(subtree, hf_unreg_prio, tvb, offset+1, 1, encoding); proto_tree_add_item(subtree, hf_unreg_rsid, tvb, offset+2, 1, encoding); offset+=4; /* Region */ offset += dissect_object_id(tvb, subtree, offset, flags, OID_EXACT); len += PDU_HDR_LEN; if(len > offset) { /* Upper bound (opt) */ proto_tree_add_item(subtree, hf_unreg_ubound, tvb, offset, 4, encoding); offset += 4; } return offset; }
static guint dissect_etv_bif_platform_ids(tvbuff_t *tvb, proto_tree *tree, guint offset) { proto_tree *platform_tree; platform_tree = proto_tree_add_subtree(tree, tvb, offset, 15, ett_eiss_platform_id, NULL, "Platform Id"); proto_tree_add_item(platform_tree, hf_pdtHWManufacturer, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3; proto_tree_add_item(platform_tree, hf_pdtHWModel, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(platform_tree, hf_pdtHWVersionMajor, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(platform_tree, hf_pdtHWVersionMinor, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(platform_tree, hf_pdtSWManufacturer, tvb, offset, 3, ENC_BIG_ENDIAN); offset += 3; proto_tree_add_item(platform_tree, hf_pdtSWModel, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(platform_tree, hf_pdtSWVersionMajor, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(platform_tree, hf_pdtSWVersionMinor, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; proto_tree_add_item(platform_tree, hf_pdtProfile, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; return 15; }
static void dissect_abort_request(tvbuff_t *tvb, proto_tree *fcgi_tree, gint offset, guint16 len) { proto_tree_add_subtree(fcgi_tree, tvb, offset, len, ett_fcgi_abort_request, NULL, "Abort Request:"); return; }
static void xmpp_gtalk_transport_p2p_cand(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_tree *cand_tree; xmpp_attr_info attrs_info[] = { {"xmlns", &hf_xmpp_xmlns, FALSE, FALSE, NULL, NULL}, {"name", NULL, FALSE, TRUE, NULL, NULL}, {"generation", NULL, FALSE, FALSE, NULL, NULL}, {"network", NULL, FALSE, FALSE, NULL, NULL}, {"component", NULL, FALSE, FALSE, NULL, NULL}, {"type", NULL, FALSE, FALSE, NULL, NULL}, {"protocol", NULL, FALSE, TRUE, NULL, NULL}, {"preference", NULL, FALSE, FALSE, NULL, NULL}, {"password", NULL, FALSE, FALSE, NULL, NULL}, {"username", NULL, FALSE, FALSE, NULL, NULL}, {"port", NULL, FALSE, TRUE, NULL, NULL}, {"address", NULL, FALSE, TRUE, NULL, NULL} }; cand_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_transport_p2p_cand, NULL, "CANDIDATE"); xmpp_display_attrs(cand_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(cand_tree, element, pinfo, tvb, NULL, 0); }
static void xmpp_gtalk_jingleinfo_relay(proto_tree* tree, tvbuff_t* tvb, packet_info* pinfo, xmpp_element_t* element) { proto_tree *relay_tree; xmpp_attr_info attrs_info[] = { {"token", NULL, FALSE, FALSE, NULL, NULL} }; xmpp_elem_info elems_info [] = { {NAME, "server", xmpp_gtalk_jingleinfo_relay_serv, ONE} }; xmpp_element_t *token; relay_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_gtalk_jingleinfo_relay, NULL, "RELAY"); if((token = xmpp_steal_element_by_name(element, "token"))!=NULL) { xmpp_attr_t *fake_token = xmpp_ep_init_attr_t(token->data?token->data->value:"", token->offset, token->length); g_hash_table_insert(element->attrs, (gpointer)"token", fake_token); } xmpp_display_attrs(relay_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(relay_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); }
static int dissect_error_status_t (tvbuff_t * tvb, int offset, packet_info * pinfo, proto_tree * parent_tree, dcerpc_info *di, guint8 * drep) { proto_item *item; proto_tree *tree; int old_offset = offset; guint32 st; const char *st_str; if (di->conformant_run) { return offset; } tree = proto_tree_add_subtree(parent_tree, tvb, offset, -1, ett_error_status_t, &item, "error_status_t"); offset = dissect_ndr_uint32 (tvb, offset, pinfo, tree, di, drep, hf_error_status_t, &st); st_str = val_to_str_ext (st, &dce_error_vals_ext, "%u"); col_append_fstr (pinfo->cinfo, COL_INFO, " st:%s ", st_str); proto_item_set_len (item, offset - old_offset); return offset; }
/** *ZigBee Device Profile dissector for the recover source binding * *@param tvb pointer to buffer containing raw packet. *@param pinfo pointer to packet information fields *@param tree pointer to data tree Wireshark uses to display packet. */ void dissect_zbee_zdp_rsp_recover_source_bind(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *field_tree = NULL; guint offset = 0; guint i; guint8 status; /*guint16 table_size;*/ /*guint16 idx;*/ guint16 table_count; status = zdp_parse_status(tree, tvb, &offset); /*table_size = */ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); /*idx = */ zbee_parse_uint(tree, hf_zbee_zdp_index, tvb, &offset, (int)sizeof(guint16), NULL); table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree && table_count) { field_tree = proto_tree_add_subtree(tree, tvb, offset, table_count * (int)sizeof(guint64), ett_zbee_zdp_bind_source, NULL, "Source Table"); } for (i=0; i<table_count; i++) { (void)zbee_parse_eui64(field_tree, hf_zbee_zdp_bind_src64, tvb, &offset, (int)sizeof(guint64), NULL); } /* for */ zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); } /* dissect_zbee_zdp_rsp_recover_source_bind */
static void xmpp_unknown_items(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element, guint level) { GList *childs = element->elements; DISSECTOR_ASSERT( level < ETT_UNKNOWN_LEN ); xmpp_unknown_attrs(tree, tvb, pinfo, element, TRUE); if(element->data) { proto_tree_add_text(tree, tvb, element->data->offset, element->data->length, "CDATA: %s",element->data->value); } while(childs) { xmpp_element_t *child = (xmpp_element_t *)childs->data; proto_item *child_item; proto_tree *child_tree = proto_tree_add_subtree(tree, tvb, child->offset, child->length, ett_unknown[level], &child_item, xmpp_ep_string_upcase(child->name)); if(child->default_ns_abbrev) proto_item_append_text(child_item, "(%s)", child->default_ns_abbrev); xmpp_unknown_items(child_tree, tvb, pinfo, child, level +1); childs = childs->next; } }
static void dissect_cell_id_list_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, guint len, proto_tree *tree, proto_item *parent_ti) { guint base_offs = offset; guint32 discr; guint count = 0; /* list-global discriminator */ proto_tree_add_item_ret_uint(tree, hf_cbsp_cell_id_disc, tvb, offset, 1, ENC_NA, &discr); discr &= 0x0f; offset++; /* iterate over list items */ while (offset - base_offs < len) { proto_tree *elem_tree; proto_item *ti; int rc; guint remain_len = len - (offset - base_offs); elem_tree = proto_tree_add_subtree(tree, tvb, offset, cell_id_len(discr), ett_cbsp_cell_list, &ti, "Cell List Item"); rc = dissect_cell_id_elem(discr, tvb, pinfo, offset, remain_len, elem_tree, ti); if (rc <= 0) break; offset += rc; count++; } proto_item_append_text(parent_ti, " (%s): %u items", val_to_str_const(discr, cbsp_cell_id_disc_vals, ""), count); }
static gint dissect_dsi_attention(tvbuff_t *tvb, proto_tree *dsi_tree, gint offset) { proto_tree *tree; proto_item *ti; guint16 flag; if (!tvb_reported_length_remaining(tvb,offset)) return offset; flag = tvb_get_ntohs(tvb, offset); tree = proto_tree_add_subtree(dsi_tree, tvb, offset, -1, ett_dsi_attn, NULL, "Attention"); ti = proto_tree_add_item(tree, hf_dsi_attn_flag, tvb, offset, 2, ENC_BIG_ENDIAN); tree = proto_item_add_subtree(ti, ett_dsi_attn_flag); proto_tree_add_item(tree, hf_dsi_attn_flag_shutdown, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_dsi_attn_flag_crash, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_dsi_attn_flag_msg, tvb, offset, 2, ENC_BIG_ENDIAN); proto_tree_add_item(tree, hf_dsi_attn_flag_reconnect, tvb, offset, 2, ENC_BIG_ENDIAN); /* FIXME */ if ((flag & 0xf000) != 0x3000) proto_tree_add_item(tree, hf_dsi_attn_flag_time, tvb, offset, 2, ENC_BIG_ENDIAN); else proto_tree_add_item(tree, hf_dsi_attn_flag_bitmap, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; return offset; }
static void dissect_failure_list_ie(tvbuff_t *tvb, packet_info *pinfo, guint offset, guint len, proto_tree *tree, proto_item *parent_ti) { guint base_offs = offset; guint count = 0; /* iterate over list items, each with its own discriminator */ while (offset - base_offs < len) { proto_tree *elem_tree; proto_item *ti; guint remain_len, cause; int rc; guint8 discr = tvb_get_guint8(tvb, offset) & 0x0f; elem_tree = proto_tree_add_subtree(tree, tvb, offset, cell_id_len(discr)+2, ett_cbsp_fail_list, &ti, "Failure List Item"); proto_tree_add_item(elem_tree, hf_cbsp_cell_id_disc, tvb, offset++, 1, ENC_NA); remain_len = len - (offset - base_offs); rc = dissect_cell_id_elem(discr, tvb, pinfo, offset, remain_len, elem_tree, ti); if (rc <= 0) break; offset += rc; proto_tree_add_item_ret_uint(elem_tree, hf_cbsp_cause, tvb, offset++, 1, ENC_NA, &cause); proto_item_append_text(ti, ": Cause %s", val_to_str_const(cause, cbsp_cause_vals, "Undefined")); count++; } proto_item_append_text(parent_ti, ": %u items", count); }
static void dissect_a_records(tvbuff_t* tvb, proto_tree* tree,guint32 nrec,int offset) { guint32 i, curr; const gchar* addrs; proto_tree* a_rec_tree; proto_tree* addr_tree; if(tree == NULL) return; a_rec_tree = proto_tree_add_subtree(tree,tvb,offset, (int)((sizeof(guint32) + sizeof(guint16)) * nrec), ett_a_rec, NULL, "A records"); for(i=0; i<nrec; i++) { curr = offset + (int)((sizeof(guint32)+sizeof(guint16)) * i); addrs = tvb_ip_to_str(tvb, curr+2); addr_tree = proto_tree_add_subtree_format(a_rec_tree, tvb, curr, 6, ett_a_rec_addr, NULL, "Address %s", addrs); proto_tree_add_item(addr_tree, hf_a_rec_len, tvb, curr, sizeof(guint16), ENC_BIG_ENDIAN); proto_tree_add_item(addr_tree, hf_a_record, tvb, curr + 2, 4, ENC_BIG_ENDIAN); } }
static void xmpp_conf_desc(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_tree *desc_tree; xmpp_attr_info attrs_info [] = { {"subject", NULL, FALSE, TRUE, NULL, NULL}, {"display-text", NULL, FALSE, FALSE, NULL, NULL}, {"free-text", NULL, FALSE, FALSE, NULL, NULL}, {"max-user-count", NULL, FALSE, FALSE, NULL, NULL}, }; /* xmpp_elem_info elems_info [] = { {NAME, "keywords", xmpp_conf_desc_keywords, ONE}, {NAME, "conf-uris", xmpp_conf_desc_conf_uris, ONE}, {NAME, "service-uris", xmpp_conf_desc_serv_uris, ONE}, {NAME, "available-media", xmpp_conf_desc_avil_media, ONE}, }; */ desc_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_desc, NULL, "CONFERENCE DESCRIPTION"); xmpp_change_elem_to_attrib("subject", "subject", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("free-text", "free-text", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("maximum-user-count", "max-user-count", element, xmpp_transform_func_cdata); xmpp_display_attrs(desc_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(desc_tree, element, pinfo, tvb, NULL,0); }
/* Code to actually dissect the packets */ static guint dissect_one_tlv(tvbuff_t *tvb, proto_tree *tree, guint offset) { proto_item *ti; proto_tree *tlv_tree = proto_tree_add_subtree(tree, tvb, offset, 0, ett_pp_tlv, &ti, "Property"); guint len; guint pad_len; guint type = tvb_get_ntohs(tvb, offset); const char *name = val_to_str_ext(type, &pp_pid_vals_ext, TYPE_UNKNOWN); proto_item_append_text(ti, " : %s", name); proto_tree_add_item(tlv_tree, hf_pp_pid_type, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; len = tvb_get_ntohs(tvb, offset); proto_item_set_len(ti, 4 + len); proto_tree_add_item(tlv_tree, hf_pp_pid_len, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; proto_tree_add_item(tlv_tree, hf_pp_pid_value, tvb, offset, len, ENC_NA); offset += len; pad_len = ~(offset-1) & 3; if(pad_len) { proto_tree_add_item(tlv_tree, hf_pp_pid_pad_bytes, tvb, offset, pad_len, ENC_NA); offset += pad_len; } return offset; }
/** *ZigBee Device Profile dissector for the bind registration * *@param tvb pointer to buffer containing raw packet. *@param pinfo pointer to packet information fields *@param tree pointer to data tree Wireshark uses to display packet. */ void dissect_zbee_zdp_rsp_bind_register(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version) { proto_tree *field_tree = NULL; guint offset = 0; guint i; guint8 status; /*guint16 table_size;*/ guint16 table_count; status = zdp_parse_status(tree, tvb, &offset); /*table_size =*/ zbee_parse_uint(tree, hf_zbee_zdp_table_size, tvb, &offset, (int)sizeof(guint16), NULL); table_count = zbee_parse_uint(tree, hf_zbee_zdp_table_count, tvb, &offset, (int)sizeof(guint16), NULL); if (tree && table_count) { field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding List"); } for (i=0; i<table_count; i++) { zdp_parse_bind_table_entry(field_tree, tvb, &offset, version); } /* for */ zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); } /* dissect_zbee_zdp_rsp_bind_register */
static void xmpp_conf_media(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_tree *media_tree; xmpp_attr_info attrs_info[] = { {"id", NULL, TRUE, TRUE, NULL, NULL}, {"display-text", NULL, FALSE, TRUE, NULL, NULL}, {"type", NULL, FALSE, TRUE, NULL, NULL}, {"label", NULL, FALSE, TRUE, NULL, NULL}, {"src-id", NULL, FALSE, TRUE, NULL, NULL}, {"status", NULL, FALSE, TRUE, NULL, NULL}, }; media_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_media, NULL, "MEDIA"); xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("type", "type", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("label", "label", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("src-id", "src-id", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("status", "status", element, xmpp_transform_func_cdata); xmpp_display_attrs(media_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(media_tree, element, pinfo, tvb, NULL, 0); }
/** *ZigBee Device Profile dissector for the recover binding * *@param tvb pointer to buffer containing raw packet. *@param pinfo pointer to packet information fields *@param tree pointer to data tree Wireshark uses to display packet. */ void dissect_zbee_zdp_rsp_recover_bind_table(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 version) { proto_tree *field_tree = NULL; guint offset = 0; guint8 status; guint32 i, table_count; status = zdp_parse_status(tree, tvb, &offset); proto_tree_add_item(tree, hf_zbee_zdp_table_size, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item(tree, hf_zbee_zdp_index, tvb, offset, 2, ENC_LITTLE_ENDIAN); offset += 2; proto_tree_add_item_ret_uint(tree, hf_zbee_zdp_table_count, tvb, offset, 2, ENC_LITTLE_ENDIAN, &table_count); offset += 2; if (tree && table_count) { field_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_zbee_zdp_bind, NULL, "Binding Table"); } for (i=0; i<table_count; i++) { zdp_parse_bind_table_entry(field_tree, tvb, &offset, version); } /* for */ zbee_append_info(tree, pinfo, ", Status: %s", zdp_status_name(status)); /* Dump any leftover bytes. */ zdp_dump_excess(tvb, offset, pinfo, tree); } /* dissect_zbee_zdp_rsp_recover_bind_table */
static void xmpp_conf_endpoint(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_tree *endpoint_tree; xmpp_attr_info attrs_info [] = { {"entity", NULL, FALSE, TRUE, NULL, NULL}, {"state", NULL, FALSE, TRUE, NULL, NULL}, {"display-text", NULL, FALSE, TRUE, NULL, NULL}, {"status", NULL, FALSE, TRUE, NULL, NULL}, {"joining-method", NULL, FALSE, TRUE, NULL, NULL}, {"disconnection-method", NULL, FALSE, TRUE, NULL, NULL}, }; xmpp_elem_info elems_info [] = { /*{NAME,"referred",...,ONE},*/ /*{NAME,"joining-info",...,ONE},*/ /*{NAME,"disconnection-info",...,ONE},*/ {NAME,"media", xmpp_conf_media, ONE}, /*{NAME,"call-info",...,ONE},*/ }; endpoint_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_endpoint, NULL, "ENDPOINT"); xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("status", "status", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("joining-method", "joining-method", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("disconnection-method", "disconnection-method", element, xmpp_transform_func_cdata); xmpp_display_attrs(endpoint_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(endpoint_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); }
static void dissect_operation_tlv(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, gint length_count) { proto_item *ti; proto_tree *oper_tree; guint type, length; while (tvb_reported_length_remaining(tvb, offset) >= TLV_TL_LENGTH) { oper_tree = proto_tree_add_subtree(tree, tvb, offset, length_count, ett_forces_lfbselect_tlv_type_operation, &ti, "Operation TLV"); type = tvb_get_ntohs(tvb,offset); ti = proto_tree_add_item(oper_tree, hf_forces_lfbselect_tlv_type_operation_type, tvb, offset, 2, ENC_BIG_ENDIAN); if (try_val_to_str(type, operation_type_vals) == NULL) expert_add_info_format(pinfo, ti, &ei_forces_lfbselect_tlv_type_operation_type, "Bogus: ForCES Operation TLV (Type:0x%04x) is not supported", type); proto_tree_add_item_ret_uint(oper_tree, hf_forces_lfbselect_tlv_type_operation_length, tvb, offset+2, 2, ENC_BIG_ENDIAN, &length); dissect_path_data_tlv(tvb, pinfo, oper_tree, offset+TLV_TL_LENGTH); if (length == 0) break; offset += length; } }
static void xmpp_conf_user(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, xmpp_element_t *element) { proto_tree *user_tree; xmpp_attr_info attrs_info [] = { {"entity", NULL, FALSE, TRUE, NULL, NULL}, {"state", NULL, FALSE, TRUE, NULL, NULL}, {"display-text", NULL, FALSE, TRUE, NULL, NULL}, {"cascaded-focus", NULL, FALSE, TRUE, NULL, NULL} }; xmpp_elem_info elems_info [] = { /*{NAME, "associated-aors", xmpp_conf_assoc_aors, ONE},*/ /*{NAME, "roles", xmpp_conf_roles, ONE},*/ /*{NAME, "languages", xmpp_conf_langs, ONE},*/ {NAME, "endpoint", xmpp_conf_endpoint, MANY}, }; user_tree = proto_tree_add_subtree(tree, tvb, element->offset, element->length, ett_xmpp_conf_user, NULL, "USERS"); xmpp_change_elem_to_attrib("display-text", "display-text", element, xmpp_transform_func_cdata); xmpp_change_elem_to_attrib("cascaded-focus", "cascaded-focus", element, xmpp_transform_func_cdata); xmpp_display_attrs(user_tree, element, pinfo, tvb, attrs_info, array_length(attrs_info)); xmpp_display_elems(user_tree, element, pinfo, tvb, elems_info, array_length(elems_info)); }
static int dissect_PhsMeas1(gboolean implicit_tag, packet_info *pinfo, proto_tree *tree, tvbuff_t *tvb, int offset, int hf_id _U_) { gint8 ber_class; gboolean pc; gint32 tag; guint32 len; proto_tree *subtree; gint32 value; guint32 qual; guint32 i; static const int *q_flags[] = { &hf_sv_phsmeas_q_validity, &hf_sv_phsmeas_q_overflow, &hf_sv_phsmeas_q_outofrange, &hf_sv_phsmeas_q_badreference, &hf_sv_phsmeas_q_oscillatory, &hf_sv_phsmeas_q_failure, &hf_sv_phsmeas_q_olddata, &hf_sv_phsmeas_q_inconsistent, &hf_sv_phsmeas_q_inaccurate, &hf_sv_phsmeas_q_source, &hf_sv_phsmeas_q_test, &hf_sv_phsmeas_q_operatorblocked, &hf_sv_phsmeas_q_derived, NULL }; if (!implicit_tag) { offset=dissect_ber_identifier(pinfo, tree, tvb, offset, &ber_class, &pc, &tag); offset=dissect_ber_length(pinfo, tree, tvb, offset, &len, NULL); } else { len=tvb_reported_length_remaining(tvb, offset); } subtree = proto_tree_add_subtree(tree, tvb, offset, len, ett_phsmeas, NULL, "PhsMeas1"); sv_data.num_phsMeas = 0; for (i = 0; i < len/8; i++) { if (tree && subtree) { value = tvb_get_ntohl(tvb, offset); qual = tvb_get_ntohl(tvb, offset + 4); proto_tree_add_item(subtree, hf_sv_phmeas_instmag_i, tvb, offset, 4, ENC_BIG_ENDIAN); proto_tree_add_bitmask(subtree, tvb, offset + 4, hf_sv_phsmeas_q, ett_phsmeas_q, q_flags, ENC_BIG_ENDIAN); if (i < IEC61850_SV_MAX_PHSMEAS_ENTRIES) { sv_data.phsMeas[i].value = value; sv_data.phsMeas[i].qual = qual; sv_data.num_phsMeas++; } } offset += 8; } return offset; }