src/FakeServer/doc/dissectors/packet-mysql.c
static int
add_session_tracker_entry_to_tree(tvbuff_t *tvb, packet_info *pinfo, proto_item *tree, int offset) {
	guint8 data_type; /* session tracker type */
	guint64 length; /* complete length of session tracking entry */
	guint64 lenstr;
	int orig_offset = offset, lenfle;
	proto_item *item, *ti;
	proto_tree *session_track_tree;

	ti = proto_tree_add_item(tree, hf_mysql_session_track, tvb, offset, 1, ENC_NA);
	session_track_tree = proto_item_add_subtree(ti, ett_session_track);

	proto_tree_add_item(session_track_tree, hf_mysql_session_track_type, tvb, offset, 1, ENC_BIG_ENDIAN);
	data_type = tvb_get_guint8(tvb, offset);
	offset += 1;

	lenfle = tvb_get_fle(tvb, offset, &length, NULL);
	proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_length, tvb, offset, lenfle, length);
	offset += lenfle;

	switch (data_type) {
	case 0: /* SESSION_SYSVARS_TRACKER */
		lenfle = tvb_get_fle(tvb, offset, &lenstr, NULL);
		proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_sysvar_length, tvb, offset, lenfle, lenstr);
		offset += lenfle;

		proto_tree_add_item(session_track_tree, hf_mysql_session_track_sysvar_name, tvb, offset, (gint)lenstr, ENC_ASCII|ENC_NA);
		offset += (int)lenstr;

		lenfle = tvb_get_fle(tvb, offset, &lenstr, NULL);
		proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_sysvar_length, tvb, offset, lenfle, lenstr);
		offset += lenfle;

		proto_tree_add_item(session_track_tree, hf_mysql_session_track_sysvar_value, tvb, offset, (gint)lenstr, ENC_ASCII|ENC_NA);
		offset += (int)lenstr;
		break;
	case 1: /* CURRENT_SCHEMA_TRACKER */
		lenfle = tvb_get_fle(tvb, offset, &lenstr, NULL);
		proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_schema_length, tvb, offset, lenfle, lenstr);
		offset += lenfle;

		proto_tree_add_item(session_track_tree, hf_mysql_session_track_schema, tvb, offset, (gint)lenstr, ENC_ASCII|ENC_NA);
		offset += (int)lenstr;
		break;
	case 2: /* SESSION_STATE_CHANGE_TRACKER */
		proto_tree_add_item(session_track_tree, hf_mysql_session_state_change, tvb, offset, 1, ENC_ASCII|ENC_NA);
		offset++;
		break;
	default: /* unsupported types skipped */
		item = proto_tree_add_item(session_track_tree, hf_mysql_payload, tvb, offset, (gint)length, ENC_NA);
		expert_add_info_format(pinfo, item, &ei_mysql_dissector_incomplete, "FIXME: unrecognized session tracker data");
		offset += (int)length;
	}
	proto_item_set_len(ti, offset - orig_offset);

	return (offset - orig_offset);
}
/*
  Add a session track entry to the session tracking subtree

  return bytes read
*/
Add a session track entry to the session tracking subtree
return bytes read
Add a session track entry to the session tracking subtree return bytes read
static int
add_session_tracker_entry_to_tree(tvbuff_t *tvb, packet_info *pinfo, proto_item *tree, int offset) {
	guint8 data_type; 
	guint64 length; 
	guint64 lenstr;
	int orig_offset = offset, lenfle;
	proto_item *item, *ti;
	proto_tree *session_track_tree;
	ti = proto_tree_add_item(tree, hf_mysql_session_track, tvb, offset, 1, ENC_NA);
	session_track_tree = proto_item_add_subtree(ti, ett_session_track);
	proto_tree_add_item(session_track_tree, hf_mysql_session_track_type, tvb, offset, 1, ENC_BIG_ENDIAN);
	data_type = tvb_get_guint8(tvb, offset);
	offset += 1;
	lenfle = tvb_get_fle(tvb, offset, &length, NULL);
	proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_length, tvb, offset, lenfle, length);
	offset += lenfle;
	switch (data_type) {
	case 0: 
		lenfle = tvb_get_fle(tvb, offset, &lenstr, NULL);
		proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_sysvar_length, tvb, offset, lenfle, lenstr);
		offset += lenfle;
		proto_tree_add_item(session_track_tree, hf_mysql_session_track_sysvar_name, tvb, offset, (gint)lenstr, ENC_ASCII|ENC_NA);
		offset += (int)lenstr;
		lenfle = tvb_get_fle(tvb, offset, &lenstr, NULL);
		proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_sysvar_length, tvb, offset, lenfle, lenstr);
		offset += lenfle;
		proto_tree_add_item(session_track_tree, hf_mysql_session_track_sysvar_value, tvb, offset, (gint)lenstr, ENC_ASCII|ENC_NA);
		offset += (int)lenstr;
		break;
	case 1: 
		lenfle = tvb_get_fle(tvb, offset, &lenstr, NULL);
		proto_tree_add_uint64(session_track_tree, hf_mysql_session_track_schema_length, tvb, offset, lenfle, lenstr);
		offset += lenfle;
		proto_tree_add_item(session_track_tree, hf_mysql_session_track_schema, tvb, offset, (gint)lenstr, ENC_ASCII|ENC_NA);
		offset += (int)lenstr;
		break;
	case 2: 
		proto_tree_add_item(session_track_tree, hf_mysql_session_state_change, tvb, offset, 1, ENC_ASCII|ENC_NA);
		offset++;
		break;
	default: 
		item = proto_tree_add_item(session_track_tree, hf_mysql_payload, tvb, offset, (gint)length, ENC_NA);
		expert_add_info_format(pinfo, item, &ei_mysql_dissector_incomplete, "FIXME: unrecognized session tracker data");
		offset += (int)length;
	}
	proto_item_set_len(ti, offset - orig_offset);
	return (offset - orig_offset);
}
static int add_session_tracker_entry_to_tree ( tvbuff_t * tvb , packet_info * pinfo , proto_item * tree , int offset ) { guint8 data_type ; guint64 length ; guint64 lenstr ; int orig_offset = offset , lenfle ; proto_item * item , * ti ; proto_tree * session_track_tree ; ti = proto_tree_add_item ( tree , hf_mysql_session_track , tvb , offset , 1 , ENC_NA ) ; session_track_tree = proto_item_add_subtree ( ti , ett_session_track ) ; proto_tree_add_item ( session_track_tree , hf_mysql_session_track_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; data_type = tvb_get_guint8 ( tvb , offset ) ; offset += 1 ; lenfle = tvb_get_fle ( tvb , offset , & length , NULL ) ; proto_tree_add_uint64 ( session_track_tree , hf_mysql_session_track_length , tvb , offset , lenfle , length ) ; offset += lenfle ; switch ( data_type ) { case 0 : lenfle = tvb_get_fle ( tvb , offset , & lenstr , NULL ) ; proto_tree_add_uint64 ( session_track_tree , hf_mysql_session_track_sysvar_length , tvb , offset , lenfle , lenstr ) ; offset += lenfle ; proto_tree_add_item ( session_track_tree , hf_mysql_session_track_sysvar_name , tvb , offset , ( gint ) lenstr , ENC_ASCII | ENC_NA ) ; offset += ( int ) lenstr ; lenfle = tvb_get_fle ( tvb , offset , & lenstr , NULL ) ; proto_tree_add_uint64 ( session_track_tree , hf_mysql_session_track_sysvar_length , tvb , offset , lenfle , lenstr ) ; offset += lenfle ; proto_tree_add_item ( session_track_tree , hf_mysql_session_track_sysvar_value , tvb , offset , ( gint ) lenstr , ENC_ASCII | ENC_NA ) ; offset += ( int ) lenstr ; break ; case 1 : lenfle = tvb_get_fle ( tvb , offset , & lenstr , NULL ) ; proto_tree_add_uint64 ( session_track_tree , hf_mysql_session_track_schema_length , tvb , offset , lenfle , lenstr ) ; offset += lenfle ; proto_tree_add_item ( session_track_tree , hf_mysql_session_track_schema , tvb , offset , ( gint ) lenstr , ENC_ASCII | ENC_NA ) ; offset += ( int ) lenstr ; break ; case 2 : proto_tree_add_item ( session_track_tree , hf_mysql_session_state_change , tvb , offset , 1 , ENC_ASCII | ENC_NA ) ; offset ++ ; break ; default : item = proto_tree_add_item ( session_track_tree , hf_mysql_payload , tvb , offset , ( gint ) length , ENC_NA ) ; expert_add_info_format ( pinfo , item , & ei_mysql_dissector_incomplete , " " ) ; offset += ( int ) length ; } proto_item_set_len ( ti , offset - orig_offset ) ; return ( offset - orig_offset ) ; }
Add a session track entry to the session tracking subtree
return bytes read
Add a session track entry to the session tracking subtree return bytes read
/* session tracker type */ /* complete length of session tracking entry */ /* SESSION_SYSVARS_TRACKER */ /* CURRENT_SCHEMA_TRACKER */ /* SESSION_STATE_CHANGE_TRACKER */ /* unsupported types skipped */