mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-06 18:41:30 +00:00
PPP, PPPoS, added sub-ioctl commands
Allow low level drivers to extend ioctl call, moved PPPoS ioctl commands to pppos.c.
This commit is contained in:
parent
ec362536f5
commit
729e24da78
@ -163,6 +163,8 @@ struct link_callbacks {
|
||||
void (*recv_config)(ppp_pcb *pcb, void *ctx, u32_t accm);
|
||||
/* configure TCP header compression */
|
||||
void (*vj_config)(ppp_pcb *pcb, void *ctx, int vjcomp, int cidcomp, int maxcid);
|
||||
/* Get and set parameters for the given connection. */
|
||||
int (*ioctl)(ppp_pcb *pcb, void *ctx, int cmd, void *arg);
|
||||
};
|
||||
|
||||
/*
|
||||
|
@ -102,7 +102,6 @@ void pppos_input(ppp_pcb *ppp, u_char* data, int len);
|
||||
*
|
||||
* You may use them if you REALLY know what you are doing.
|
||||
*/
|
||||
sio_fd_t pppos_get_fd(pppos_pcb *pppos);
|
||||
int pppos_vjc_comp(pppos_pcb *pppos, struct pbuf *pb);
|
||||
int pppos_vjc_uncomp(pppos_pcb *pppos, struct pbuf *pb);
|
||||
|
||||
|
@ -368,18 +368,10 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||
return PPPERR_PARAM;
|
||||
break;
|
||||
|
||||
#if PPPOS_SUPPORT
|
||||
case PPPCTLG_FD: /* Get the fd associated with the ppp */
|
||||
if (arg) {
|
||||
*(sio_fd_t *)arg = pppos_get_fd((pppos_pcb*)pcb->link_ctx_cb);
|
||||
return PPPERR_NONE;
|
||||
}
|
||||
return PPPERR_PARAM;
|
||||
break;
|
||||
#endif /* PPPOS_SUPPORT */
|
||||
|
||||
default:
|
||||
break;
|
||||
if (pcb->link_cb->ioctl) {
|
||||
return pcb->link_cb->ioctl(pcb, pcb->link_ctx_cb, cmd, arg);
|
||||
}
|
||||
}
|
||||
|
||||
return PPPERR_PARAM;
|
||||
|
@ -156,6 +156,7 @@ static const struct link_callbacks pppoe_callbacks = {
|
||||
pppoe_netif_output,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -105,6 +105,7 @@ static const struct link_callbacks pppol2tp_callbacks = {
|
||||
pppol2tp_netif_output,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
@ -89,6 +89,7 @@ static void pppos_disconnect(ppp_pcb *ppp, void *ctx);
|
||||
static err_t pppos_destroy(ppp_pcb *ppp, void *ctx);
|
||||
static void pppos_send_config(ppp_pcb *ppp, void *ctx, u32_t accm);
|
||||
static void pppos_recv_config(ppp_pcb *ppp, void *ctx, u32_t accm);
|
||||
static int pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg);
|
||||
#if VJ_SUPPORT
|
||||
static void pppos_vjc_config(ppp_pcb *ppp, void *ctx, int vjcomp, int cidcomp, int maxcid);
|
||||
#endif /* VJ_SUPPORT */
|
||||
@ -112,10 +113,11 @@ static const struct link_callbacks pppos_callbacks = {
|
||||
pppos_send_config,
|
||||
pppos_recv_config,
|
||||
#if VJ_SUPPORT
|
||||
pppos_vjc_config
|
||||
pppos_vjc_config,
|
||||
#else /* VJ_SUPPORT */
|
||||
NULL
|
||||
NULL,
|
||||
#endif /* VJ_SUPPORT */
|
||||
pppos_ioctl
|
||||
};
|
||||
|
||||
/* PPP's Asynchronous-Control-Character-Map. The mask array is used
|
||||
@ -809,13 +811,25 @@ pppos_recv_config(ppp_pcb *ppp, void *ctx, u32_t accm)
|
||||
pppos->in_accm[0], pppos->in_accm[1], pppos->in_accm[2], pppos->in_accm[3]));
|
||||
}
|
||||
|
||||
sio_fd_t
|
||||
pppos_get_fd(pppos_pcb *pppos)
|
||||
static int
|
||||
pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg)
|
||||
{
|
||||
if (!pppos_exist(pppos)) {
|
||||
return 0;
|
||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||
LWIP_UNUSED_ARG(pcb);
|
||||
|
||||
switch(cmd) {
|
||||
case PPPCTLG_FD: /* Get the fd associated with the ppp */
|
||||
if (!arg) {
|
||||
goto fail;
|
||||
}
|
||||
*(sio_fd_t *)arg = pppos->fd;
|
||||
return PPPERR_NONE;
|
||||
|
||||
default: ;
|
||||
}
|
||||
return pppos->fd;
|
||||
|
||||
fail:
|
||||
return PPPERR_PARAM;
|
||||
}
|
||||
|
||||
#if VJ_SUPPORT
|
||||
|
Loading…
x
Reference in New Issue
Block a user