/* options dissector. return offset pointing the next of options. (i.e. the top of the paylaod or the end of the data.  */
static int dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, gint offset, gint coap_length)
/* options dissector. return offset pointing the next of options. (i.e. the top of the paylaod or the end of the data.  */
static int dissect_coap_options(tvbuff_t *tvb, packet_info *pinfo, proto_tree *coap_tree, gint offset, gint coap_length)
{
	guint  opt_num = 0;
	int    i;
	guint8 endmarker;
	for (i = 1; offset < coap_length; i++) {
		offset = dissect_coap_options_main(tvb, pinfo, coap_tree,
		    offset, i, &opt_num, coap_length);
		if (offset == -1)
			return -1;
		if (offset >= coap_length)
			break;
		endmarker = tvb_get_guint8(tvb, offset);
		if (endmarker == 0xff) {
			proto_tree_add_item(coap_tree, hf_coap_opt_end_marker, tvb, offset, 1, ENC_BIG_ENDIAN);
			offset += 1;
			break;
		}
	}
	return offset;
}