lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] Need help to understand the pbuf_header function????


From: Kieran Mansley
Subject: Re: [lwip-users] Need help to understand the pbuf_header function????
Date: Tue, 3 Jun 2003 14:40:36 +0100 (BST)

On Tue, 3 Jun 2003, Kelly Chan wrote:

> The function below shows the pbuf size by moving forward the payload ptr. I
> understand we can strip of header by moving backward the payload ptr, I
> don;t understand how can we expand the advance the payload ptr to accomdate
> the new header. Will the memory corrupt by using this function??? Is it
> memory safe?????

Basically when first allocated (to send a packet) a pbuf has the payload
pointing at an offset into the memory assigned to it.  This offset is
cleverly chosen to leave just enough room for the headers.  Therefore as
the various headers get tacked on the front the pbuf_header routine moves
the pointer closer and closer to the beginning of the allocated memory,
but should hopefully (if everything is working as it should) never fall
off the front.

In reality it doesn't cope well with all the different types of pbuf
(PBUF_ROM for example), but this has been discussed in the past.

Kieran





reply via email to

[Prev in Thread] Current Thread [Next in Thread]