So use evbuffer_expand() before data arrives to make sure that your contiguous 
buffer is big enough.



> On Nov 15, 2016, at 1:27 PM, Devi Prasad Ivaturi <[email protected]> wrote:
> 
> In the front only, if you want to call it that way.
> 
> Say, I want to just modify the TTL or TOS values of IP header of a network 
> packet (accessed using evbuffer API)
> passing through my box: don't want to use pullup() which is costly, since, 
> the IP header could be a few headers
> away from the beginning (MAC + other enapsulations).
> 
> I don't understand how add_reference() would meet the need: I want to modify 
> the bytes in the packet headers, from
> less than a byte upto 16 bytes max.
> 
> Regards,
> -devi
> 
> On Tue, Nov 15, 2016 at 11:35 AM, Philip Prindeville 
> <[email protected] 
> <mailto:[email protected]>> wrote:
> Where in the buffer is the data?  Is it near the front or not?
> 
> If it’s near the front, then use evbuffer_pullup().  Otherwise, you could 
> provide your own underlying storage with evbuffer_add_reference().
> 
> 
> 
>> On Nov 15, 2016, at 11:58 AM, Devi Prasad Ivaturi <[email protected] 
>> <mailto:[email protected]>> wrote:
>> 
>> And I get the impression that these API are to insert data rather than 
>> modify existing data.
>> 
>> 
>> On Nov 15, 2016 10:43 AM, "Devi Prasad Ivaturi" <[email protected] 
>> <mailto:[email protected]>> wrote:
>> BTW, I did consider reserve/commit space API, but, thought they might be an 
>> overkill. I prefer peeking the byte location and modifying it.
>> 
>> 
>> On Nov 15, 2016 10:12 AM, "Devi Prasad Ivaturi" <[email protected] 
>> <mailto:[email protected]>> wrote:
>> How can I modify a byte or two directly in evbuffer data?
>> 
>> 
>> 
> 
> 

Reply via email to