1

カスタム プロトコル用の Wireshark ディセクタを作成中です。ただし、符号なし 32 ビット整数のフィールドがあります。実際にはリトルエンディアン形式で送信されます。Wireshark にそのように解釈させるにはどうすればよいですか?

つまり、私の hf_register_info 構造体には含まれています

&hf_foo_length,
{ "Length", "foo.length", FT_UINT32, BASE_DEC,
NULL, 0x0, NULL, HFILL }

そして、私が呼んでいる解剖機能で

proto_tree_add_item(foo_tree, hf_foo_length, tvb, offset, 4, FALSE);
4

1 に答える 1

2

私の最後の質問に答えるために。proto_tree_add_item の最後のパラメータがゼロでない場合、フィールドがリトルエンディアンとして解釈されることを発見しました。

proto.h を参照

/*
 * We might also, in the future, want to allow a field specifier to
 * indicate the encoding of the field, or at least its default
 * encoding, as most fields in most protocols always use the
 * same encoding (although that's not true of all fields, so we
 * still need to be able to specify that at run time).
 *
 * So, for now, we define ENC_BIG_ENDIAN and ENC_LITTLE_ENDIAN as
 * bit flags, to be combined, in the future, with other information
 * to specify the encoding in the last argument to
 * proto_tree_add_item(), and possibly to specify in a field
 * definition (e.g., ORed in with the type value).
 *
 * Currently, proto_tree_add_item() treats its last argument as a
 * Boolean - if it's zero, the field is big-endian, and if it's non-zero,
 * the field is little-endian - and other code in epan/proto.c does
 * the same.  We therefore define ENC_BIG_ENDIAN as 0x00000000 and
 * ENC_LITTLE_ENDIAN as 0x80000000 - we're using the high-order bit
 * so that we could put a field type and/or a value such as a character
 * encoding in the lower bits.
 */
于 2011-02-09T03:27:24.180 に答える