libmsrpc for Samba 3

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


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

derrell at samba.org wrote:

| I'm not entirely convinced that your concern is
| justified.  With a controlblock structure to
| initialize, my experience has been that programmers
| will tend to enumerate all of the structure fields
| in their code, and initialize all of them.

Barring an act of God, I can see I will loose this
discussion.  That's ok.  I have my opinions about API
design and others have theirs.  CHris is the one
writing the library.  I'll leave it up to him.

| That not withstanding, doing something like
| this may help:
|
|     initialize_operation(OP_SPOOLSS_OPENPRINTER, &op);

Yeah.  I've done this too.  Like I said, before I prefer

	hPrinter = OpenPrinter( hServer, printername )

over

	pdu.in.printername = strdup( printername );
	OpenPrinter( hServer, &pdu );
	hPrinter = pdu.out.handle;

There are wonderful advantages to control block
parmaeters, but thunking down to one makes it harder
for the application write IMO.  You have to dig
multiple levels to figure out what

	OpenPrinter ( SERVER_HND, OPEN_PRINTER_STRUCT );

actually needs.  I said before that 0 - 3 parameters is
ideal and 5 is the max.  So in essense we are not disagreeing.

| Note that initialize_operation() specifically does NOT
| take parameters to fill in the structure.  That would,
| of course, eliminate the utility of the control block.
| The function simply initialize all fields to reasonable
| defaults or illegal values.

It's debatable whether defaults is any better than
fields that should have been set by the programmer
but were not.  It really cannot be argued in a generic
sense however because it really depends on the client
operation being invoked.





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

iD8DBQFC3n6BIR7qMdg1EfYRArEfAJ4wzBvRU1mdpYAHLO2VtaUyhpsMRwCfbjkd
9fOyE5rSSO/O4Oyd9EIy964=
=Y/h+
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list