diff --git a/src/main.c b/src/main.c index f7d9439..16e08f1 100644 --- a/src/main.c +++ b/src/main.c @@ -114,6 +114,15 @@ nodeid_t raw1394_get_local_id(struct raw1394_handle *handle) return handle->local_id; } +void *raw1394_get_userdata(struct raw1394_handle *handle) +{ + return handle->userdata; +} + +void raw1394_set_userdata(struct raw1394_handle *handle, void *data) +{ + handle->userdata = data; +} int raw1394_get_port_info(struct raw1394_handle *handle, struct raw1394_portinfo *pinf, int maxports) diff --git a/src/raw1394.h b/src/raw1394.h index 88c50f5..1c17172 100644 --- a/src/raw1394.h +++ b/src/raw1394.h @@ -31,6 +31,13 @@ void raw1394_destroy_handle(raw1394handle_t handle); */ int raw1394_get_fd(raw1394handle_t handle); +/* + * Set and get user data. This isn't used inside libraw1394, you can use it for + * your own purposes. + */ +void *raw1394_get_userdata(raw1394handle_t handle); +void raw1394_set_userdata(raw1394handle_t handle, void *data); + unsigned int raw1394_get_generation(raw1394handle_t handle); nodeid_t raw1394_get_local_id(raw1394handle_t handle); diff --git a/src/raw1394_private.h b/src/raw1394_private.h index e8440b8..fed60c9 100644 --- a/src/raw1394_private.h +++ b/src/raw1394_private.h @@ -16,6 +16,8 @@ struct raw1394_handle { struct raw1394_request req; quadlet_t buffer[2048]; + + void *userdata; }; struct sync_cb_data {