PIDL(1)
π pidl(1) β User Contributed Perl Documentation π
okay bestie, welcome to the pidl(1) manual page from User Contributed Perl Documentation. this is part 1, so grab your iced coffee and let's get into it π
β¨ NAME β¨
pidl β an IDL compiler written in Perl π¦
β¨ SYNOPSIS β¨
pidl --help
pidl [--outputdir[=OUTNAME]] [--includedir DIR...] [--parse-idl-tree]
[--dump-idl-tree] [--dump-ndr-tree] [--header[=OUTPUT]]
[--python[=OUTPUT]] [--ndr-parser[=OUTPUT]] [--client] [--server]
[--warn-compat] [--quiet] [--verbose] [--template]
[--ws-parser[=OUTPUT]] [--diff] [--dump-idl] [--tdr-parser[=OUTPUT]]
[--samba3-ndr-client[=OUTPUT]] [--samba3-ndr-server[=OUTPUT]]
[--typelib=[OUTPUT]] [<idlfile>.idl]...
β¨ DESCRIPTION β¨
so pidl is an IDL compiler written in Perl that is trying to be somewhat compatible with the midl compiler. IDL is short for Interface Definition Language, periodt π
pidl can generate stubs for DCE/RPC server code, DCE/RPC client code and Wireshark dissectors for DCE/RPC traffic. iconic behavior, honestly π
IDL compilers like pidl take a description of an interface as their input and use it to generate C (though support for other languages may be added later) code that can use these interfaces, pretty print data sent using these interfaces, or even generate Wireshark dissectors that can parse data sent over the wire by these interfaces. no cap, that's the whole vibe π
pidl takes IDL files in the same format as is used by midl, converts it to a .pidl file (which contains pidl's internal representation of the interface) and can then generate whatever output you need. .pidl files should be used for debugging purposes only. Write your interface definitions in .idl format.
.pidlfiles are for debugging only, bestie. write your interface definitions in.idlformat. π
The goal of pidl is to implement an IDL compiler that can be used while developing the RPC subsystem in Samba (for both marshalling/unmarshalling and debugging purposes). slay π¦
β¨ OPTIONS β¨
--helpβ shows the list of available options. your little menu, yum π--versionβ shows thepidlversion. drop the number, bestie β¨--outputdir OUTNAMEβ writes output files to the specified directory. defaults to the current directory. (the synopsis writes it as--outputdir[=OUTNAME], btw π )--includedir DIRβ addsDIRto the search path used by the preprocessor. this option can be specified multiple times. stack it up π (synopsis:--includedir DIR...)--parse-idl-treeβ reads the internal tree structure from input files rather than assuming they contain IDL. tree time π³--dump-idlβ generates a new IDL file. the file will be namedOUTNAME.idl. dump it, slay π--headerβ generates a C header file for the specified interface. filename defaults toOUTNAME.h. (synopsis:--header[=OUTPUT]) π--ndr-parserβ generates a C file and C header containing NDR parsers. the filename for the parser defaults tondr_OUTNAME.c. the header filename will be the parser filename with the extension changed from.cto.h. (synopsis:--ndr-parser[=OUTPUT]) π₯--tdr-parserβ generates a C file and C header containing TDR parsers. the filename for the parser defaults totdr_OUTNAME.c. the header filename will be the parser filename with the extension changed from.cto.h. (synopsis:--tdr-parser[=OUTPUT]) π--typelibβ writes type information to the specified file. (synopsis:--typelib=[OUTPUT]) π¦--serverβ generates boilerplate for the RPC server that implements the interface. filename defaults tondr_OUTNAME_s.c. server side, periodt π--templateβ generates stubs for a RPC server that implements the interface. output will be written to stdout. template realness π--ws-parserβ generates a Wireshark dissector (in C) and header file. the dissector filename defaults topacket-dcerpc-OUTNAME.c, while the header filename defaults topacket-dcerpc-OUTNAME.h. (synopsis:--ws-parser[=OUTPUT])
Pidl will read additional data from a Wireshark conformance file if present. such a file should have the same location as the IDL file but with the extension cnf rather than idl. see Parse::Pidl::Wireshark::Conformance for details on the format of this file. wireshark bestie, we love her π
--diffβ parses an IDL file, generates a new IDL file based on the internal data structures, and sees if there are any differences with the original IDL file. useful for debuggingpidl. diff check, detective vibes π--dump-idl-treeβ tellspidlto dump the internal tree representation of an IDL file to disk. useful for debuggingpidl. π³--dump-ndr-treeβ tellspidlto dump the internal NDR information tree it generated from the IDL file to disk. useful for debuggingpidl. π²--samba3-ndr-clientβ generates client calls for Samba3, to be placed inrpc_client/. instead of calling out to the code in Samba3'srpc_parse/, this will call out to Samba4's NDR code instead. (synopsis:--samba3-ndr-client[=OUTPUT]) π--samba3-ndr-serverβ generates server calls for Samba3, to be placed inrpc_server/. instead of calling out to the code in Samba3'srpc_parse/, this will call out to Samba4's NDR code instead. (synopsis:--samba3-ndr-server[=OUTPUT]) π--python[=OUTPUT]β appears in the synopsis, but this man page doesn't describe it. no cap, we're not making it up π--clientβ synopsis-only here; no description on this page. π¦--warn-compatβ synopsis-only here; no description on this page. β οΈ--quietβ synopsis-only here; no description on this page. π€«--verboseβ synopsis-only here; no description on this page. π£οΈ
and yeah, you feed it <idlfile>.idl files β those are the actual interface definitions. β¨
β¨ IDL SYNTAX β¨
IDL files are always preprocessed using the C preprocessor. π
Pretty much everything in an interface (the interface itself, functions, parameters) can have attributes (or properties, whatever name you give them). Attributes always prepend the element they apply to and are surrounded by square brackets ([]). Multiple attributes are separated by commas; arguments to attributes are specified between parentheses.
See the section COMPATIBILITY for the list of attributes that pidl supports.
C-style comments can be used. periodt π
β¨ CONFORMANT ARRAYS β¨
A conformant array is one that ends in [*] or []. The strange things about conformant arrays are that they can only appear as the last element of a structure (unless there is a pointer to the conformant array, of course) and the array size appears before the structure itself on the wire.
So, in this example:
typedef struct {
long abc;
long count;
long foo;
[size_is(count)] long s[*];
} Struct1;
it appears like this:
[size_is] [abc] [count] [foo] [s...]
the first [size_is] field is the allocation size of the array, and occurs before the array elements and even before the structure alignment.
Note that size_is() can refer to a constant, but that doesn't change the wire representation. It does not make the array a fixed array.
midl.exe would write the above array as the following C header:
typedef struct {
long abc;
long count;
long foo;
long s[1];
} Struct1;
pidl takes a different approach, and writes it like this:
typedef struct {
long abc;
long count;
long foo;
long *s;
} Struct1;
β¨ VARYING ARRAYS β¨
A varying array looks like this:
typedef struct {
long abc;
long count;
long foo;
[size_is(count)] long *s;
} Struct1;
This will look like this on the wire:
[abc] [count] [foo] [PTR_s] [count] [s...]
β¨ FIXED ARRAYS β¨
A fixed array looks like this:
typedef struct {
long s[10];
} Struct1;
The NDR representation looks just like 10 separate long declarations. The array size is not encoded on the wire.
pidl also supports "inline" arrays, which are not part of the IDL/NDR standard. These are declared like this:
typedef struct {
uint32 foo;
uint32 count;
uint32 bar;
long s[count];
} Struct1;
This appears like this:
[foo] [count] [bar] [s...]
Fixed arrays are an extension added to support some of the strange embedded structures in security descriptors and spoolss.
This section is by no means complete. See the OpenGroup and MSDN documentation for additional information.
π COMPATIBILITY WITH MIDL π
okay bestie, so this is the compatibility section, and it's giving "pidl speaks a lot of MIDL, but not every single thing." Let's get into it. π«Ά
π« Missing features in pidl
The following MIDL features are not (yet) implemented in pidl, or they're implemented with an incompatible interface:
- Asynchronous communication
- Typelibs (
.tlbfiles) - Datagram support (
ncadg_*)
β Supported attributes and statements
pidl can vibe with these attributes and statements, no cap: 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, represent_as, transmit_as, import, include, cpp_quote.
π¦ PIDL Specific properties
public
The [public] property on a structure or union is a pidl extension that forces the generated pull/push functions to be non-static. This allows you to declare types that can be used between modules. If you don't specify [public], then pull/push functions for other than top-level functions are declared static.
noprint
The [noprint] property is a pidl extension that allows you to specify that pidl should not generate a ndr_print_*() function for that structure or union. This is used when you wish to define your own print function that prints a structure in a nicer manner. A good example is the use of [noprint] on dom_sid, which allows the pretty-printing of SIDs.
value
The [value(expression)] property is a pidl extension that allows you to specify the value of a field when it is put on the wire. This allows fields that always have a well-known value to be automatically filled in, thus making the API more programmer friendly. The expression can be any C expression.
relative
The [relative] property can be supplied on a pointer. When it is used it declares the pointer as a spoolss style "relative" pointer, which means it appears on the wire as an offset within the current encapsulating structure. This is not part of normal IDL/NDR, but it is a very useful extension as it avoids the manual encoding of many complex structures.
subcontext(length)
Specifies that a size of length bytes should be read, followed by a blob of that size, which will be parsed as NDR.
π¨ deprecated alert π¨subcontext()is deprecated now, and should not be used in new code. Instead, userepresent_as()ortransmit_as().
flag
Specify boolean options, mostly used for low-level NDR options. Several options can be specified using the | character. Note that flags are inherited by substructures! π
nodiscriminant
The [nodiscriminant] property on a union means that the usual uint16 discriminent field at the start of the union on the wire is omitted. This is not normally allowed in IDL/NDR, but is used for some spoolss structures.
charset(name)
Specify that the array or string uses the specified charset. If this attribute is specified, pidl will take care of converting the character data from this format to the host format. Commonly used values are UCS2, DOS and UTF8.
π Unsupported MIDL properties or statements
These MIDL properties and statements are not supported, periodt:
aggregatable, appobject, async_uuid, bindable, control, defaultbind, defaultcollelem, defaultvalue, defaultvtable, dispinterface, displaybind, dual, entry, first_is, helpcontext, helpfile, helpstringcontext, helpstringdll, hidden, idl_module, idl_quote, id, immediatebind, importlib, 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, uidefault, usesgetlasterror, vararg, vi_progid, wire_marshal.
β¨ EXAMPLES β¨
Here are the literal command examples, copied exactly, bestie:
# Generating an Wireshark parser
$ ./pidl --ws-parser -- atsvc.idl
# Generating a TDR parser and header
$ ./pidl --tdr-parser --header -- regf.idl
# Generating a Samba3 client and server
$ ./pidl --samba3-ndr-client --samba3-ndr-server -- dfs.idl
# Generating a Samba4 NDR parser, client and server
$ ./pidl --ndr-parser --ndr-client --ndr-server -- samr.idl
π SEE ALSO
<https://msdn.microsoft.com/en-us/library/windows/desktop/aa373864%28v=vs.85%29.aspx><https://wiki.wireshark.org/DCE/RPC><https://www.samba.org/>yapp(1)
π LICENSE
pidl is licensed under the GNU General Public License β literally <https://www.gnu.org/licenses/gpl.html>.
π AUTHOR
pidl was written by Andrew Tridgell, Stefan Metzmacher, Tim Potter and Jelmer Vernooij. The current maintainer is Jelmer Vernooij.
This manpage was written by Jelmer Vernooij, partially based on the original pidl README by Andrew Tridgell.
and that's the whole page, bestie π it came from perl v5.42.3, dated 2026-09-09, and it's literally PIDL(1). mwah π
β¨
π¦ where this page comes from
- fedora 44: samba-pidl 2:4.24.7-1.fc44 Β· GPL-3.0-or-later AND LGPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms