[openbeosnetteam] Dynamic Modules!

  • From: "David Reid" <dreid@xxxxxxxxxxxx>
  • To: "OpenBeOS Network Team" <openbeosnetteam@xxxxxxxxxxxxx>
  • Date: Sun, 10 Feb 2002 23:43:18 -0000

Well, we now have dynamic modules!

Yes, the protocol modules now get dynamically loaded at startup and then
used accordingly!

Now, as I've said before, it's not perfect, but it's going in the right
direction now.

The make system needs some work and uses a fiddle I was told about for APR,
that works a treat :)

In summary, what happens is this...

o each module in the modules directory is opened and the structure
net_module_data is looked for.
o if it's found
    - an entry is added to the loaded_net_modules table that is globally
held in net_server/net_server.c
    - it's protocol entry in the protocol table is set to the number of the
loaded_net_module array allocated
    - the modules init routine is called with pointers of the global
loaded_net_modules and protocol table

In each module, to call the next routine we simply do

global_modules[protocol_table[proto]].mod->(input/output)(...)

Not perfect, but it seems to work and is what Dmitri and I discussed this
afternoon in IRC.

The code is now in CVS so please give it a try and let me know.

david



Other related posts: