CVS update: samba/source/lib/rpc/server

Andrew Tridgell tridge at samba.anu.edu.au
Tue Mar 17 13:50:18 GMT 1998


> ace idea!

yeah, it's basically how every sane implementation does it. The only
reason we don't do it is that I didn't realise those first 4 bytes
weren't part of the main protocol when I looked at the sniffs.

The main reason I haven't fixed it is that every offset in Samba would
need to be changed by 4 bytes. I started to do this a while back (by
hiding the 4 byte offset in a macro) but never finished it up.

>  abstract enough to be able to implement an "nb_open(), nb_read(),
> nb_write() set of functions?  i know, you need a 4 byte netbios
> header in front...

yep. You would have a nb_allocate() function that would allocate the
memory for a packet. It can deliberately leave room for the header and
then fill it in when nb_write() is called. nb_allocate() would return
a pointer at (start_of_packet+4).

In fact, I don't actually want lots of nb_* routines. Instead I want a
nb_initialise() which returns a structure something like this:

struct encap_layer {
       void (*allocate)(int maxsize);
       void (*free)(void *ptr);
       int (*read)(void *ptr, int maxsize);
       int (*write)(void *ptr, int size);
       int (*poll)(void );
};

then adding a IPX or netbeui implementation will be mostly a matter of
supplying a encap_layer structure for them.

It would take maybe 2-3 days solid work to convert Samba over to this
scheme (for NBT only). We should do it before 2.0.

Cheers, Andrew


More information about the samba-technical mailing list