Hi, On Fri, May 06, 2016 at 09:29:42PM +0200, [email protected] wrote: > Greg Smith wrote: > >In lwIP 2.0.0 Beta1, it has a prototype in sio.h for sio_write, which I > >believe is the generic function name for the PPP output function. > > Not exactly. sio_write is used for PPP, for slipif and maybe for other > netifs.
Not really, the last user of the SIO framework is SLIP. The SIO API sucks, I proposed my help to get rid of it in SLIP in <[email protected]> but the change was not acknowledged. > > Should this have a prototype of: > > > > u32_t sio_write(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx); > > > > instead of: > > > > u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len); > > > > No. > > > It seems the updates to PPP demand a ppp_pcb, instead of sio_fd_t. > > > > Yes. But to write, you need a sio_fd_t. So you need an output function that > maps to your sio_write function. See the win32 or unix port in contrib. If > you don't want to keep sio_fd_t static (like these ports do, unfortunately), > you can pass a "void* ctx_cb" that is passed to the output function to get > what you need to call sio_write. It doesn't work this way, PPPoS user must provide a serial output callback while calling pppos_create with a prototype matching pppos_output_cb_fn. /* PPPoS serial output callback function prototype */ typedef u32_t (*pppos_output_cb_fn)(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx); Feel free to do whatever you want with this callback ;-) This is what lwip-contrib/ports/unix/proj/unixsim/simhost.c is doing, using a global variable: static u32_t ppp_output_cb(ppp_pcb *pcb, u8_t *data, u32_t len, void *ctx) { LWIP_UNUSED_ARG(pcb); LWIP_UNUSED_ARG(ctx); return sio_write(ppp_sio, data, len); } Sylvain
signature.asc
Description: Digital signature
_______________________________________________ lwip-users mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/lwip-users
