> The correct way to fetch IPv4 addresses is with "tvb_memcpy()", as IPv4
> addresses are kept in *network* byte order, not *host* byte order,
> inside protocol trees:
>
> guint32 ipv4_addr;
>
> ...
>
> tvb_memcpy(tvb, (guint8 *)&ipv4_addr, offset, 4);
...or, if you're just doing
proto_tree_add_ipv4(tree, hf_XXX, tvb, offset, 4,
tvb_get_letohl(tvb, offset));
you might as well just do
proto_tree_add_item(tree, hf_XXX, tvb, offset, 4, FALSE);
and let "proto_tree_add_item()" do the fetching for you.
This also applies to
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 1,
tvb_get_guint8(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 1, FALSE);
and
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 2,
tvb_get_ntohs(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 2, FALSE);
and
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 3,
tvb_get_ntoh24(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 3, FALSE);
and
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 4,
tvb_get_ntohl(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 4, FALSE);
and
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 2,
tvb_get_letohs(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 2, TRUE);
and
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 3,
tvb_get_letoh24(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 3, TRUE);
and
proto_tree_add_uint(tree, hf_XXX, tvb, offset, 4,
tvb_get_letohl(tvb, offset));
which can be done as
proto_tree_add_item(tree, hf_XXX, tvb, offset, 4, TRUE);
and so on.