[jcifs] Re: Tridge's PIDL compiler and the Samba4 IDLs.

Michael B Allen mba2000 at ioplex.com
Thu Aug 12 09:18:19 GMT 2004


On Thu, 12 Aug 2004 01:44:52 -0500
"Christopher R. Hertel" <crh at ubiqx.mn.org> wrote:

> So... Anyone interested in working on a Java back-end for PIDL?

You're a little late. I'm pretty much finished with idlc. At least the
stubs can marshall pretty much anything. I just need the call harness
glue.

And it's 100% MIDL compatible. Remember if Jarapac is going to
seriously be of any use to anyone you need to be able to just take your
IDL files and run them through idlc to get Jarapac stubs. Otherwise are
you going to re-write the IDL to be "slightly unusual"? Nope.

Unfortunately I'm loosing confidence in Samba's IDL as well. For example
look at NetShareEnumAll:

    WERROR srvsvc_NetShareEnumAll (
        [in]   unistr *server_unc,
        [in,out]   uint32 level,
        [in,out,switch_is(level)] srvsvc_NetShareCtr ctr,
        [in]   uint32 max_buffer,
        [out]  uint32 totalentries,
        [in,out]   uint32 *resume_handle
        );

The correct IDL (verified with MIDL and an ncacn_np transport against
srvsvc on Windows 2003) is:

    int NetShareEnumAll(
            [in,string,unique] char_t *servername,
            [in,out] int *level, 
            [in,out,switch_is(*level)] NetShareCtr *info,
            [in] unsigned long prefmaxlen,
            [out] unsigned long *totalentries,
            [in,out] unsigned long *resume_handle
            );

[Although I use char_t vs wchar_t because wchar_t is not necessary UCS-2LE
on platforms other than Windows.]

So as you can see there are quite a few significant differences
here. First what is unistr? Well it is defined in idl_types.h (which is
included with an include preprocessor statement which would normally
be an import statement). Also the attributes are totally different. MIDL
will not encode a referent for a parameter without a unique attribute
even with pointer_default(unique). There isn't even a string attribute.

#define unistr        [flag(STR_SIZE4|STR_LEN4)]            string

Second, non of the out parameters are pointers. This generates an error
with MIDL. I suspect they do that because PIDL will trigger an referent
to be encoded where top-level pointers are ref pointers and out pointers
are always ref pointers regardless of what pointer_default is.

Granted I've really focused on this one RPC but AFAICT PIDL is not "slightly
unusual" it's totally unique.

Certainly there will be challenges moving forward for idlc but at the rate
I'm going it will be much much better than PIDL RSN. Actually I was
originally hoping to get those guys to switch to mine. I didn't think they
were so attached to theirs but Tridge seemed a little bent that I wasn't
interested in PIDL.

Oh, well.

Mike

-- 
Greedo shoots first? Not in my Star Wars.


More information about the jcifs mailing list