mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2025-02-06 00:39:59 +00:00
PPP, PPPoS, add pppos_input_tcpip() input helper function for !NO_SYS users
This commit is contained in:
parent
4b035b9902
commit
77f7d99048
@ -103,6 +103,11 @@ struct pppos_pcb_s {
|
|||||||
ppp_pcb *pppos_create(struct netif *pppif, sio_fd_t fd,
|
ppp_pcb *pppos_create(struct netif *pppif, sio_fd_t fd,
|
||||||
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
ppp_link_status_cb_fn link_status_cb, void *ctx_cb);
|
||||||
|
|
||||||
|
#if !NO_SYS
|
||||||
|
/* Pass received raw characters to PPPoS to be decoded through lwIP TCPIP thread. */
|
||||||
|
err_t pppos_input_tcpip(ppp_pcb *ppp, u_char *s, int l);
|
||||||
|
#endif /* !NO_SYS */
|
||||||
|
|
||||||
/* PPP over Serial: this is the input function to be called for received data. */
|
/* PPP over Serial: this is the input function to be called for received data. */
|
||||||
void pppos_input(ppp_pcb *ppp, u_char* data, int len);
|
void pppos_input(ppp_pcb *ppp, u_char* data, int len);
|
||||||
|
|
||||||
|
@ -528,6 +528,33 @@ pppos_destroy(ppp_pcb *ppp, void *ctx)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if !NO_SYS
|
#if !NO_SYS
|
||||||
|
/** Pass received raw characters to PPPoS to be decoded through lwIP TCPIP thread.
|
||||||
|
*
|
||||||
|
* @param pcb PPP descriptor index, returned by pppos_create()
|
||||||
|
* @param data received data
|
||||||
|
* @param len length of received data
|
||||||
|
*/
|
||||||
|
err_t
|
||||||
|
pppos_input_tcpip(ppp_pcb *ppp, u_char *s, int l)
|
||||||
|
{
|
||||||
|
struct pbuf *p, *n;
|
||||||
|
u8_t *cur;
|
||||||
|
|
||||||
|
p = pbuf_alloc(PBUF_RAW, l, PBUF_POOL);
|
||||||
|
if (!p) {
|
||||||
|
return ERR_MEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
cur = s;
|
||||||
|
for (n = p; n; n = n->next) {
|
||||||
|
MEMCPY(n->payload, cur, n->len);
|
||||||
|
cur += n->len;
|
||||||
|
}
|
||||||
|
|
||||||
|
return tcpip_input(p, ppp_netif(ppp));
|
||||||
|
}
|
||||||
|
|
||||||
|
/* called from TCPIP thread */
|
||||||
static err_t pppos_input_sys(struct pbuf *p, struct netif *inp) {
|
static err_t pppos_input_sys(struct pbuf *p, struct netif *inp) {
|
||||||
ppp_pcb *ppp = (ppp_pcb*)inp->state;
|
ppp_pcb *ppp = (ppp_pcb*)inp->state;
|
||||||
struct pbuf *n;
|
struct pbuf *n;
|
||||||
@ -565,7 +592,7 @@ PACK_STRUCT_END
|
|||||||
* thread safe. You should also avoid calling pppos_input() if PPPoS session
|
* thread safe. You should also avoid calling pppos_input() if PPPoS session
|
||||||
* is not started yet.
|
* is not started yet.
|
||||||
*
|
*
|
||||||
* @param pcb PPP descriptor index, returned by ppp_new()
|
* @param pcb PPP descriptor index, returned by pppos_create()
|
||||||
* @param data received data
|
* @param data received data
|
||||||
* @param len length of received data
|
* @param len length of received data
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user