r9682: Jelmer, I think this fixes another case where the parser generator was
[samba.git] / source / pidl / lib / Parse / Pidl / Ethereal / NDR.pm
index 7a7db4280e1aeb8ac22d03a96d7339bef0f6b1e7..60b237110880ad1bfdf701a05152a2f6eb6d0231 100644 (file)
@@ -16,6 +16,8 @@ use Parse::Pidl::Dump qw(DumpTypedef DumpFunction);
 use Parse::Pidl::Ethereal::Conformance qw(ReadConformance);
 
 my %types;
+my %hf;
+my @ett;
 
 my $conformance = {imports=>{}};
 
@@ -95,6 +97,8 @@ sub PrintIdl($)
        foreach (split /\n/, $idl) {
                pidl_code "/* IDL: $_ */";
        }
+
+       pidl_code "";
 }
 
 #####################################################################
@@ -111,7 +115,8 @@ sub Enum($$$)
 {
        my ($e,$name,$ifname) = @_;
        my $valsstring = "$ifname\_$name\_vals";
-       my $dissectorname = "$ifname\_dissect\_".StripPrefixes($name);
+       my $dissectorname = "$ifname\_dissect\_".StripPrefixes($name)."_enum";
+
        return if (defined($conformance->{noemit}->{$dissectorname}));
 
        foreach (@{$e->{ELEMENTS}}) {
@@ -136,32 +141,31 @@ sub Enum($$$)
        pidl_code "$dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, guint32 param _U_)";
        pidl_code "{";
        indent;
-       pidl_code "offset=dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, tree, drep, hf_index, NULL);";
+       pidl_code "offset = dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, tree, drep, hf_index, NULL);";
        pidl_code "return offset;";
        deindent;
        pidl_code "}\n";
 
        my $enum_size = $e->{BASE_TYPE};
        $enum_size =~ s/uint//g;
-       register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", type2ft($e->{BASE_TYPE}), "BASE_DEC", "0", "VALS($valsstring)", $enum_size / 8);
+       register_type($name, "offset = $dissectorname(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);", type2ft($e->{BASE_TYPE}), "BASE_DEC", "0", "VALS($valsstring)", $enum_size / 8);
 }
 
 sub Bitmap($$$)
 {
        my ($e,$name,$ifname) = @_;
-       my $dissectorname = "$ifname\_dissect\_".StripPrefixes($name);
+       my $dissectorname = "$ifname\_dissect\_".StripPrefixes($name)."_bitmap";
 
        register_ett("ett_$ifname\_$name");
 
-
        pidl_hdr "int $dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep, int hf_index, guint32 param);";
 
        pidl_code "int";
        pidl_code "$dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, guint8 *drep, int hf_index, guint32 param _U_)";
        pidl_code "{";
        indent;
-       pidl_code "proto_item *item=NULL;";
-       pidl_code "proto_tree *tree=NULL;";
+       pidl_code "proto_item *item = NULL;";
+       pidl_code "proto_tree *tree = NULL;";
        pidl_code "";
                
        pidl_code "g$e->{BASE_TYPE} flags;";
@@ -173,12 +177,12 @@ sub Bitmap($$$)
 
        pidl_code "if(parent_tree) {";
        indent;
-       pidl_code "item=proto_tree_add_item(parent_tree, hf_index, tvb, offset, $e->{ALIGN}, TRUE);";
-       pidl_code "tree=proto_item_add_subtree(item,ett_$ifname\_$name);";
+       pidl_code "item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, $e->{ALIGN}, TRUE);";
+       pidl_code "tree = proto_item_add_subtree(item,ett_$ifname\_$name);";
        deindent;
        pidl_code "}\n";
 
-       pidl_code "offset=dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, NULL, drep, -1, &flags);";
+       pidl_code "offset = dissect_ndr_$e->{BASE_TYPE}(tvb, offset, pinfo, NULL, drep, -1, &flags);";
 
        pidl_code "proto_item_append_text(item, \": \");\n";
        pidl_code "if (!flags)";
@@ -199,7 +203,7 @@ sub Bitmap($$$)
                
                pidl_code "proto_tree_add_boolean(tree, $hf_bitname, tvb, offset-$e->{ALIGN}, $e->{ALIGN}, flags);";
                pidl_code "if (flags&$ev){";
-               pidl_code "\tproto_item_append_text(item,\"$en\");";
+               pidl_code "\tproto_item_append_text(item, \"$en\");";
                pidl_code "\tif (flags & (~$ev))";
                pidl_code "\t\tproto_item_append_text(item, \", \");";
                pidl_code "}";
@@ -216,7 +220,7 @@ sub Bitmap($$$)
 
        my $size = $e->{BASE_TYPE};
        $size =~ s/uint//g;
-       register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", type2ft($e->{BASE_TYPE}), "BASE_DEC", "0", "NULL", $size/8);
+       register_type($name, "offset = $dissectorname(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);", type2ft($e->{BASE_TYPE}), "BASE_DEC", "0", "NULL", $size/8);
 }
 
 sub ElementLevel($$$$$)
@@ -236,7 +240,7 @@ sub ElementLevel($$$$$)
                } elsif ($l->{LEVEL} eq "EMBEDDED") {
                        $type = "embedded";
                }
