Lines Matching refs:nb
75 static err_t pppos_output_append(pppos_pcb *pppos, err_t err, struct pbuf *nb, u8_t c, u8_t accm, u16_t *fcs);
76 static err_t pppos_output_last(pppos_pcb *pppos, err_t err, struct pbuf *nb, u16_t *fcs);
204 struct pbuf *nb;
213 nb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
214 if (nb == NULL) {
223 /* Set nb->tot_len to actual payload length */
224 nb->tot_len = p->len;
230 err = pppos_output_append(pppos, err, nb, PPP_FLAG, 0, NULL);
238 err = pppos_output_append(pppos, err, nb, *s++, 1, &fcs_out);
241 err = pppos_output_last(pppos, err, nb, &fcs_out);
256 struct pbuf *nb, *p;
264 nb = pbuf_alloc(PBUF_RAW, 0, PBUF_POOL);
265 if (nb == NULL) {
273 /* Set nb->tot_len to actual payload length */
274 nb->tot_len = pb->tot_len;
280 err = pppos_output_append(pppos, err, nb, PPP_FLAG, 0, NULL);
285 err = pppos_output_append(pppos, err, nb, PPP_ALLSTATIONS, 1, &fcs_out);
286 err = pppos_output_append(pppos, err, nb, PPP_UI, 1, &fcs_out);
289 err = pppos_output_append(pppos, err, nb, (protocol >> 8) & 0xFF, 1, &fcs_out);
291 err = pppos_output_append(pppos, err, nb, protocol & 0xFF, 1, &fcs_out);
299 err = pppos_output_append(pppos, err, nb, *s++, 1, &fcs_out);
303 err = pppos_output_last(pppos, err, nb, &fcs_out);
823 pppos_output_append(pppos_pcb *pppos, err_t err, struct pbuf *nb, u8_t c, u8_t accm, u16_t *fcs)
832 if ((PBUF_POOL_BUFSIZE - nb->len) < 2) {
833 u32_t l = pppos->output_cb(pppos->ppp, (u8_t*)nb->payload, nb->len, pppos->ppp->ctx_cb);
834 if (l != nb->len) {
837 nb->len = 0;
847 *((u8_t*)nb->payload + nb->len++) = PPP_ESCAPE;
848 *((u8_t*)nb->payload + nb->len++) = c ^ PPP_TRANS;
850 *((u8_t*)nb->payload + nb->len++) = c;
857 pppos_output_last(pppos_pcb *pppos, err_t err, struct pbuf *nb, u16_t *fcs)
862 err = pppos_output_append(pppos, err, nb, ~(*fcs) & 0xFF, 1, NULL);
863 err = pppos_output_append(pppos, err, nb, (~(*fcs) >> 8) & 0xFF, 1, NULL);
864 err = pppos_output_append(pppos, err, nb, PPP_FLAG, 0, NULL);
871 if (nb->len > 0) {
872 u32_t l = pppos->output_cb(ppp, (u8_t*)nb->payload, nb->len, ppp->ctx_cb);
873 if (l != nb->len) {
880 MIB2_STATS_NETIF_ADD(ppp->netif, ifoutoctets, nb->tot_len);
883 pbuf_free(nb);
891 pbuf_free(nb);