Protocols/text

You may have arrived here by right clicking on a text label in the Packet Details, then selecting Wiki Protocol Page

210503_text_label

Worked on in !2897 (merged) - Qt: URLs to Display Filter Reference and Wiki Protocol pages

There is more than one way to add a text label. Examples below use proto_tree_add_subtree().
See README.dissector and proto.c:

/* Add a text-only node that creates a subtree underneath.
 */
proto_tree *
proto_tree_add_subtree(proto_tree *tree, tvbuff_t *tvb, gint start, gint length, gint idx, proto_item **tree_item, const char *text)
{
	return proto_tree_add_subtree_format(tree, tvb, start, length, idx, tree_item, "%s", text);
}

Examples:
packet-tcp.c

    tree=proto_tree_add_subtree(parent_tree, tvb, 0, 0, ett_tcp_timestamps, &item, "Timestamps");
    proto_item_set_generated(item);

packet-ssh.c

  ssh2_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_ssh2, NULL, wmem_strbuf_get_str(title));

TODO: add info to Dev Guide and a screen shot of the foo.dissector Packet Details.