OBEX_ObjectAddHeader

Name

OBEX_ObjectAddHeader --  Attach a header to an object

Synopsis

int OBEX_ObjectAddHeader (obex_t * self, obex_object_t * object, uint8_t hi, obex_headerdata_t hv, uint32_t hv_size, unsigned int flags);

Arguments

self

OBEX handle

object

OBEX object

hi

Header identifier

hv

Header value

hv_size

Header size

flags

See obex.h for possible values

Description

Add a new header to an object.

If you want all headers to fit in one packet, use the flag OBEX_FL_FIT_ONE_PACKET on all headers you add to an object.

To stream a body add a body header with hv.bs = NULL and set the flag OBEX_FL_STREAM_START. You will now get OBEX_EV_STREAMEMPTY events as soon as the the parser wants you to feed it with more data.

When you get an OBEX_EV_STREAMEMPTY event give the parser some data by adding a body-header and set the flag OBEX_EV_STREAM_DATA. When you have no more data to send set the flag OBEX_EV_STREAM_DATAEND instead.

After adding a header you are free to do whatever you want with the buffer if you are NOT streaming. If you are streaming you may not touch the buffer until you get another OBEX_EV_STREAMEMTPY or until the request finishes.

The headers will be sent in the order you add them.