-               pidl_code "offset=dissect_ndr_$type\_pointer(tvb,offset,pinfo,tree,drep,$myname\_,$ptrtype_mappings{$l->{POINTER_TYPE}},\"Pointer to ".field2name(StripPrefixes($e->{NAME})) . " ($e->{TYPE})\",$hf);";
+               pidl_code "offset = dissect_ndr_$type\_pointer(tvb, offset, pinfo, tree, drep, $myname\_, $ptrtype_mappings{$l->{POINTER_TYPE}}, \"Pointer to ".field2name(StripPrefixes($e->{NAME})) . " ($e->{TYPE})\",$hf);";
        } elsif ($l->{TYPE} eq "ARRAY") {
                
                if ($l->{IS_INLINE}) {
@@ -245,14 +249,14 @@ sub ElementLevel($$$$$)
                } elsif ($l->{IS_FIXED}) {
                        pidl_code "int i;";
                        pidl_code "for (i = 0; i < $l->{SIZE_IS}; i++)";
-                       pidl_code "\toffset=$myname\_(tvb,offset,pinfo,tree,drep);";
+                       pidl_code "\toffset = $myname\_(tvb, offset, pinfo, tree, drep);";
                } else {
                        my $af = "";
                        ($af = "ucarray") if ($l->{IS_CONFORMANT});
                        ($af = "uvarray") if ($l->{IS_VARYING});
                        ($af = "ucvarray") if ($l->{IS_CONFORMANT} and $l->{IS_VARYING});
 
-                       pidl_code "offset=dissect_ndr_$af(tvb,offset,pinfo,tree,drep,$myname\_);";
+                       pidl_code "offset = dissect_ndr_$af(tvb, offset, pinfo, tree, drep, $myname\_);";
                }
        } elsif ($l->{TYPE} eq "DATA") {
                if ($l->{DATA_TYPE} eq "string") {
@@ -263,10 +267,10 @@ sub ElementLevel($$$$$)
                        
                        if (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*") and property_matches($e, "flag", ".*LIBNDR_FLAG_STR_LEN4.*")) {
                                pidl_code "char *data;\n";
-                               pidl_code "offset=dissect_ndr_cvstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,&data);";
+                               pidl_code "offset = dissect_ndr_cvstring(tvb, offset, pinfo, tree, drep, $bs, $hf, FALSE, &data);";
                                pidl_code "proto_item_append_text(tree, \": %s\", data);";
                        } elsif (property_matches($e, "flag", ".*LIBNDR_FLAG_STR_SIZE4.*")) {
-                               pidl_code "offset=dissect_ndr_vstring(tvb,offset,pinfo,tree,drep,$bs,$hf,FALSE,NULL);";
+                               pidl_code "offset = dissect_ndr_vstring(tvb, offset, pinfo, tree, drep, $bs, $hf, FALSE, NULL);";
                        } else {
                                warn("Unable to handle string with flags $e->{PROPERTIES}->{flag}");
                        }
@@ -278,11 +282,9 @@ sub ElementLevel($$$$$)
                        } elsif ($conformance->{imports}->{$l->{DATA_TYPE}}) {
                                $call = $conformance->{imports}->{$l->{DATA_TYPE}};     
                        } else {
-                               warn("Unknown data type `$l->{DATA_TYPE}'");
-                               pidl_code "/* FIXME: Handle unknown data type $l->{DATA_TYPE} */";
                                if ($l->{DATA_TYPE} =~ /^([a-z]+)\_(.*)$/)
                                {
-                                       pidl_code "offset=$1_dissect_$2(tvb,offset,pinfo,tree,drep,$hf,$param);";
+                                       pidl_code "offset = $1_dissect_$2(tvb,offset,pinfo,tree,drep,$hf,$param);";
                                }
 
                                return;
@@ -295,13 +297,13 @@ sub ElementLevel($$$$$)
        } elsif ($_->{TYPE} eq "SUBCONTEXT") {
                my $num_bits = ($l->{HEADER_SIZE}*8);
                pidl_code "guint$num_bits size;";
-               pidl_code "int start_offset=offset;";
+               pidl_code "int start_offset = offset;";
                pidl_code "tvbuff_t *subtvb;";
-               pidl_code "offset=dissect_ndr_uint$num_bits(tvb,offset,pinfo,tree,drep,$hf,&size);";
-               pidl_code "proto_tree_add_text(tree,tvb,start_offset,offset-start_offset+size,\"Subcontext size\");";
+               pidl_code "offset = dissect_ndr_uint$num_bits(tvb, offset, pinfo, tree, drep, $hf, &size);";
+               pidl_code "proto_tree_add_text(tree, tvb, start_offset, offset - start_offset + size, \"Subcontext size\");";
 
-               pidl_code "subtvb = tvb_new_subset(tvb,offset,size,-1);";
-               pidl_code "$myname\_(subtvb,0,pinfo,tree,drep);";
+               pidl_code "subtvb = tvb_new_subset(tvb, offset, size, -1);";
+               pidl_code "$myname\_(subtvb, 0, pinfo, tree, drep);";
        } else {
                die("Unknown type `$_->{TYPE}'");
        }
@@ -313,7 +315,7 @@ sub Element($$$)
 
        my $dissectorname = "$ifname\_dissect\_".StripPrefixes($pn)."\_".StripPrefixes($e->{NAME});
 
-       my $call_code = "offset=$dissectorname(tvb,offset,pinfo,tree,drep);";
+       my $call_code = "offset = $dissectorname(tvb, offset, pinfo, tree, drep);";
 
        my $hf = register_hf_field("hf_$ifname\_$pn\_$e->{NAME}", field2name($e->{NAME}), "$ifname.$pn.$e->{NAME}", type2ft($e->{TYPE}), "BASE_HEX", "NULL", 0, "");
 
@@ -324,7 +326,7 @@ sub Element($$$)
        my $add = "";
 
        foreach (@{$e->{LEVELS}}) {
-               next if ($_->{TYPE} eq "SWITCH");
+               last if ($_->{TYPE} eq "SWITCH");
                pidl_def "static int $dissectorname$add(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep);";
                pidl_code "static int";
                pidl_code "$dissectorname$add(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, guint8 *drep)";
@@ -333,6 +335,7 @@ sub Element($$$)
 
                ElementLevel($e,$_,$hf,$dissectorname.$add,$pn);
 
+               pidl_code "";
                pidl_code "return offset;";
                deindent;
                pidl_code "}\n";
@@ -349,7 +352,7 @@ sub Function($$$)
        my %dissectornames;
 
        foreach (@{$fn->{ELEMENTS}}) {
-               $dissectornames{$_->{NAME}} = Element($_, $fn->{NAME}, $ifname) 
+           $dissectornames{$_->{NAME}} = Element($_, $fn->{NAME}, $ifname) if not defined($dissectornames{$_->{NAME}});
        }
        
        my $fn_name = $_->{NAME};
@@ -363,16 +366,16 @@ sub Function($$$)
        foreach (@{$fn->{ELEMENTS}}) {
                if (grep(/out/,@{$_->{DIRECTION}})) {
                        pidl_code "$dissectornames{$_->{NAME}}";
-                       pidl_code "offset=dissect_deferred_pointers(pinfo,tvb,offset,drep);";
+                       pidl_code "offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);";
                        pidl_code "";
                }
        }
 
        if (not defined($fn->{RETURN_TYPE})) {
        } elsif ($fn->{RETURN_TYPE} eq "NTSTATUS") {
-               pidl_code "offset=dissect_ntstatus(tvb,offset,pinfo,tree,drep,hf\_$ifname\_status, NULL);";
+               pidl_code "offset = dissect_ntstatus(tvb, offset, pinfo, tree, drep, hf\_$ifname\_status, NULL);";
        } elsif ($fn->{RETURN_TYPE} eq "WERROR") {
-               pidl_code "offset=dissect_ndr_uint32(tvb,offset,pinfo,tree,drep,hf\_$ifname\_werror, NULL);";
+               pidl_code "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, hf\_$ifname\_werror, NULL);";
        }
 
        pidl_code "return offset;";
@@ -386,7 +389,7 @@ sub Function($$$)
        foreach (@{$fn->{ELEMENTS}}) {
                if (grep(/in/,@{$_->{DIRECTION}})) {
                        pidl_code "$dissectornames{$_->{NAME}}";
-                       pidl_code "offset=dissect_deferred_pointers(pinfo,tvb,offset,drep);";
+                       pidl_code "offset = dissect_deferred_pointers(pinfo, tvb, offset, drep);";
                }
 
        }
@@ -424,23 +427,23 @@ sub Struct($$$)
        }
        pidl_code "";
 
-       pidl_code "old_offset=offset;";
+       pidl_code "old_offset = offset;";
        pidl_code "";
        pidl_code "if(parent_tree){";
        indent;
-       pidl_code "item=proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);";
-       pidl_code "tree=proto_item_add_subtree(item, ett_$ifname\_$name);";
+       pidl_code "item = proto_tree_add_item(parent_tree, hf_index, tvb, offset, -1, TRUE);";
+       pidl_code "tree = proto_item_add_subtree(item, ett_$ifname\_$name);";
        deindent;
        pidl_code "}";
 
        pidl_code "\n$res";
 
-       pidl_code "proto_item_set_len(item, offset-old_offset);";
+       pidl_code "proto_item_set_len(item, offset-old_offset);\n";
        pidl_code "return offset;";
        deindent;
        pidl_code "}\n";
 
-       register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", "FT_NONE", "BASE_NONE", 0, "NULL", 0);
+       register_type($name, "offset = $dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", "FT_NONE", "BASE_NONE", 0, "NULL", 0);
 }
 
 sub Union($$$)
