mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-01-30 12:32:37 +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
|
||||
* tcpip_thread context.
|
||||
*/
|
||||
int
|
||||
err_t
|
||||
pppapi_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||
{
|
||||
struct pppapi_msg msg;
|
||||
|
@ -137,7 +137,7 @@ int pppapi_open(ppp_pcb *pcb, u16_t holdoff);
|
||||
int pppapi_close(ppp_pcb *pcb);
|
||||
void pppapi_sighup(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
|
||||
void pppapi_set_netif_statuscallback(ppp_pcb *pcb, netif_status_callback_fn 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.
|
||||
* 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 */
|
||||
#define ppp_netif(ppp) (ppp->netif)
|
||||
|
@ -158,7 +158,7 @@ struct link_callbacks {
|
||||
/* 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);
|
||||
err_t (*ioctl)(ppp_pcb *pcb, void *ctx, int cmd, void *arg);
|
||||
/* Pass the processed input packet to the appropriate handler. */
|
||||
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.
|
||||
* Return 0 on success, an error code on failure. */
|
||||
int
|
||||
err_t
|
||||
ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||
{
|
||||
if(NULL == pcb)
|
||||
return PPPERR_PARAM;
|
||||
if (pcb == NULL) {
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
switch(cmd) {
|
||||
case PPPCTLG_UPSTATUS: /* Get the PPP up status. */
|
||||
@ -349,21 +350,21 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||
goto fail;
|
||||
}
|
||||
*(int *)arg = (int)(pcb->if_up);
|
||||
return PPPERR_NONE;
|
||||
return ERR_OK;
|
||||
|
||||
case PPPCTLS_ERRCODE: /* Set the PPP error code. */
|
||||
if (!arg) {
|
||||
goto fail;
|
||||
}
|
||||
pcb->err_code = (u8_t)(*(int *)arg);
|
||||
return PPPERR_NONE;
|
||||
return ERR_OK;
|
||||
|
||||
case PPPCTLG_ERRCODE: /* Get the PPP error code. */
|
||||
if (!arg) {
|
||||
goto fail;
|
||||
}
|
||||
*(int *)arg = (int)(pcb->err_code);
|
||||
return PPPERR_NONE;
|
||||
return ERR_OK;
|
||||
|
||||
default:
|
||||
if (pcb->link_cb->ioctl) {
|
||||
@ -372,7 +373,7 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
|
||||
}
|
||||
|
||||
fail:
|
||||
return PPPERR_PARAM;
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
#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 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);
|
||||
static err_t 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);
|
||||
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]));
|
||||
}
|
||||
|
||||
static int
|
||||
static err_t
|
||||
pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg)
|
||||
{
|
||||
pppos_pcb *pppos = (pppos_pcb *)ctx;
|
||||
@ -765,13 +765,13 @@ pppos_ioctl(ppp_pcb *pcb, void *ctx, int cmd, void *arg)
|
||||
goto fail;
|
||||
}
|
||||
*(sio_fd_t *)arg = pppos->fd;
|
||||
return PPPERR_NONE;
|
||||
return ERR_OK;
|
||||
|
||||
default: ;
|
||||
}
|
||||
|
||||
fail:
|
||||
return PPPERR_PARAM;
|
||||
return ERR_VAL;
|
||||
}
|
||||
|
||||
#if VJ_SUPPORT
|
||||
|
Loading…
x
Reference in New Issue
Block a user