/* * XXX - do reassembly, using the EOM flag. (Then do that in the Netware * SPX implementation, too.) * * XXX - hand off to subdissectors based on the socket number. */ static void dissect_spp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { proto_tree *spp_tree = NULL; proto_item *ti; tvbuff_t *next_tvb; guint8 conn_ctrl; proto_tree *cc_tree; guint8 datastream_type; const char *datastream_type_string; guint16 spp_seq; const char *spp_msg_string; guint16 low_socket, high_socket; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPP"); col_set_str(pinfo->cinfo, COL_INFO, "SPP"); if (tree) { ti = proto_tree_add_item(tree, proto_spp, tvb, 0, SPP_HEADER_LEN, ENC_NA); spp_tree = proto_item_add_subtree(ti, ett_spp); } conn_ctrl = tvb_get_guint8(tvb, 0); spp_msg_string = spp_conn_ctrl(conn_ctrl); col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spp_msg_string); if (tree) { ti = proto_tree_add_uint_format_value(spp_tree, hf_spp_connection_control, tvb, 0, 1, conn_ctrl, "%s (0x%02X)", spp_msg_string, conn_ctrl); cc_tree = proto_item_add_subtree(ti, ett_spp_connctrl); proto_tree_add_boolean(cc_tree, hf_spp_connection_control_sys, tvb, 0, 1, conn_ctrl); proto_tree_add_boolean(cc_tree, hf_spp_connection_control_send_ack, tvb, 0, 1, conn_ctrl); proto_tree_add_boolean(cc_tree, hf_spp_connection_control_attn, tvb, 0, 1, conn_ctrl); proto_tree_add_boolean(cc_tree, hf_spp_connection_control_eom, tvb, 0, 1, conn_ctrl); } datastream_type = tvb_get_guint8(tvb, 1); datastream_type_string = spp_datastream(datastream_type); if (datastream_type_string != NULL) { col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", datastream_type_string); } if (tree) { if (datastream_type_string != NULL) { proto_tree_add_uint_format_value(spp_tree, hf_spp_datastream_type, tvb, 1, 1, datastream_type, "%s (0x%02X)", datastream_type_string, datastream_type); } else { proto_tree_add_uint(spp_tree, hf_spp_datastream_type, tvb, 1, 1, datastream_type); } proto_tree_add_item(spp_tree, hf_spp_src_id, tvb, 2, 2, ENC_BIG_ENDIAN); proto_tree_add_item(spp_tree, hf_spp_dst_id, tvb, 4, 2, ENC_BIG_ENDIAN); } spp_seq = tvb_get_ntohs(tvb, 6); if (tree) { proto_tree_add_uint(spp_tree, hf_spp_seq_nr, tvb, 6, 2, spp_seq); proto_tree_add_item(spp_tree, hf_spp_ack_nr, tvb, 8, 2, ENC_BIG_ENDIAN); proto_tree_add_item(spp_tree, hf_spp_all_nr, tvb, 10, 2, ENC_BIG_ENDIAN); } if (tvb_reported_length_remaining(tvb, SPP_HEADER_LEN) > 0) { if (pinfo->srcport > pinfo->destport) { low_socket = pinfo->destport; high_socket = pinfo->srcport; } else { low_socket = pinfo->srcport; high_socket = pinfo->destport; } next_tvb = tvb_new_subset_remaining(tvb, SPP_HEADER_LEN); if (dissector_try_uint(spp_socket_dissector_table, low_socket, next_tvb, pinfo, tree)) return; if (dissector_try_uint(spp_socket_dissector_table, high_socket, next_tvb, pinfo, tree)) return; call_dissector(data_handle, next_tvb, pinfo, tree); } }
col_set_str(pinfo->cinfo, COL_PROTOCOL, "SPP"); col_set_str(pinfo->cinfo, COL_INFO, "SPP"); ti = proto_tree_add_item(tree, proto_spp, tvb, 0, SPP_HEADER_LEN, ENC_NA); spp_tree = proto_item_add_subtree(ti, ett_spp); conn_ctrl = tvb_get_guint8(tvb, 0); spp_msg_string = spp_conn_ctrl(conn_ctrl); col_append_fstr(pinfo->cinfo, COL_INFO, " %s", spp_msg_string); proto_tree_add_bitmask_with_flags(spp_tree, tvb, 0, hf_spp_connection_control, ett_spp_connctrl, ctrl, ENC_NA, BMT_NO_FALSE); datastream_type = tvb_get_guint8(tvb, 1); datastream_type_string = spp_datastream(datastream_type); if (datastream_type_string != NULL) { col_append_fstr(pinfo->cinfo, COL_INFO, " (%s)", datastream_type_string); } if (tree) { if (datastream_type_string != NULL) { proto_tree_add_uint_format_value(spp_tree, hf_spp_datastream_type, tvb, 1, 1, datastream_type, "%s (0x%02X)", datastream_type_string, datastream_type); } else { proto_tree_add_uint(spp_tree, hf_spp_datastream_type, tvb, 1, 1, datastream_type); } proto_tree_add_item(spp_tree, hf_spp_src_id, tvb, 2, 2, ENC_BIG_ENDIAN);