static gint dissect_rip_authentication(tvbuff_t *tvb, int offset, proto_tree *tree) { proto_item *ti; proto_tree *rip_authentication_tree; guint16 authtype; guint32 val, digest_off, auth_data_len; auth_data_len = 0; authtype = tvb_get_ntohs(tvb, offset + 2); ti = proto_tree_add_text(tree, tvb, offset, RIP_ENTRY_LENGTH, "Authentication: %s", val_to_str( authtype, rip_auth_type, "Unknown (%u)" ) ); rip_authentication_tree = proto_item_add_subtree(ti, ett_rip_vec); proto_tree_add_uint(rip_authentication_tree, &hfi_rip_auth, tvb, offset+2, 2, authtype); switch ( authtype ) { case AUTH_PASSWORD: /* Plain text password */ proto_tree_add_item(rip_authentication_tree, &hfi_rip_auth_passwd, tvb, offset+4, 16, ENC_ASCII|ENC_NA); break; case AUTH_KEYED_MSG_DIGEST: /* Keyed MD5 rfc 2082 */ digest_off = tvb_get_ntohs( tvb, offset+4 ); proto_tree_add_text( rip_authentication_tree, tvb, offset+4, 2, "Digest Offset: %u" , digest_off ); val = tvb_get_guint8( tvb, offset+6 ); proto_tree_add_text( rip_authentication_tree, tvb, offset+6, 1, "Key ID: %u" , val ); auth_data_len = tvb_get_guint8( tvb, offset+7 ); proto_tree_add_text( rip_authentication_tree, tvb, offset+7, 1, "Auth Data Len: %u" , auth_data_len ); val = tvb_get_ntohl( tvb, offset+8 ); proto_tree_add_text( rip_authentication_tree, tvb, offset+8, 4, "Seq num: %u" , val ); proto_tree_add_text( rip_authentication_tree, tvb, offset+12, 8, "Zero Padding" ); ti = proto_tree_add_text( rip_authentication_tree, tvb, offset-4+digest_off, MD5_AUTH_DATA_LEN+4, "Authentication Data Trailer" ); rip_authentication_tree = proto_item_add_subtree(ti, ett_auth_vec ); proto_tree_add_text( rip_authentication_tree, tvb, offset-4+digest_off+4, MD5_AUTH_DATA_LEN, "Authentication Data: %s", tvb_bytes_to_ep_str_punct(tvb, offset-4+digest_off+4, MD5_AUTH_DATA_LEN, ' ')); break; } return auth_data_len; }
static void dissect_fip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { guint op; guint sub; guint rlen; proto_item *ti; proto_item *item; proto_tree *fip_tree; proto_tree *subtree; guint dtype; guint dlen; guint desc_offset; guint val; tvbuff_t *desc_tvb; const char *info; const char *text; col_set_str(pinfo->cinfo, COL_PROTOCOL, "FIP"); col_clear(pinfo->cinfo, COL_INFO); if (!tvb_bytes_exist(tvb, 0, FIP_HEADER_LEN)) { col_set_str(pinfo->cinfo, COL_INFO, "[packet too short]"); if (tree) proto_tree_add_protocol_format(tree, proto_fip, tvb, 0, -1, "FIP [packet too short]"); return; } op = tvb_get_ntohs(tvb, 2); sub = tvb_get_guint8(tvb, 5); switch (op) { case FIP_OP_DISC: info = val_to_str(sub, fip_disc_subcodes, "Discovery 0x%x"); break; case FIP_OP_LS: info = val_to_str(sub, fip_ls_subcodes, "Link Service 0x%x"); break; case FIP_OP_CTRL: info = val_to_str(sub, fip_ctrl_subcodes, "Control 0x%x"); break; case FIP_OP_VLAN: info = val_to_str(sub, fip_vlan_subcodes, "VLAN 0x%x"); break; case FIP_OP_VN2VN: info = val_to_str(sub, fip_vn2vn_subcodes, "VN2VN 0x%x"); break; default: info = val_to_str(op, fip_opcodes, "Unknown op 0x%x"); break; } col_add_str(pinfo->cinfo, COL_INFO, info); rlen = tvb_get_ntohs(tvb, 6); ti = proto_tree_add_protocol_format(tree, proto_fip, tvb, 0, FIP_HEADER_LEN + rlen * FIP_BPW, "FIP %s", info); fip_tree = proto_item_add_subtree(ti, ett_fip); proto_tree_add_item(fip_tree, hf_fip_ver, tvb, 0, 1, ENC_BIG_ENDIAN); proto_tree_add_item(fip_tree, hf_fip_op, tvb, 2, 2, ENC_BIG_ENDIAN); switch (op) { case FIP_OP_DISC: proto_tree_add_item(fip_tree, hf_fip_disc_subcode, tvb, 5, 1, ENC_BIG_ENDIAN); break; case FIP_OP_LS: proto_tree_add_item(fip_tree, hf_fip_ls_subcode, tvb, 5, 1, ENC_BIG_ENDIAN); break; case FIP_OP_CTRL: proto_tree_add_item(fip_tree, hf_fip_ctrl_subcode, tvb, 5, 1, ENC_BIG_ENDIAN); break; case FIP_OP_VLAN: proto_tree_add_item(fip_tree, hf_fip_vlan_subcode, tvb, 5, 1, ENC_BIG_ENDIAN); break; case FIP_OP_VN2VN: proto_tree_add_item(fip_tree, hf_fip_vn2vn_subcode, tvb, 5, 1, ENC_BIG_ENDIAN); break; default: proto_tree_add_item(fip_tree, hf_fip_hex_subcode, tvb, 5, 1, ENC_BIG_ENDIAN); break; } proto_tree_add_item(fip_tree, hf_fip_dlen, tvb, 6, 2, ENC_BIG_ENDIAN); proto_tree_add_bitmask(fip_tree, tvb, 8, hf_fip_flags, ett_fip_flags, hf_fip_flags_fields, ENC_BIG_ENDIAN); desc_offset = FIP_HEADER_LEN; rlen *= FIP_BPW; proto_tree_add_text(fip_tree, tvb, desc_offset, rlen, "Descriptors:"); while ((rlen > 0) && tvb_bytes_exist(tvb, desc_offset, 2)) { dlen = tvb_get_guint8(tvb, desc_offset + 1) * FIP_BPW; if (!dlen) { proto_tree_add_text(fip_tree, tvb, desc_offset, -1, "Descriptor [length error]"); break; } if (!tvb_bytes_exist(tvb, desc_offset, dlen) || dlen > rlen) { break; } desc_tvb = tvb_new_subset(tvb, desc_offset, dlen, -1); dtype = tvb_get_guint8(desc_tvb, 0); desc_offset += dlen; rlen -= dlen; item = proto_tree_add_text(fip_tree, desc_tvb, 0, -1, "Descriptor: %s ", val_to_str(dtype, fip_desc_types, "Unknown 0x%x")); switch (dtype) { case FIP_DT_PRI: subtree = proto_item_add_subtree(item, ett_fip_dt_pri); fip_desc_type_len(subtree, desc_tvb); proto_tree_add_item(subtree, hf_fip_desc_pri, desc_tvb, 3, 1, ENC_BIG_ENDIAN); proto_item_append_text(item, "%u", tvb_get_guint8(desc_tvb, 3)); break; case FIP_DT_MAC: subtree = proto_item_add_subtree(item, ett_fip_dt_mac); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_map); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_name); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_fab); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_mdl); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_caps); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_vn); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_fka); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_vend); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_vlan); fip_desc_type_len(subtree, desc_tvb); 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 = proto_item_add_subtree(item, ett_fip_dt_fc4f); fip_desc_type_len(subtree, desc_tvb); fip_desc_fc4f(desc_tvb, subtree, item); break; default: subtree = proto_item_add_subtree(item, ett_fip_dt_unk); fip_desc_type_len(subtree, desc_tvb); proto_tree_add_item(subtree, hf_fip_desc_unk, desc_tvb, 2, -1, ENC_NA); break; } } }
static void dissect_socketcan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *can_tree; proto_item *ti; guint8 frame_type; gint frame_len; struct can_identifier can_id; tvbuff_t* next_tvb; col_set_str(pinfo->cinfo, COL_PROTOCOL, "CAN"); col_clear(pinfo->cinfo,COL_INFO); frame_len = tvb_get_guint8( tvb, CAN_LEN_OFFSET); can_id.id = tvb_get_ntohl(tvb, 0); if (can_id.id & CAN_RTR_FLAG) { frame_type = LINUX_CAN_RTR; } else if (can_id.id & CAN_ERR_FLAG) { frame_type = LINUX_CAN_ERR; } else if (can_id.id & CAN_EFF_FLAG) { frame_type = LINUX_CAN_EXT; } else { frame_type = LINUX_CAN_STD; } can_id.id &= CAN_EFF_MASK; col_add_fstr(pinfo->cinfo, COL_INFO, "%s: 0x%08x", val_to_str(frame_type, frame_type_vals, "Unknown (0x%02x)"), can_id.id); col_append_fstr(pinfo->cinfo, COL_INFO, " %s", tvb_bytes_to_ep_str_punct(tvb, CAN_DATA_OFFSET, frame_len, ' ')); ti = proto_tree_add_item(tree, proto_can, tvb, 0, -1, ENC_NA); can_tree = proto_item_add_subtree(ti, ett_can); proto_tree_add_item(can_tree, hf_can_ident, tvb, 0, 4, ENC_BIG_ENDIAN); proto_tree_add_item(can_tree, hf_can_extflag, tvb, 0, 4, ENC_BIG_ENDIAN); proto_tree_add_item(can_tree, hf_can_rtrflag, tvb, 0, 4, ENC_BIG_ENDIAN); proto_tree_add_item(can_tree, hf_can_errflag, tvb, 0, 4, ENC_BIG_ENDIAN); proto_tree_add_item(can_tree, hf_can_len, tvb, CAN_LEN_OFFSET, 1, ENC_BIG_ENDIAN); next_tvb = tvb_new_subset_length(tvb, CAN_DATA_OFFSET, frame_len); switch (can_high_level_protocol_dissector) { case CAN_DATA_DISSECTOR: call_dissector(data_handle, next_tvb, pinfo, tree); break; case CAN_CANOPEN_DISSECTOR: call_dissector_with_data(canopen_handle, next_tvb, pinfo, tree, &can_id); break; case CAN_DEVICENET_DISSECTOR: /* XXX - Not sure this is correct. But the capture provided in * bug 8564 provides CAN ID in little endian format, so this makes it work */ can_id.id = GUINT32_SWAP_LE_BE(can_id.id); call_dissector_with_data(devicenet_handle, next_tvb, pinfo, tree, &can_id); break; case CAN_J1939_DISSECTOR: call_dissector_with_data(j1939_handle, next_tvb, pinfo, tree, &can_id); break; } }
/* AU Header dissection */ static offset_struct* dissect_auheader( tvbuff_t *tvb, offset_struct *poffset, packet_info *pinfo, proto_tree *ismacryp_tree, guint set_version ) { proto_item *ismacryp_item; proto_tree *ismacryp_header_tree; proto_tree *ismacryp_header_byte_tree; guint16 header_len_bytes = 0; /* total length of non-first AU header in bytes (rounded up) */ gint header_len = 0; /* length of AU headers in bits */ gint cts_flag =0; gint dts_flag =0; gboolean first_au_flag=FALSE; gint bit_offset = 0; /*first determine total AU header length */ /* calculate each AU header length in bits first */ switch (set_version) { case V11: if (selective_encryption) header_len+=8; /* add one byte to header length */ break; case V20: if (selective_encryption || slice_indication || padding_indication) header_len+=8; /* add one byte to header length */ break; default: DISSECTOR_ASSERT_NOT_REACHED(); break; } /* end switch */ header_len+=au_size_length; /* add au size length */ if (poffset->offset_bytes==AU_HEADERS_LENGTH_SIZE){ /*first AU */ header_len+=8*(iv_length); /* add IV length */ header_len+=8*key_indicator_length; /* add key indicator length */ header_len+=au_index_length; /* add AU index length */ first_au_flag = TRUE; } else { /* not the first AU */ if (key_indicator_per_au_flag == TRUE) header_len+=8*key_indicator_length; /* add key indicator length */ header_len+=8*(delta_iv_length); /* add delta IV length */ header_len+=au_index_delta_length; /* add AU delta index length */ } /* CTS flag is present? */ if (cts_delta_length != 0){ /* need to test whether cts_delta_flag is TRUE or FALSE */ cts_flag=tvb_get_bits8(tvb, AU_HEADERS_LENGTH_SIZE*8+header_len, 1); /*fetch 1 bit CTS flag */ header_len+=1; /* add CTS flag bit */ if (cts_flag==1) header_len+=cts_delta_length; /* add CTS delta length bits if CTS flag SET */ } /* DTS flag is present? */ if (dts_delta_length != 0){ /* need to test whether dts_delta_flag is TRUE or FALSE */ dts_flag=tvb_get_bits8(tvb, AU_HEADERS_LENGTH_SIZE*8+header_len, 1); /*fetch 1 bit DTS flag */ header_len+=1; /* add DTS flag bit */ if (dts_flag==1) header_len+=dts_delta_length; /* add DTS delta length bits if DTS flag SET */ } /* RAP flag present? */ if (random_access_indication != FALSE) header_len+=1; /* add 1 bit RAP flag */ /* stream state indication present */ if (stream_state_indication !=0) header_len+=stream_state_indication; /* add stream state indication bits */ /* convert header_len to bytes (rounded up) */ if (header_len% 8!=0) { header_len_bytes=((header_len)/8)+1; /*add 1 */ } else header_len_bytes=((header_len)/8); /* add AU header tree */ ismacryp_item = proto_tree_add_item(ismacryp_tree, hf_ismacryp_header, tvb, poffset->offset_bytes, header_len_bytes, ENC_NA ); proto_item_append_text(ismacryp_item, ": Length=%d bits", header_len); /* add text to Header tree indicating length */ /* sanity check if actual AU header length is zero bits, which indicates an error */ if ( header_len == 0) /* something wrong */ { proto_item_append_text(ismacryp_item, " Error - zero bit AU header size - check parameters!"); } ismacryp_header_tree = proto_item_add_subtree(ismacryp_item, ett_ismacryp_header); /* ismacryp header analysis */ /* we are being asked for details */ /* Extra 1 Byte Header? */ if ((set_version==V20 && (selective_encryption || slice_indication || padding_indication)) || (set_version==V11 && selective_encryption)){ /* add header byte tree */ ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_header_byte, tvb, poffset->offset_bytes, 1, ENC_NA ); proto_item_append_text(ismacryp_item, ": Length=8 bits"); /* add text to Header byte tree indicating length */ ismacryp_header_byte_tree = proto_item_add_subtree(ismacryp_item, ett_ismacryp_header_byte); /*ismacryp_header_byte_tree */ /* we are being asked for details */ /* tvb is network order, so get MSB bits first, so shift 8 bits and work "backwards" */ add_bits(poffset,7); /*shift 7 bits to get correct bit */ /* AU_is_encrypted bit */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ if (selective_encryption){ /* bit used */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_au_is_encrypted, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /*fetch 1 bit AU_is_encrypted */ } else { /* bit unused */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_unused_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /*fetch 1 bit unused */ } switch (set_version){ /* ISMACryp version? */ case V11: /* Reserved bits */ add_bits(poffset, -7); /* move back 7 bits for reserved bits */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_reserved_bits, tvb, bit_offset, 7, ENC_BIG_ENDIAN); /*fetch 7 bits reserved */ add_bits(poffset,8); /* offset to next byte */ break; case V20: /* Slice_start bit */ add_bits(poffset, -1); /* move back 1 bit for slice_start */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ if (slice_indication){ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_slice_start, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /*fetch 1 bit slice_start */ } else { /* bit unused */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_unused_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /*fetch 1 bit unused */ } add_bits(poffset, -1); /* move back 1 bit for slice_end */ /* Slice_end bit */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ if (slice_indication){ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_slice_end, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /*fetch 1 bit Slice_end */ } else { /* bit unused */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_unused_bits, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /*fetch 1 bit unused */ } add_bits(poffset, -3); /* move back 3 bits for padding_bitcount */ /* Padding_bitcount bits */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ if (padding_indication){ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_padding_bitcount, tvb, bit_offset, 3, ENC_BIG_ENDIAN); /*fetch 3 bits padding_bitcount */ } else { /* bits unused */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_unused_bits, tvb, bit_offset, 3, ENC_BIG_ENDIAN); /*fetch 3 bits unused */ } add_bits(poffset, -2); /* move back 2 bits for reserved bits */ /* Reserved bits */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ proto_tree_add_bits_item(ismacryp_header_byte_tree, hf_ismacryp_reserved_bits, tvb, bit_offset, 2, ENC_BIG_ENDIAN); /*fetch 2 bits reserved */ add_bits(poffset,8); /* offset to next byte */ break; default: DISSECTOR_ASSERT_NOT_REACHED(); break; } /* end switch set_version */ } /* end selective encryption */ /* IV */ if (first_au_flag == TRUE && iv_length != 0) { ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_iv, tvb, poffset->offset_bytes, iv_length, ENC_NA); proto_item_append_text(ismacryp_item, ": Length=%d bytes",iv_length); /* add IV info */ col_append_fstr( pinfo->cinfo, COL_INFO, ", IV=0x%s", tvb_bytes_to_ep_str_punct(tvb, poffset->offset_bytes, iv_length,' ')); poffset->offset_bytes+=iv_length; /* add IV length to offset_bytes */ } /*Delta IV */ if (first_au_flag == FALSE && delta_iv_length != 0) { ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_delta_iv, tvb, poffset->offset_bytes, delta_iv_length, ENC_NA); proto_item_append_text(ismacryp_item, ": Length=%d bytes",delta_iv_length); /* add delta IV info */ col_append_fstr( pinfo->cinfo, COL_INFO, ", Delta IV=0x%s", tvb_bytes_to_ep_str_punct(tvb, poffset->offset_bytes, delta_iv_length,' ')); poffset->offset_bytes+=iv_length; /* add IV length to offset_bytes */ } /* Key Indicator */ if ( key_indicator_length != 0 && ( first_au_flag == TRUE || key_indicator_per_au_flag == TRUE) ) { /* (first AU or KI for each AU) and non-zero KeyIndicator size */ ismacryp_item = proto_tree_add_item(ismacryp_header_tree, hf_ismacryp_key_indicator, tvb, poffset->offset_bytes, key_indicator_length, ENC_NA); proto_item_append_text(ismacryp_item,": Length=%d bytes",key_indicator_length); /* add KI info */ col_append_fstr( pinfo->cinfo, COL_INFO, ", KI=0x%s", tvb_bytes_to_ep_str_punct(tvb, poffset->offset_bytes, key_indicator_length,' ')); poffset->offset_bytes+=key_indicator_length; /* add KI length to offset_bytes */ } /* AU size */ if (au_size_length != 0) /* in bits */ { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ ismacryp_item = proto_tree_add_bits_item(ismacryp_header_tree,hf_ismacryp_au_size, tvb, bit_offset, au_size_length, ENC_BIG_ENDIAN); proto_item_append_text(ismacryp_item, " bytes: Length=%d bits",au_size_length); /* add AU size info */ /*bit_offset+=au_size_length;*/ add_bits(poffset, au_size_length); } /* AU Index */ if (first_au_flag == TRUE && au_index_length != 0) /* first AU and non-zero AU size */ { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ ismacryp_item = proto_tree_add_bits_item(ismacryp_header_tree,hf_ismacryp_au_index, tvb, bit_offset, au_index_length, ENC_BIG_ENDIAN); proto_item_append_text(ismacryp_item, " bits: Length=%d bits",au_index_length); /* add AU index info */ /*bit_offset+=au_index_length;*/ add_bits(poffset, au_index_length); } /* AU index delta */ if (first_au_flag == FALSE && au_index_delta_length != 0) /* not first AU and non-zero AU delta size */ { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ ismacryp_item = proto_tree_add_bits_item(ismacryp_header_tree,hf_ismacryp_au_index_delta, tvb, bit_offset, au_index_delta_length, ENC_BIG_ENDIAN); proto_item_append_text(ismacryp_item, ": Length=%d bits", au_index_delta_length); /* add AU index info */ /*bit_offset+=au_index_delta_length;*/ add_bits(poffset, au_index_delta_length); } /* CTS delta value */ if (cts_delta_length != 0) { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ proto_tree_add_bits_item(ismacryp_header_tree, hf_ismacryp_cts_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /* read CTS flag */ add_bits(poffset, 1); if (cts_flag==1) { /* now fetch CTS delta value (remember offset 1 bit due to CTS flag) */ bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ ismacryp_item = proto_tree_add_bits_item(ismacryp_header_tree, hf_ismacryp_cts_delta, tvb, bit_offset, cts_delta_length, ENC_BIG_ENDIAN); /* read CTS delta value */ proto_item_append_text(ismacryp_item, ": Length=%d bits",cts_delta_length); /* add CTS delta info */ add_bits(poffset, cts_delta_length); } } /* DTS delta value */ if (dts_delta_length != 0) { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ proto_tree_add_bits_item(ismacryp_header_tree, hf_ismacryp_dts_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /* read DTS flag */ add_bits(poffset, 1); /* now fetch DTS delta value (remember offset x bits due to DTS flag) */ if (dts_flag ==1) { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ ismacryp_item = proto_tree_add_bits_item(ismacryp_header_tree, hf_ismacryp_dts_delta, tvb, bit_offset, dts_delta_length, ENC_BIG_ENDIAN); /* read DTS delta value */ proto_item_append_text(ismacryp_item, ": Length=%d bits",dts_delta_length); /* add DTS delta info */ add_bits(poffset, dts_delta_length); } } /* RAP */ if (random_access_indication != FALSE) { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ proto_tree_add_bits_item(ismacryp_header_tree, hf_ismacryp_rap_flag, tvb, bit_offset, 1, ENC_BIG_ENDIAN); /* read RAP flag */ add_bits(poffset, 1); } /*STREAM STATE */ if (stream_state_indication != 0) { bit_offset = (poffset->offset_bytes)*8+poffset->offset_bits; /* offset in bits */ proto_tree_add_bits_item(ismacryp_header_tree, hf_ismacryp_stream_state, tvb, bit_offset, stream_state_indication, ENC_BIG_ENDIAN); /* read stream state */ add_bits(poffset, stream_state_indication); } /* end header details */ return poffset; }