@@ -465,8 +468,8 @@ sub Union($$$)
        pidl_code "$dissectorname(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *parent_tree, guint8 *drep, int hf_index, guint32 param _U_)";
        pidl_code "{";
        indent;
-       pidl_code "proto_item *item=NULL;";
-       pidl_code "proto_tree *tree=NULL;";
+       pidl_code "proto_item *item = NULL;";
+       pidl_code "proto_tree *tree = NULL;";
        pidl_code "int old_offset;";
        pidl_code "g$e->{SWITCH_TYPE} level;";
        pidl_code "";
@@ -477,11 +480,11 @@ sub Union($$$)
 
        pidl_code "";
 
-       pidl_code "old_offset=offset;";
+       pidl_code "old_offset = offset;";
        pidl_code "if(parent_tree){";
        indent;
-       pidl_code "item=proto_tree_add_text(parent_tree,tvb,offset,-1,\"$name\");";
-       pidl_code "tree=proto_item_add_subtree(item,ett_$ifname\_$name);";
+       pidl_code "item = proto_tree_add_text(parent_tree, tvb, offset, -1, \"$name\");";
+       pidl_code "tree = proto_item_add_subtree(item, ett_$ifname\_$name);";
        deindent;
        pidl_code "}";
 
@@ -490,12 +493,12 @@ sub Union($$$)
        pidl_code "offset = dissect_ndr_$e->{SWITCH_TYPE}(tvb, offset, pinfo, tree, drep, hf_index, &level);";
 
        pidl_code "switch(level) {$res\t}";
