PPP, PPPoS, replaced static sio_write() calls to a user defined callback

The overall lwIP design on data flows (netif,udp,tcp) is to use a user
defined callback to get data from stack and a static function to send
data to stack, which makes perfect sense. The SIO port was an exception,
the PPP stack never really used the SIO port by only using the
sio_send() function (and the ignominious sio_read_abort() function a
while back).

The way the SIO port is currently designed adds a tight coupling between
the lwIP port and the user code if the user need to do specific user
code if the current uart used is the PPPoS uart, which is not nice,
especially because all the lwIP stack is quite clean at this subject.

While we are at stabilizing the PPP API, change this behavior before
it's too late by replacing the static sio_write() calls to a user
defined callback.
This commit is contained in:
Sylvain Rochet
2015-09-13 17:53:16 +02:00
parent 81d3337681
commit b55412a0c4
5 changed files with 39 additions and 33 deletions

View File

@@ -127,7 +127,7 @@ pppapi_set_notify_phase_callback(ppp_pcb *pcb, ppp_notify_phase_cb_fn notify_pha
static void
pppapi_do_pppos_create(struct pppapi_msg_msg *msg)
{
msg->ppp = pppos_create(msg->msg.serialcreate.pppif, msg->msg.serialcreate.fd,
msg->ppp = pppos_create(msg->msg.serialcreate.pppif, msg->msg.serialcreate.output_cb,
msg->msg.serialcreate.link_status_cb, msg->msg.serialcreate.ctx_cb);
TCPIP_PPPAPI_ACK(msg);
}
@@ -137,13 +137,13 @@ pppapi_do_pppos_create(struct pppapi_msg_msg *msg)
* tcpip_thread context.
*/
ppp_pcb*
pppapi_pppos_create(struct netif *pppif, sio_fd_t fd, ppp_link_status_cb_fn link_status_cb,
void *ctx_cb)
pppapi_pppos_create(struct netif *pppif, pppos_output_cb_fn output_cb,
ppp_link_status_cb_fn link_status_cb, void *ctx_cb)
{
struct pppapi_msg msg;
msg.function = pppapi_do_pppos_create;
msg.msg.msg.serialcreate.pppif = pppif;
msg.msg.msg.serialcreate.fd = fd;
msg.msg.msg.serialcreate.output_cb = output_cb;
msg.msg.msg.serialcreate.link_status_cb = link_status_cb;
msg.msg.msg.serialcreate.ctx_cb = ctx_cb;
TCPIP_PPPAPI(&msg);