[asterisk-dev] f->offset - How should it be used ?

Jacob Tinning tinning at sifira.dk
Wed Apr 19 07:58:56 MST 2006


I have a question about the offset field in the frame structure.
It seems to me that to read the data from a frame, I need these three fields:

1. f->data
2. f->datalen
3. f->offset

The offset indicates where in the data buffer, the actual data starts.
f->offset is typically 0 or AST_FRIENDLY_OFFSET.

My question now is: "How do I read the data buffer correctly ?"

Do I start from f->data + f->offset and read f->datalen bytes ?

or Do I start from f->data + f->offset and read f->datalen - f->offset bytes ?
or Do I start from f->data and read f->datalen bytes ?

In other words. Does f->datalen include the offset ?

Mvh. Jacob

-- 
Jacob Tinning
System Developer                                           SIFIRA A/S



More information about the asterisk-dev mailing list