aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorMichael Mann <mmann78@netscape.net>2017-04-18 19:20:48 -0400
committerMichael Mann <mmann78@netscape.net>2017-04-19 14:01:26 +0000
commit89e0bdf36dcb33e079f6bffb14b16e90c20f13e3 (patch)
treef8e7774b86d6621c79bdee26e0c3a6dfa9e866bf /tools
parent39167ab2c99dd42497ec6f0ea7449ef635a31433 (diff)
X11: Replace VALUEXX macros and handle endianness "natively."
Change-Id: I45d4557377a445c981e6b7cfc1dbe57f586252e5 Reviewed-on: https://code.wireshark.org/review/21210 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/process-x11-xcb.pl71
1 files changed, 46 insertions, 25 deletions
diff --git a/tools/process-x11-xcb.pl b/tools/process-x11-xcb.pl
index 757050dca9..1cdfdb3f36 100755
--- a/tools/process-x11-xcb.pl
+++ b/tools/process-x11-xcb.pl
@@ -56,20 +56,20 @@ my @register;
my $script_name = File::Spec->abs2rel ($0, $srcdir);
my %basictype = (
- char => { size => 1, encoding => 'ENC_ASCII|ENC_NA', type => 'FT_STRING', base => 'BASE_NONE', get => 'VALUE8', list => 'listOfByte', },
- void => { size => 1, encoding => 'ENC_NA', type => 'FT_BYTES', base => 'BASE_NONE', get => 'VALUE8', list => 'listOfByte', },
- BYTE => { size => 1, encoding => 'ENC_NA', type => 'FT_BYTES', base => 'BASE_NONE', get => 'VALUE8', list => 'listOfByte', },
- CARD8 => { size => 1, encoding => 'byte_order', type => 'FT_UINT8', base => 'BASE_HEX_DEC', get => 'VALUE8', list => 'listOfByte', },
- CARD16 => { size => 2, encoding => 'byte_order', type => 'FT_UINT16', base => 'BASE_HEX_DEC', get => 'VALUE16', list => 'listOfCard16', },
- CARD32 => { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX_DEC', get => 'VALUE32', list => 'listOfCard32', },
- CARD64 => { size => 8, encoding => 'byte_order', type => 'FT_UINT64', base => 'BASE_HEX_DEC', get => 'VALUE64', list => 'listOfCard64', },
- INT8 => { size => 1, encoding => 'byte_order', type => 'FT_INT8', base => 'BASE_DEC', get => 'VALUE8', list => 'listOfByte', },
- INT16 => { size => 2, encoding => 'byte_order', type => 'FT_INT16', base => 'BASE_DEC', get => 'VALUE16', list => 'listOfInt16', },
- INT32 => { size => 4, encoding => 'byte_order', type => 'FT_INT32', base => 'BASE_DEC', get => 'VALUE32', list => 'listOfInt32', },
- INT64 => { size => 8, encoding => 'byte_order', type => 'FT_INT64', base => 'BASE_DEC', get => 'VALUE64', list => 'listOfInt64', },
- float => { size => 4, encoding => 'byte_order', type => 'FT_FLOAT', base => 'BASE_NONE', get => 'FLOAT', list => 'listOfFloat', },
- double => { size => 8, encoding => 'byte_order', type => 'FT_DOUBLE', base => 'BASE_NONE', get => 'DOUBLE', list => 'listOfDouble', },
- BOOL => { size => 1, encoding => 'byte_order', type => 'FT_BOOLEAN',base => 'BASE_NONE', get => 'VALUE8', list => 'listOfByte', },
+ char => { size => 1, encoding => 'ENC_ASCII|ENC_NA', type => 'FT_STRING', base => 'BASE_NONE', get => 'tvb_get_guint8', list => 'listOfByte', },
+ void => { size => 1, encoding => 'ENC_NA', type => 'FT_BYTES', base => 'BASE_NONE', get => 'tvb_get_guint8', list => 'listOfByte', },
+ BYTE => { size => 1, encoding => 'ENC_NA', type => 'FT_BYTES', base => 'BASE_NONE', get => 'tvb_get_guint8', list => 'listOfByte', },
+ CARD8 => { size => 1, encoding => 'byte_order', type => 'FT_UINT8', base => 'BASE_HEX_DEC', get => 'tvb_get_guint8', list => 'listOfByte', },
+ CARD16 => { size => 2, encoding => 'byte_order', type => 'FT_UINT16', base => 'BASE_HEX_DEC', get => 'tvb_get_guint16', list => 'listOfCard16', },
+ CARD32 => { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX_DEC', get => 'tvb_get_guint32', list => 'listOfCard32', },
+ CARD64 => { size => 8, encoding => 'byte_order', type => 'FT_UINT64', base => 'BASE_HEX_DEC', get => 'tvb_get_guint64', list => 'listOfCard64', },
+ INT8 => { size => 1, encoding => 'byte_order', type => 'FT_INT8', base => 'BASE_DEC', get => 'tvb_get_guint8', list => 'listOfByte', },
+ INT16 => { size => 2, encoding => 'byte_order', type => 'FT_INT16', base => 'BASE_DEC', get => 'tvb_get_guint16', list => 'listOfInt16', },
+ INT32 => { size => 4, encoding => 'byte_order', type => 'FT_INT32', base => 'BASE_DEC', get => 'tvb_get_guint32', list => 'listOfInt32', },
+ INT64 => { size => 8, encoding => 'byte_order', type => 'FT_INT64', base => 'BASE_DEC', get => 'tvb_get_guint64', list => 'listOfInt64', },
+ float => { size => 4, encoding => 'byte_order', type => 'FT_FLOAT', base => 'BASE_NONE', get => 'tvb_get_ieee_float', list => 'listOfFloat', },
+ double => { size => 8, encoding => 'byte_order', type => 'FT_DOUBLE', base => 'BASE_NONE', get => 'tvb_get_ieee_double', list => 'listOfDouble', },
+ BOOL => { size => 1, encoding => 'byte_order', type => 'FT_BOOLEAN',base => 'BASE_NONE', get => 'tvb_get_guint8', list => 'listOfByte', },
);
my %simpletype; # Reset at the beginning of each extension
@@ -212,7 +212,7 @@ sub mesa_type {
if($name eq 'enum') {
# enum does not have a direct X equivalent
$gltype{'GLenum'} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX|BASE_EXT_STRING',
- get => 'VALUE32', list => 'listOfCard32',
+ get => 'tvb_get_guint32', list => 'listOfCard32',
val => '&mesa_enum_ext', };
return;
}
@@ -409,7 +409,11 @@ eot
my $get = $info->{'get'};
if ($e->att('counter') or $type_param{$fieldname}) {
- print $impl " $fieldname = $get(tvb, *offsetp);\n";
+ if ($get ne "tvb_get_guint8") {
+ print $impl " $fieldname = $get(tvb, *offsetp, $encoding);\n";
+ } else {
+ print $impl " $fieldname = $get(tvb, *offsetp);\n";
+ }
}
print $impl " proto_tree_add_item(t, $regname, tvb, *offsetp, $size, $encoding);\n";
print $impl " *offsetp += $size;\n";
@@ -804,7 +808,11 @@ sub dissect_element($$$$$;$$)
say $impl "field$fieldsize(tvb, offsetp, t, $regname, byte_order);";
} elsif ($e->att('mask')) {
if ($refref->{field}{$fieldname}) {
- say $impl $indent."f_$fieldname = $get(tvb, *offsetp);";
+ if ($get ne "tvb_get_guint8") {
+ say $impl $indent."f_$fieldname = $get(tvb, *offsetp, byte_order);";
+ } else {
+ say $impl $indent."f_$fieldname = $get(tvb, *offsetp);";
+ }
}
my $bitmask_field = $fieldname . "_bits";
say $impl $indent."{";
@@ -821,7 +829,11 @@ sub dissect_element($$$$$;$$)
say $impl $indent."*offsetp += $size;";
} else {
if ($refref->{field}{$fieldname}) {
- say $impl $indent."f_$fieldname = $get(tvb, *offsetp);";
+ if ($get ne "tvb_get_guint8") {
+ say $impl $indent."f_$fieldname = $get(tvb, *offsetp, byte_order);";
+ } else {
+ say $impl $indent."f_$fieldname = $get(tvb, *offsetp);";
+ }
}
print $impl $indent."proto_tree_add_item(t, $regname, tvb, *offsetp, $size, $encoding);\n";
print $impl $indent."*offsetp += $size;\n";
@@ -870,7 +882,11 @@ sub dissect_element($$$$$;$$)
say $impl $indent."{";
say $impl $indent." int i;";
say $impl $indent." for (i = 0; i < $lencalc; i++) {";
- say $impl $indent." sumof_$fieldname += $get(tvb, *offsetp + i * $size);";
+ if ($get ne "tvb_get_guint8") {
+ say $impl $indent." sumof_$fieldname += $get(tvb, *offsetp + i * $size, byte_order);";
+ } else {
+ say $impl $indent." sumof_$fieldname += $get(tvb, *offsetp + i * $size);";
+ }
say $impl $indent." }";
say $impl $indent."}";
}
@@ -1133,7 +1149,12 @@ eot
when ('field') {
my $fname = $e->att('name');
if (defined($refs{$fname})) {
- say $impl " f_$fname = $info->{'get'}(tvb, *offsetp + size + $size);";
+ my $get = $info->{'get'};
+ if ($get ne "tvb_get_guint8") {
+ say $impl " f_$fname = $info->{'get'}(tvb, *offsetp + size + $size, byte_order);";
+ } else {
+ say $impl " f_$fname = $info->{'get'}(tvb, *offsetp + size + $size);";
+ }
}
$size += $info->{'size'};
}
@@ -1428,13 +1449,13 @@ eot
$length = dissect_element($e, $varpat, $humanpat, $length, $refs);
if ($first) {
$first = 0;
- say $impl ' sequence_number = VALUE16(tvb, *offsetp);';
+ say $impl ' sequence_number = tvb_get_guint16(tvb, *offsetp, byte_order);';
say $impl ' proto_tree_add_uint_format_value(t, hf_x11_reply_sequencenumber, tvb, *offsetp, 2, sequence_number,';
say $impl ' "%d ('.$header.'-'.$name.')", sequence_number);';
say $impl ' *offsetp += 2;';
if ($refs->{field}{length}) {
- say $impl ' f_length = VALUE32(tvb, *offsetp);';
+ say $impl ' f_length = tvb_get_guint32(tvb, *offsetp, byte_order);';
}
if ($refs->{length}) {
say $impl ' length = f_length * 4 + 32;';
@@ -1455,7 +1476,7 @@ sub defxid(@) {
my $name;
while ($name = shift) {
my $qualname = qualname($name);
- $simpletype{$qualname} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX', get => 'VALUE32', list => 'listOfCard32', };
+ $simpletype{$qualname} = { size => 4, encoding => 'byte_order', type => 'FT_UINT32', base => 'BASE_HEX', get => 'tvb_get_guint32', list => 'listOfCard32', };
$type_name{$name} = $qualname;
}
}
@@ -1857,9 +1878,9 @@ static void dispatch_glx_render(tvbuff_t *tvb, packet_info *pinfo, int *offsetp,
proto_item *ti;
proto_tree *tt;
- len = VALUE16(tvb, *offsetp);
+ len = tvb_get_guint16(tvb, *offsetp, byte_order);
- op = VALUE16(tvb, *offsetp + 2);
+ op = tvb_get_guint16(tvb, *offsetp + 2, byte_order);
ti = proto_tree_add_uint(t, hf_x11_glx_render_op_name, tvb, *offsetp, len, op);
tt = proto_item_add_subtree(ti, ett_x11_list_of_rectangle);