Hi all.
i have a pbuf from pool, where my driver has copied a packet.
i used this code:
/* We allocate a pbuf chain of pbufs from the pool. */
p = pbuf_alloc(PBUF_RAW, len, PBUF_POOL);
if (p != NULL) {
#if ETH_PAD_SIZE
pbuf_header(p, -ETH_PAD_SIZE); /* drop the padding word */
#endif
// lock eth irq
disableEthInterrupt();
/* We iterate over the pbuf chain until we have read the entire
* packet into the pbuf. */
cpyix = 0;
for( q = p; q != NULL; q = q->next )
{
/* Read enough bytes to fill this pbuf in the chain. The
* available data in the pbuf is given by the q->len
* variable. */
if (q->len >= len)
cpylen = len;
else
cpylen = q->len;
last = CopyFromFrameEMAC(q->payload, cpylen);
len = len - cpylen;
cpyix = cpyix + cpylen;
}
i have a caller function which get this pbuf, and i need to duplicate it in
another similar pbuf.
Someone can suggest a simple piece of code? i have some problem to
understing how manage pbufs.
thanks,
Piero
_______________________________________________
lwip-users mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/lwip-users