1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
6 <refentrytitle>pidl</refentrytitle>
7 <manvolnum>1</manvolnum>
11 <refname>pidl</refname>
12 <refpurpose>IDL Compiler written in Perl</refpurpose>
17 <command>pidl</command>
18 <arg choice="opt">--help</arg>
19 <arg choice="opt">--outputdir OUTNAME</arg>
20 <arg choice="opt">--parse</arg>
21 <arg choice="opt">--dump</arg>
22 <arg choice="opt">--ndr-header[=OUTPUT]</arg>
23 <arg choice="opt">--header[=OUTPUT]</arg>
24 <arg choice="opt">--ejs[=OUTPUT]</arg>
25 <arg choice="opt">--swig[=OUTPUT]</arg>
26 <arg choice="opt">--uint-enums</arg>
27 <arg choice="opt">--ndr-parser[=OUTPUT]</arg>
28 <arg choice="opt">--client</arg>
29 <arg choice="opt">--server</arg>
30 <arg choice="opt">--dcom-proxy</arg>
31 <arg choice="opt">--com-header</arg>
32 <arg choice="opt">--odl</arg>
33 <arg choice="opt">--warn-compat</arg>
34 <arg choice="opt">--quiet</arg>
35 <arg choice="opt">--verbose</arg>
36 <arg choice="opt">--template</arg>
37 <arg choice="opt">--eth-parser[=OUTPUT]</arg>
38 <arg choice="opt">--diff</arg>
39 <arg choice="opt">--keep</arg>
40 <arg choice="req">idlfile</arg>
41 <arg choice="opt">idlfile2</arg>
42 <arg choice="opt">...</arg>
47 <title>DESCRIPTION</title>
49 <para>pidl is an IDL compiler written in Perl that aims to be somewhat
50 compatible with the midl compiler. IDL stands for
51 "Interface Definition Language".</para>
53 <para>pidl can generate stubs for DCE/RPC server code, DCE/RPC
54 client code and ethereal dissectors for DCE/RPC traffic.</para>
56 <para>IDL compilers like <emphasis>pidl</emphasis> take a description
57 of an interface as their input and use it to generate C
58 (though support for other languages may be added later) code that
59 can use these interfaces, pretty print data sent
60 using these interfaces, or even generate ethereal
61 dissectors that can parse data sent over the
62 wire by these interfaces. </para>
64 <para>pidl takes IDL files in the same format as is used by midl,
65 converts it to a .pidl file (which contains pidl's internal representation of the interface) and can then generate whatever output you need.
66 .pidl files should be used for debugging purposes only. Write your
67 interface definitions in .idl format.
71 The goal of pidl is to implement a IDL compiler that can be used
72 while developing the RPC subsystem in Samba (for
73 both marshalling/unmarshalling and debugging purposes).
79 <title>OPTIONS</title>
85 Show list of available options.</para></listitem>
89 <term>--outputdir OUTNAME</term>
90 <listitem><para>Write output files to the specified directory.
91 Defaults to the current directory.
98 Tell pidl the files specified are (midl-style) IDL files.</para></listitem>
105 Convert .pidl files to (midl-style) IDL files. FIle will be named OUTNAME.idl.</para></listitem>
110 <term>--header</term>
112 Generate a C header file for the specified interface. Filename defaults to OUTNAME.h.</para></listitem>
116 <term>--ndr-header</term>
118 Generate a C header file with the prototypes for the NDR parsers. Filename defaults to ndr_OUTNAME.h.</para></listitem>
122 <term>--ndr-parser</term>
124 Generate a C file containing NDR parsers.
125 Filename defaults to ndr_OUTNAME.c.
131 <term>--server</term>
133 Generate boilerplate for the RPC server that implements
134 the interface. Filename defaults to ndr_OUTNAME_s.c</para></listitem>
139 <term>--template</term>
141 Generate stubs for a RPC server that implements
142 the interface. Output will be written to stdout.
148 <term>--eth-parser</term>
150 Generate an Ethereal dissector (in C) for the interface. Filename
151 defaults to packet-dcerpc-OUTNAME.c.
154 <para>Pidl will read additional data
155 from an ethereal conformance file if present. Such a file should
156 have the same location as the IDL file but with the extension
157 <quote>cnf</quote> rather then <quote>idl</quote>. See
158 below for details on the format of this file.
165 Convert an IDL file to a pidl file and then back to a
166 IDL file and see if there are any differences with the
167 original IDL file. Useful for debugging pidl.</para></listitem>
174 Tell pidl to keep the pidl files (used as intermediate files
175 between the IDL files and the parser/server/etc code). Useful
176 for debugging pidl.</para></listitem>
182 <title>IDL SYNTAX</title>
184 <para>IDL files are always preprocessed using the C preprocessor.</para>
186 <para>Pretty much everything in an interface (the interface itself,
187 functions, parameters) can have attributes (or properties
188 whatever name you give them). Attributes
189 always prepend the element they apply to and are surrounded
190 by square brackets ([]). Multiple attributes
191 are separated by comma's; arguments to attributes are
192 specified between parentheses. </para>
194 <para>See the section COMPATIBILITY for the list of attributes that
195 pidl supports.</para>
197 <para>C-style comments can be used.</para>
200 <title>CONFORMANT ARRAYS</title>
203 A conformant array is one with that ends in [*] or []. The strange
204 things about conformant arrays are:
208 <member>they can only appear as the last element of a structure</member>
209 <member>the array size appears before the structure itself on the wire. </member>
221 [size_is(count)] long s[*];
226 it appears like this:
230 [size_is] [abc] [count] [foo] [s...]
234 the first [size_is] field is the allocation size of the array, and
235 occurs before the array elements and even before the structure
240 Note that size_is() can refer to a constant, but that doesn't change
241 the wire representation. It does not make the array a fixed array.
245 midl.exe would write the above array as the following C header:
258 pidl takes a different approach, and writes it like this:
273 <title>VARYING ARRAYS</title>
276 A varying array looks like this:
284 [size_is(count)] long *s;
289 This will look like this on the wire:
293 [abc] [count] [foo] [PTR_s] [count] [s...]
299 <title>FIXED ARRAYS</title>
302 A fixed array looks like this:
312 The NDR representation looks just like 10 separate long
313 declarations. The array size is not encoded on the wire.
317 pidl also supports "inline" arrays, which are not part of the IDL/NDR
318 standard. These are declared like this:
331 This appears like this:
335 [foo] [count] [bar] [s...]
339 Fixed arrays are an extension added to support some of the strange
340 embedded structures in security descriptors and spoolss.
345 <para>This section is by no means complete. See the OpenGroup and MSDN
346 documentation for additional information.</para>
350 <title>COMPATIBILITY WITH MIDL</title>
353 <title>Asynchronous communication</title>
359 <title>Typelibs (.tlb files)</title>
365 <title>Datagram support</title>
367 <para>ncadg is not supported yet.</para>
371 <title>Supported properties (attributes is the MIDL term)</title>
374 in, out, ref, length_is, switch_is, size_is, uuid, case, default, string, unique, ptr, pointer_default, v1_enum, object, helpstring, range, local, call_as, endpoint, switch_type, progid, coclass, iid_is.
380 <title>PIDL Specific properties</title>
383 <varlistentry><term>public</term>
385 The [public] property on a structure or union is a pidl extension that
386 forces the generated pull/push functions to be non-static. This allows
387 you to declare types that can be used between modules. If you don't
388 specify [public] then pull/push functions for other than top-level
389 functions are declared static.
393 <varlistentry><term>noprint</term>
395 The [noprint] property is a pidl extension that allows you to specify
396 that pidl should not generate a ndr_print_*() function for that
397 structure or union. This is used when you wish to define your own
398 print function that prints a structure in a nicer manner. A good
399 example is the use of [noprint] on dom_sid, which allows the
400 pretty-printing of SIDs.
404 <varlistentry><term>value</term>
406 The [value(expression)] property is a pidl extension that allows you
407 to specify the value of a field when it is put on the wire. This
408 allows fields that always have a well-known value to be automatically
409 filled in, thus making the API more programmer friendly. The
410 expression can be any C expression.
414 <varlistentry><term>relative</term>
416 The [relative] property can be supplied on a pointer. When it is used
417 it declares the pointer as a spoolss style "relative" pointer, which
418 means it appears on the wire as an offset within the current
419 encapsulating structure. This is not part of normal IDL/NDR, but it is
420 a very useful extension as it avoids the manual encoding of many
425 <varlistentry><term>subcontext(length)</term>
427 Specifies that a size of <replaceable>length</replaceable>
428 bytes should be read, followed by a blob of that size,
429 which will be parsed as NDR.
433 <varlistentry><term>flag</term>
435 Specify boolean options, mostly used for
436 low-level NDR options. Several options
437 can be specified using the | character.
438 Note that flags are inherited by substructures!
442 <varlistentry><term>nodiscriminant</term>
444 The [nodiscriminant] property on a union means that the usual uint16
445 discriminent field at the start of the union on the wire is
446 omitted. This is not normally allowed in IDL/NDR, but is used for some
451 <varlistentry><term>charset(name)</term>
453 Specify that the array or string uses the specified
454 charset. If this attribute is specified, pidl will
455 take care of converting the character data from this format
456 to the host format. Commonly used values are UCS2, DOS and UTF8.
463 <title>Unsupported MIDL properties</title>
465 <para>aggregatable, appobject, async_uuid, bindable, control, cpp_quote, defaultbind, defaultcollelem, defaultvalue, defaultvtable, dispinterface, displaybind, dual, entry, first_is, helpcontext, helpfile, helpstringcontext, helpstringdll, hidden, idl_module, idl_quote, id, immediatebind, importlib, import, include, includelib, last_is, lcid, licensed, max_is, module, ms_union, no_injected_text, nonbrowsable, noncreatable, nonextensible, odl, oleautomation, optional, pragma, propget, propputref, propput, readonly, requestedit, restricted, retval, source, transmit_as, uidefault, usesgetlasterror, vararg, vi_progid, wire_marshal. </para>
472 <title>ETHEREAL CONFORMANCE FILES</title>
475 Pidl needs additional data for ethereal output. This data is read from
476 so-called conformance files. This section describes the format of these
480 Conformance files are simple text files with a single command on each line.
481 Empty lines and lines starting with a '#' character are ignored.
482 Arguments to commands are seperated by spaces.
486 The following commands are currently supported:
492 <term>TYPE name dissector ft_type base_type mask valsstring alignment</term>
493 <listitem><para>FIXME</para></listitem>
497 <term>NOEMIT type</term>
499 Suppress emitting a dissect_type function for the specified type
504 <term>PARAM_VALUE type param</term>
511 <term>HF_FIELD hf title filter ft_type base_type valsstring mask blurb</term>
518 <term>HF_RENAME old_hf_name new_hf_name</term>
519 <listitem><para>FIXME</para></listitem>
523 <term>STRIP_PREFIX prefix</term>
524 <listitem><para> FIXME</para></listitem>
528 <term>PROTOCOL longname shortname filtername</term>
529 <listitem><para>FIXME</para></listitem>
533 <term>FIELD_DESCRIPTION field desc</term>
534 <listitem><para>FIXME</para></listitem>
538 <term>IMPORT dissector code...</term>
539 <listitem><para>FIXME</para></listitem>
547 <title>VERSION</title>
549 <para>This man page is correct for version 4.0 of the Samba suite.</para>
553 <title>SEE ALSO</title>
555 <para><ulink url="http://msdn.microsoft.com/library/en-us/rpc/rpc/field_attributes.asp">Field Attributes [Remote Procedure Call]</ulink>, <ulink url="http://wiki.ethereal.com/DCE/RPC">Ethereal Wiki on DCE/RPC</ulink>.</para>
560 <title>AUTHOR</title>
564 <para>pidl was written by Andrew Tridgell, Stefan Metzmacher, Tim
565 Potter and Jelmer Vernooij. </para>
567 <para>This manpage was written by Jelmer Vernooij, partially based on the original pidl README by Andrew Tridgell. </para>