From f9a416743401121e1bc2961402cd6f87de68ca00 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 3 Oct 2005 23:27:33 +0000 Subject: r10694: Add some work I did this afternoon on getting pidl to output Samba3 RPC parsers. Currently the following files can be generated: - include/rpc_BASENAME.h - rpc_server/srv_BASENAME.c - rpc_server/srv_BASENAME_nt.c (template only, user has to fill in functions) - rpc_client/cli_BASENAME.c - rpc_parse/parse_BASENAME.c So far, I have been working on getting DFS working. Currently still to do (all in rpc_parse/parse_BASENAME.c): - Proper handling of declarations - Proper handling of scalar/buffer parts of structs and unions - Subcontexts - Proper handling of arrays - Support for custom (non-scalar) types I hope to have a somewhat more working version later this week. Some files as currently generated are available from: http://samba.org/~jelmer/pidl_samba3/ (This used to be commit 8af8eaeeef6d46f4d25ccb1d25890e1eef063e4f) --- source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source4/pidl/lib/Parse/Pidl/Ethereal') diff --git a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm index 8441ea25b9..b497f87403 100644 --- a/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Ethereal/NDR.pm @@ -485,6 +485,8 @@ sub Union($$$) $res.="\t\tbreak;\n"; } + my $switch_type = $e->{SWITCH_TYPE}; + pidl_code "static 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 "{"; @@ -492,7 +494,7 @@ sub Union($$$) 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 "g$switch_type level;"; pidl_code ""; if ($e->{ALIGN} > 1) { @@ -511,7 +513,7 @@ sub Union($$$) pidl_code ""; - pidl_code "offset = dissect_ndr_$e->{SWITCH_TYPE}(tvb, offset, pinfo, tree, drep, hf_index, &level);"; + pidl_code "offset = dissect_ndr_$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);\n"; -- cgit