mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-06 18:41:30 +00:00
PPP, using err_t return type on ppp_ioctl()
This commit is contained in:
parent
c8f026c382
commit
0a761d238a
@ -349,7 +349,7 @@ pppapi_do_ppp_ioctl(struct pppapi_msg_msg *msg)
|
|||||||
* Call ppp_ioctl() in a thread-safe way by running that function inside the
|
* Call ppp_ioctl() in a thread-safe way by running that function inside the
|
||||||
* tcpip_thread context.
|
* tcpip_thread context.
|
||||||
*/
|
*/
|
||||||
int
|
err_t
|
||||||
pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||||
{
|
{
|
||||||
struct pppapi_msg msg;
|
struct pppapi_msg msg;
|
||||||
|
@ -137,7 +137,7 @@ int pppapi_open(ppp_pcb *pcb, u16_t holdoff);
|
|||||||
int pppapi_close(ppp_pcb *pcb);
|
int pppapi_close(ppp_pcb *pcb);
|
||||||
void pppapi_sighup(ppp_pcb *pcb);
|
void pppapi_sighup(ppp_pcb *pcb);
|
||||||
int pppapi_free(ppp_pcb *pcb);
|
int pppapi_free(ppp_pcb *pcb);
|
||||||
int pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg);
|
err_t pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg);
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
#if LWIP_NETIF_STATUS_CALLBACK
|
||||||
void pppapi_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback);
|
void pppapi_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn status_callback);
|
||||||
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
#endif /* LWIP_NETIF_STATUS_CALLBACK */
|
||||||
|
@ -494,7 +494,7 @@ int ppp_free(ppp_pcb *pcb);
|
|||||||
* Get and set parameters for the given connection.
|
* Get and set parameters for the given connection.
|
||||||
* Return 0 on success, an error code on failure.
|
* Return 0 on success, an error code on failure.
|
||||||
*/
|
*/
|
||||||
int ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg);
|
err_t ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg);
|
||||||
|
|
||||||
/* Get the PPP netif interface */
|
/* Get the PPP netif interface */
|
||||||
#define ppp_netif(ppp) (ppp->netif)
|
#define ppp_netif(ppp) (ppp->netif)
|
||||||
|
@ -158,7 +158,7 @@ struct link_callbacks {
|
|||||||
/* configure TCP header compression */
|
/* configure TCP header compression */
|
||||||
void (*vj_config)(ppp_pcb *pcb, void *ctx, int vjcomp, int cidcomp, int maxcid);
|
void (*vj_config)(ppp_pcb *pcb, void *ctx, int vjcomp, int cidcomp, int maxcid);
|
||||||
/* Get and set parameters for the given connection. */
|
/* Get and set parameters for the given connection. */
|
||||||
int (*ioctl)(ppp_pcb *pcb, void *ctx, int cmd, void *arg);
|
err_t (*ioctl)(ppp_pcb *pcb, void *ctx, int cmd, void *arg);
|
||||||
/* Pass the processed input packet to the appropriate handler. */
|
/* Pass the processed input packet to the appropriate handler. */
|
||||||
err_t (*netif_input)(ppp_pcb *pcb, void *ctx, struct pbuf *p, u16_t protocol);
|
err_t (*netif_input)(ppp_pcb *pcb, void *ctx, struct pbuf *p, u16_t protocol);
|
||||||
};
|
};
|
||||||
|
@ -337,11 +337,12 @@ int ppp_free(ppp_pcb *pcb) {
|
|||||||
|
|
||||||
/* Get and set parameters for the given connection.
|
/* Get and set parameters for the given connection.
|
||||||
* Return 0 on success, an error code on failure. */
|
* Return 0 on success, an error code on failure. */
|
||||||
int
|
err_t
|
||||||
ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||||
{
|
{
|
||||||
if(NULL == pcb)
|
if (pcb == NULL) {
|
||||||
return PPPERR_PARAM;
|
return ERR_VAL;
|
||||||
|
}
|
||||||
|
|
||||||
switch(cmd) {
|
switch(cmd) {
|
||||||
case PPPCTLG_UPSTATUS: /* Get the PPP up status. */
|
case PPPCTLG_UPSTATUS: /* Get the PPP up status. */
|
||||||
@ -349,21 +350,21 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*(int *)arg = (int)(pcb->if_up);
|
*(int *)arg = (int)(pcb->if_up);
|
||||||
return PPPERR_NONE;
|
return ERR_OK;
|
||||||
|
|
||||||
case PPPCTLS_ERRCODE: /* Set the PPP error code. */
|
case PPPCTLS_ERRCODE: /* Set the PPP error code. */
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
pcb->err_code = (u8_t)(*(int *)arg);
|
pcb->err_code = (u8_t)(*(int *)arg);
|
||||||
return PPPERR_NONE;
|
return ERR_OK;
|
||||||
|
|
||||||
case PPPCTLG_ERRCODE: /* Get the PPP error code. */
|
case PPPCTLG_ERRCODE: /* Get the PPP error code. */
|
||||||
if (!arg) {
|
if (!arg) {
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*(int *)arg = (int)(pcb->err_code);
|
*(int *)arg = (int)(pcb->err_code);
|
||||||
return PPPERR_NONE;
|
return ERR_OK;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (pcb->link_cb->ioctl) {
|
if (pcb->link_cb->ioctl) {
|
||||||
@ -372,7 +373,7 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
return PPPERR_PARAM;
|
return ERR_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if LWIP_NETIF_STATUS_CALLBACK
|
#if LWIP_NETIF_STATUS_CALLBACK
|
||||||
|
@ -58,7 +58,7 @@ static void pppos_disconnect(ppp_pcb *ppp, void *ctx);
|
|||||||
static err_t pppos_destroy(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_send_config(ppp_pcb *ppp, void *ctx, u32_t accm);
|
||||||
static void pppos_recv_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);
|
static err_t pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg);
|
||||||
#if VJ_SUPPORT
|
#if VJ_SUPPORT
|
||||||
static void pppos_vjc_config(ppp_pcb *ppp, void *ctx, int vjcomp, int cidcomp, int maxcid);
|
static void pppos_vjc_config(ppp_pcb *ppp, void *ctx, int vjcomp, int cidcomp, int maxcid);
|
||||||
static err_t pppos_netif_input(ppp_pcb *ppp, void *ctx, struct pbuf *p, u16_t protocol);
|
static err_t pppos_netif_input(ppp_pcb *ppp, void *ctx, struct pbuf *p, u16_t protocol);
|
||||||
@ -753,7 +753,7 @@ 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]));
|
pppos->in_accm[0], pppos->in_accm[1], pppos->in_accm[2], pppos->in_accm[3]));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static err_t
|
||||||
pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg)
|
pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg)
|
||||||
{
|
{
|
||||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||||
@ -765,13 +765,13 @@ pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg)
|
|||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
*(sio_fd_t *)arg = pppos->fd;
|
*(sio_fd_t *)arg = pppos->fd;
|
||||||
return PPPERR_NONE;
|
return ERR_OK;
|
||||||
|
|
||||||
default: ;
|
default: ;
|
||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
return PPPERR_PARAM;
|
return ERR_VAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if VJ_SUPPORT
|
#if VJ_SUPPORT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user