[openbeosnetteam] Re: PPP #2
- From: philippe.houdoin@xxxxxxx
- To: openbeosnetteam@xxxxxxxxxxxxx
- Date: Wed, 22 May 2002 19:58:25 +0200 (MEST)
Ooops, it seems I've click on "send now" to quickly!?
David wrote:
> Essentially the idea goes like this...
>
> When the ppp module starts is basically starts waiting for messages
> using receive_data (blocking) in a seperate thread. before doing
> this it loads all the modules that it can use for input/output and
> protocols.
>
> The userland PPP app starts up and sends a message to the control
> thread, using known codes for the actions and with up to 100
> bytes of data.
Is this use of BeOS thread builtin port (send_data/receive_data) only
for controling PPP?
Or did I miss something here?
In this case, why not use ioctl() instead, which is far more portable and
don't need an extra thread, most of the time blocked on receive_data()?
We can set specific opcodes for PPP in driver/net_stack_driver.h
enum {
NET_IOCTL_BASE = 0xbe230000,
NET_SOCKIO_IOCTL_BASE = NET_IOCTL_BASE + 0x100,
NET_STACK_IOCTL_BASE = NET_IOCTL_BASE + 0x200,
NET_PPP_IOCTL_BASE = NET_IOCTL_BASE + 0x300,
NET_SERIAL_PPP_IOCTL_BASE = NET_IOCTL_BASE + 0x400,
NET_PPPOE_IOCTL_BASE = NET_IOCTL_BASE + 0x500
};
As the stack driver only handle NET_STACK_IOCTL_BASE range ioctl() opcodes
himself and pass all others to the core module, this one, instead of
passing opcodes to his socket-related soo_ioctl() function, could
try to send it to any net_module he knows, until one of them (or none)
claims to have handling it:
pseudo-code:
int core:ioctl(opcode, ...) {
if (opcode >= NET_SOCKIO_IOCTL_BASE &&
opcode < NET_SOCKIO_IOCTL_BASE + 0x100)
return soo_ioctl(opcode, ...);
// it's not a socket ioctl(), so hands it to modules:
for( module = net_module_list; module; module = module->next ) {
if (module->info.ioctl == NULL)
continue;
rc = module->info.ioctl(opcode, ...);
if (rc >= 0)
return rc;
}
return B_ERROR;
}
Just a suggestion, as I fear seeing too many heterogenous ways to control
each parts or the network stack, when ioctl() plain simple for this...
> ppp user app asks for a new ppp connection for serial2,
> - ppp control thread scans a list of "match" strings for a match, gets
> a match on "serial" and so asks the serial_ppp module (who has registered
> this match) to create a new device for "2".
I like the way each "ppp link" register with the main PPP module.
However, make this method even more open, by using a ppp kind specifier and
a ppp device:instead of "serial2", a "serial_ppp /dev/ports/serial2".
For PPPoE, it would be "pppoe tulip0", for PPPoA it could be
"pppoa /dev/net/speed_touch/0" for example...
BTW, don't make assertion on serial device name, you could have
other entries in /dev/ports/ than only serial1 and serial2.
And USB modems could publish an usb_acm0 entry here, for example.
> - if we get a new serial_ppp device we create a new ppp device and
> attach the serial_ppp pointer to it
>
> This all works already. Next steps are harder :) Some of the code
> needs working on, but I think I'm making progress.
This is really cool!
You rocks, again, David.
OFF-TOPIC: so, how was AOTC? ;-)
-Philippe
- Follow-Ups:
- [openbeosnetteam] Re: PPP #2
- From: David Reid
- References:
- [openbeosnetteam] PPP #2
- From: David Reid
Other related posts:
- » [openbeosnetteam] PPP #2
- » [openbeosnetteam] Re: PPP #2
- » [openbeosnetteam] Re: PPP #2
- » [openbeosnetteam] Re: PPP #2
- » [openbeosnetteam] Re: PPP #2
- » [openbeosnetteam] Re: PPP #2
- » [openbeosnetteam] Re: PPP #2
- [openbeosnetteam] Re: PPP #2
- From: David Reid
- [openbeosnetteam] PPP #2
- From: David Reid