Mail To: Peter Rottengatter <perot@pallas.amp.uni-hannover.de>
Subject: Re: Low-level port drivers
----------------------------------------------------------------------------

On Wed, 27 May 1998, Peter Rottengatter wrote:
>
>Hi Ronald
>
>You're the only one who created low-level port drivers apart from me, so
>this concerns you too.
>
>I decided to clean up the mess that has developed for configuring port
>drivers. You remember how long it took to get the Masquerading
>configuration integrated into the Dialer. That was mainly due to the messy
>way of putting config data after the port structure. The situation for
>SERIAL.STX is even worse, especially after I removed the global PAP
>authentication data from the DEFAULT.CFG. So I'm after that cleanup for
>quite a while.
>
>I decided to go for an approach similar to how the MiNT people started
>configuring device drivers, i.e. the Fcntl() method. So I created a new
>client API function cntrl_port() with is
>
>   int16  cdecl  cntrl_port (char *port, uint32 argument, int16 code);
>
>This requires another DRIVER function entry. Since placing data after the
>port structure will go with this, an incompatibility is inevitable. My
>only choice was to keep it small and thus "hide" the bad side effects,
>or make a clean cut, make the incompatibility such that everybody notices
>it when trying to mix binaries and provide a complete set of new port
>STX drivers. Obviously the second choice is better.
>
>So I modified the DRIVER structure by adding another entry. Of course this
>leads to a modification in every driver. You need to create some new
>function my_cntrl() that looks like specified in the DRIVER definition,
>and integrate it's address into the module's DRIVER structure. This
>function can be as small as
>
>int16  cdecl  cntrl_port (PORT *port, uint32 argument, int16 code)
>
>{
>   return (E_FNAVAIL);
> }
>
>I suggest you change for instance the MASQUE.STX to use this structure for
>configuration. The Dialer would then call
>
>   cntrl_port ("Masquerade", ip_address, CTL_MASQ_IPADDR);
>
>to set the masquerade address. CTL_MASQ_IPADDR can be the next number as
>defined in TRANSPRT.H. Check out the Ethernet source code that comes in
>another mail for an example. Use the method as you wish for configuring
>the other modules by you, but tell me the codes you use to keep them
>unique.
>
>With this method we get rid of the rubbish of placing data somewhere in
>memory after a PORT structure, data that does not show up in the PORT
>definition, and is different for every driver. From the start it was never
>my intention that separate applications like the Dialer access the PORT
>structure. A huge step towards a consistent and clean API.
>
>
>Cheers  Peter
>
>PS.: The change in your modules is not of high urgency, as STinG V1.16
>     which will implement this is nothing close to (even beta) release).
>     Of course you'll get a beta before anybody else so that you can do
>     thorough tests.
>
>---------------------------------------------------------------------
>   Peter Rottengatter       perot@pallas.amp.uni-hannover.de
>                            http://www.stud.uni-hannover.de/~perot
>---------------------------------------------------------------------
>
>
>
>