[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] sio.h Function Prototypes

From: Sylvain Rochet
Subject: Re: [lwip-users] sio.h Function Prototypes
Date: Sat, 7 May 2016 01:28:05 +0200
User-agent: Mutt/1.5.23 (2014-03-12)


On Fri, May 06, 2016 at 09:29:42PM +0200, address@hidden 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 
<address@hidden> but the change was not 

> > 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 serial output callback function prototype */
typedef u32_t (*pppos_output_cb_fn)(ppp_pcb *pcb, u8_t *data, u32_t len, void 

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)
  return sio_write(ppp_sio, data, len);


Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]