pidl-wireshark: generate ALIGN_TO_x_BYTES instructions if the element has the align_x...
authorMatthieu Patou <mat@matws.net>
Fri, 18 Oct 2013 07:04:28 +0000 (00:04 -0700)
committerStefan Metzmacher <metze@samba.org>
Thu, 23 Oct 2014 21:12:05 +0000 (23:12 +0200)
Signed-off-by: Matthieu Patou <mat@matws.net>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
pidl/lib/Parse/Pidl/Wireshark/NDR.pm

index 6bc03ccd9b96abb478ce8a741059e618180ac0d2..7a81f5ca5a9be32a7eb7ce32885772853477d29d 100644 (file)
@@ -462,6 +462,12 @@ sub Element($$$$$)
                        BASE_TYPE => "BASE_NONE"
                };
        }
                        BASE_TYPE => "BASE_NONE"
                };
        }
+       if (property_matches($e, "flag", ".*LIBNDR_FLAG_ALIGN.*")) {
+               my $align_flag = $e->{PROPERTIES}->{flag};
+               if ($align_flag =~ m/LIBNDR_FLAG_ALIGN(\d+)/) {
+                       $call_code = "ALIGN_TO_$1_BYTES; ".$call_code;
+               }
+       }
 
        my $hf = $self->register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", $type->{FT_TYPE}, $type->{BASE_TYPE}, $type->{VALSSTRING}, $type->{MASK}, "");
        $self->{hf_used}->{$hf} = 1;
 
        my $hf = $self->register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", $type->{FT_TYPE}, $type->{BASE_TYPE}, $type->{VALSSTRING}, $type->{MASK}, "");
        $self->{hf_used}->{$hf} = 1;