Wireshark-dev: Re: [Wireshark-dev] Reassembling: pinfo and 2 functions

Date: Tue, 28 Apr 2009 17:37:39 +0000
I took a look at Packet-sccp.c, however i'm still a bit confused.

/* Reasemble */
    if (!sccp_xudt_desegment) { ******** how does sccp_xudt_desegment change?
	proto_tree_add_text(sccp_tree, tvb, variable_pointer1,
			    tvb_get_guint8(tvb, variable_pointer1)+1,
			    "Segmented Data");
	dissect_sccp_variable_parameter(tvb, pinfo, sccp_tree, tree,
					PARAMETER_DATA, variable_pointer1);
    ******Does this just dissect an unknown message? where does it change that it should be reassembled? ******
    } else {
	save_fragmented = pinfo->fragmented; 
	pinfo->fragmented = TRUE; ***i thought this was a way to tell if it needs to be reassembled, not after you already know and are reassembling*****
	frag_msg = fragment_add_seq_next(tvb, variable_pointer1 + 1, pinfo,
			     source_local_ref,			/* ID for fragments belonging together */
			     sccp_xudt_msg_fragment_table,	/* list of message fragments */
			     sccp_xudt_msg_reassembled_table,	/* list of reassembled messages */
			     tvb_get_guint8(tvb,variable_pointer1),/* fragment length - to the end */
			     more);				/* More fragments? */

	new_tvb = process_reassembled_data(tvb, variable_pointer1 + 1, pinfo,
					   "Reassembled Message", frag_msg,
					   &sccp_xudt_msg_frag_items, NULL,
					   tree);

	if (frag_msg && frag_msg->next) { /* Reassembled */ *****what is frag_msg-> next?*****
	    if (check_col(pinfo->cinfo, COL_INFO))
		col_append_str(pinfo->cinfo, COL_INFO,
			       "(Message reassembled) ");
	} else if (more) { /* Not last packet of reassembled message */
	    if (check_col(pinfo->cinfo, COL_INFO))
		col_append_str(pinfo->cinfo, COL_INFO, "(Message fragment) ");
	}

	pinfo->fragmented = save_fragmented; ***why do we change this back? ***

	if (new_tvb)
	    dissect_sccp_data_param(new_tvb, pinfo, tree);
    }

    /* End reassemble */

Among other things, i dont understand how you first know its fragmented since it seems to me  the initial if( ) param doesnt get changed.

Greg