-       pidl_code "proto_item_set_len(item, offset-old_offset);";
+       pidl_code "proto_item_set_len(item, offset-old_offset);\n";
        pidl_code "return offset;";
        deindent;
        pidl_code "}";
 
-       register_type($name, "offset=$dissectorname(tvb,offset,pinfo,tree,drep,\@HF\@,\@PARAM\@);", "FT_NONE", "BASE_NONE", 0, "NULL", 0);
+       register_type($name, "offset = $dissectorname(tvb, offset, pinfo, tree, drep, \@HF\@, \@PARAM\@);", "FT_NONE", "BASE_NONE", 0, "NULL", 0);
 }
 
 sub Const($$)
@@ -539,7 +542,7 @@ sub RegisterInterface($)
            # in epan/dissctors are deleted.
     
            my $name = "\"" . uc($x->{NAME}) . " (pidl)\"";
-           my $short_name = $x->{NAME};
+           my $short_name = uc($x->{NAME});
            my $filter_name = $x->{NAME};
 
            if (has_property($x, "helpstring")) {
@@ -569,14 +572,17 @@ sub RegisterInterface($)
 sub RegisterInterfaceHandoff($)
 {
        my $x = shift;
-       pidl_code "void proto_reg_handoff_dcerpc_$x->{NAME}(void)";
-       pidl_code "{";
-       indent;
-       pidl_code "dcerpc_init_uuid(proto_dcerpc_$x->{NAME}, ett_dcerpc_$x->{NAME},";
-       pidl_code "\t&uuid_dcerpc_$x->{NAME}, ver_dcerpc_$x->{NAME},";
-       pidl_code "\t$x->{NAME}_dissectors, hf_$x->{NAME}_opnum);";
-       deindent;
-       pidl_code "}";
+
+       if (defined($x->{UUID})) {
+           pidl_code "void proto_reg_handoff_dcerpc_$x->{NAME}(void)";
+           pidl_code "{";
+           indent;
+           pidl_code "dcerpc_init_uuid(proto_dcerpc_$x->{NAME}, ett_dcerpc_$x->{NAME},";
+           pidl_code "\t&uuid_dcerpc_$x->{NAME}, ver_dcerpc_$x->{NAME},";
+           pidl_code "\t$x->{NAME}_dissectors, hf_$x->{NAME}_opnum);";
+           deindent;
+           pidl_code "}";
+       }
 }
 
 sub ProcessInterface($)
@@ -661,49 +667,64 @@ sub Initialize($)
 
        $conformance = {};
 
-       ReadConformance($cnf_file, $conformance) or print "Warning: Not using conformance file `$cnf_file'\n";
+       ReadConformance($cnf_file, $conformance) or print "Warning: No conformance file `$cnf_file'\n";
        
        foreach my $bytes (qw(1 2 4 8)) {
                my $bits = $bytes * 8;
-               register_type("uint$bits", "offset=dissect_ndr_uint$bits(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);", "FT_UINT$bits", "BASE_DEC", 0, "NULL", $bytes);
-               register_type("int$bits", "offset=dissect_ndr_uint$bits(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);", "FT_INT$bits", "BASE_DEC", 0, "NULL", $bytes);
+               register_type("uint$bits", "offset = dissect_ndr_uint$bits(tvb, offset, pinfo, tree, drep, \@HF\@,NULL);", "FT_UINT$bits", "BASE_DEC", 0, "NULL", $bytes);
+               register_type("int$bits", "offset = dissect_ndr_uint$bits(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);", "FT_INT$bits", "BASE_DEC", 0, "NULL", $bytes);
        }
                
-       register_type("udlong", "offset=dissect_ndr_duint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);", "FT_UINT64", "BASE_DEC", 0, "NULL", 4);
-       register_type("bool8", "offset=dissect_ndr_uint8(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT8", "BASE_DEC", 0, "NULL", 1);
-       register_type("char", "offset=dissect_ndr_uint8(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT8", "BASE_DEC", 0, "NULL", 1);
-       register_type("long", "offset=dissect_ndr_uint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT32", "BASE_DEC", 0, "NULL", 4);
-       register_type("dlong", "offset=dissect_ndr_duint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_INT64", "BASE_DEC", 0, "NULL", 8);
-       register_type("GUID", "offset=dissect_ndr_uuid_t(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_GUID", "BASE_NONE", 0, "NULL", 4);
-       register_type("policy_handle", "offset=dissect_nt_policy_hnd(tvb,offset,pinfo,tree,drep,\@HF\@,NULL,NULL,\@PARAM\@&0x01,\@PARAM\@&0x02);","FT_BYTES", "BASE_NONE", 0, "NULL", 4);
-       register_type("NTTIME", "offset=dissect_ndr_nt_NTTIME(tvb,offset,pinfo,tree,drep,\@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4);
-       register_type("NTTIME_hyper", "offset=dissect_ndr_nt_NTTIME(tvb,offset,pinfo,tree,drep,\@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4);
-       register_type("time_t", "offset=dissect_ndr_time_t(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_ABSOLUTE_TIME", "BASE_DEC", 0, "NULL", 4);
-       register_type("NTTIME_1sec", "offset=dissect_ndr_nt_NTTIME(tvb,offset,pinfo,tree,drep,\@HF\@);", "FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4);
+       register_type("udlong", "offset = dissect_ndr_duint32(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);", "FT_UINT64", "BASE_DEC", 0, "NULL", 4);
+       register_type("bool8", "offset = dissect_ndr_uint8(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_INT8", "BASE_DEC", 0, "NULL", 1);
+       register_type("char", "offset = dissect_ndr_uint8(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_INT8", "BASE_DEC", 0, "NULL", 1);
+       register_type("long", "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_INT32", "BASE_DEC", 0, "NULL", 4);
+       register_type("dlong", "offset = dissect_ndr_duint32(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_INT64", "BASE_DEC", 0, "NULL", 8);
+       register_type("GUID", "offset = dissect_ndr_uuid_t(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_GUID", "BASE_NONE", 0, "NULL", 4);
+       register_type("policy_handle", "offset = dissect_nt_policy_hnd(tvb, offset, pinfo, tree, drep, \@HF\@, NULL, NULL, \@PARAM\@&0x01, \@PARAM\@&0x02);","FT_BYTES", "BASE_NONE", 0, "NULL", 4);
+       register_type("NTTIME", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4);
+       register_type("NTTIME_hyper", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);","FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4);
+       register_type("time_t", "offset = dissect_ndr_time_t(tvb, offset, pinfo,tree, drep, \@HF\@, NULL);","FT_ABSOLUTE_TIME", "BASE_DEC", 0, "NULL", 4);
+       register_type("NTTIME_1sec", "offset = dissect_ndr_nt_NTTIME(tvb, offset, pinfo, tree, drep, \@HF\@);", "FT_ABSOLUTE_TIME", "BASE_NONE", 0, "NULL", 4);
        register_type("SID", "
                dcerpc_info *di = (dcerpc_info *)pinfo->private_data;
 
                di->hf_index = \@HF\@;
 
-               offset=dissect_ndr_nt_SID_with_options(tvb,offset,pinfo,tree,drep,param);
+               offset = dissect_ndr_nt_SID_with_options(tvb, offset, pinfo, tree, drep, param);
        ","FT_STRING", "BASE_DEC", 0, "NULL", 4);
        register_type("WERROR", 
-               "offset=dissect_ndr_uint32(tvb,offset,pinfo,tree,drep,\@HF\@,NULL);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4);
+               "offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, drep, \@HF\@, NULL);","FT_UINT32", "BASE_DEC", 0, "VALS(NT_errors)", 4);
 
 }
 
 #####################################################################
 # Generate ethereal parser and header code
-sub Parse($$)
+sub Parse($$$$)
 {
-       my($ndr,$h_filename,$cnf_file) = @_;
+       my($ndr,$idl_file,$h_filename,$cnf_file) = @_;
        Initialize($cnf_file);
 
        $tabs = "";
 
        %res = (code=>"",def=>"",hdr=>"");
+       %hf = ();
+       @ett = ();
 
-       pidl_hdr "/* header auto-generated by pidl */";
+       my $notice = 
+"/* DO NOT EDIT
+       This filter was automatically generated
+       from $idl_file and $cnf_file.
+       
+       Pidl is a perl based IDL compiler for DCE/RPC idl files. 
+       It is maintained by the Samba team, not the Ethereal team.
+       Instructions on how to download and install Pidl can be 
+       found at http://wiki.ethereal.com/Pidl
+*/
+
+";
+
+       pidl_hdr $notice;
 
        $res{headers} = "\n";
        $res{headers} .= "#ifdef HAVE_CONFIG_H\n";
@@ -730,7 +751,7 @@ sub Parse($$)
        $res{ett} = DumpEttDeclaration();
        $res{hf} = DumpHfDeclaration();
 
-       my $parser = "/* parser auto-generated by pidl */";
+       my $parser = $notice;
        $parser.= $res{headers};
        $parser.=$res{ett};
        $parser.=$res{hf};
@@ -748,8 +769,6 @@ sub Parse($$)
 # ETT
 ###############################################################################
 
-my @ett = ();
-
 sub register_ett($)
 {
        my $name = shift;
@@ -781,8 +800,6 @@ sub DumpEttDeclaration()
 # HF
 ###############################################################################
 
-my %hf = ();
-
 sub register_hf_field($$$$$$$$) 
 {
        my ($index,$name,$filter_name,$ft_type,$base_type,$valsstring,$mask,$blurb) = @_;