libmsrpc for Samba 3

Gerald (Jerry) Carter jerry at samba.org
Wed Jul 20 16:12:30 GMT 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris Nicholls wrote:

| This 'control block' structure has grown on me since
| i first looked at this thread last night. It definately makes
| for much more readable code  and makes it really easy to
| pass a number of parameters out of a function (as a lot
| of rpc operations seem to do).  The only question I
| have right now is what happens if an application
| have right now is what happens if an application
| developer forgets to initialize a particular in.*
| member?

You're screwed.  It's a programmer error and the compiler
cannot help you out.  That's one reason why I'm a little
hesitant on this.  Although we all have been consolidating
parameters to passing a structure pointer to keep function
formal parameters lists short.

In some ways, Samba 4 takes this to the extreme.  And
while that extreme is good for IDL compilers and matching
ethereal output, I'm not sure that it reduces programming
errors.

And the unitialized fields will happen more than you think.
It makes for pretty code, but you loose help from the
compiler.  Where as with formal parameter lists, if you
forget one or misorder one, the compiler can complain.
That's the whole point of function declarations.  You might
as well be passing void pointers.

IMO functions should take at most 5 arguements or so.
Ideally 0 - 3.  But like my comments above, there is no
compiler for philosophy.  Similar parameters are often
grouped in structures (e.g. user information, printer
defaults, a registry value object).  I really dislike
the 5 levels of nested of structures for accessing a
field that has to be set for calling a function.

But these are programming preferences and ultimately
we have to think not of our own preferences but
what is best for the application writer.

That said, if you do decide to used the control
blocks for parameters, we cannot use what's in
include/rpc_*.h because we really should not be
exposing alot of the wire details to the consumer.
The cleaner interface structures and IDL in Samba 4
is a big advantage here.

| I can't really comment on compatabilities with the
| Samba4 API as i  haven't spent much time at all looking
| through the Samba4 code yet.

Binary compatibility is not practical here since we
don't use the Samba 4 IDL yet.  Tridge's concern
was about interfaces that were close enough to not
frustrate apllication writers.  There is no doubt
that at this point, applications would have to be
rewritten to use Samba 4's rpc library.






cheers, jerry
=====================================================================
Alleviating the pain of Windows(tm)      ------- http://www.samba.org
GnuPG Key                ----- http://www.plainjoe.org/gpg_public.asc
"I never saved anything for the swim back."     Ethan Hawk in Gattaca

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFC3nfuIR7qMdg1EfYRAkaAAKDwWM5J0YPV4To2Ta8VsPpcjxK8LwCeJILW
Qb9m8hCgKcifhvxuGhLTOBw=
=R5/7
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list