libraw1394: version 0.9
Prev | Chapter 3. Data Structures and Program Flow | Next

# Handlers

There are a number of handlers which can be set using the appropriate function as described in the function reference and which libraw1394 will call during a `raw1394_loop_iterate()`. These are:

- tag handler (called for completed commands)

- bus reset handler (called when a bus reset happens)

- iso handler (called when an iso packet is received)

- fcp handler (called when a FCP command or response is received)

The bus reset handler is always called, the tag handler for every command that completes, the iso handler and fcp handler are only called when the application chooses to receive these packets. Handlers return an integer value which is passed on by `raw1394_loop_iterate()` (only one handler is called per invocation), `0` is returned without a handler in place.

The tag handler case is a bit special since the default handler is actually doing something. Every command that you start can be given an unsigned long tag which is passed untouched to the tag handler when the event loop sees a completed command. The default handler expects this value to be a pointer to a raw1394_reqhandle structure, which contains a data pointer and its own callback function pointer. The callback gets the untouched data pointer and error code as arguments. If you want to use tags that are not raw1394_reqhandle pointers you have to set up your own tag handler.

Prev | Home | Next
The Event Loop | Up | Function Reference