diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-11 19:40:24 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2013-05-11 19:40:24 +0900 |
| commit | e350df2d7597b73945d2e8a7eeef9b32867f98d2 (patch) | |
| tree | 683545263414be919df260c4a8638f7dfae171f4 /src/includes | |
| parent | 1c571f196af0013e1b0ad1c9e075ed9c711e915b (diff) | |
Add download event callback API and its example
Diffstat (limited to 'src/includes')
| -rw-r--r-- | src/includes/aria2/aria2.h | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/includes/aria2/aria2.h b/src/includes/aria2/aria2.h index 5671c4ee..86ef420d 100644 --- a/src/includes/aria2/aria2.h +++ b/src/includes/aria2/aria2.h @@ -131,6 +131,21 @@ enum DownloadEvent { }; /** + * @functypedef + * + * Callback function invoked when download event occurred. The |event| + * indicates the event. See :type:`DownloadEvent` for events. The + * |gid| refers to the download which this event was fired on. The + * |userData| is a pointer specified in + * :member:`SessionConfig::userData`. + * + * At the moment, the return value is ignored, but the implementation + * of this callback should return 0 for compatibility. + */ +typedef int (*DownloadEventCallback)(Session* session, DownloadEvent event, + const A2Gid& gid, void* userData); + +/** * @struct * * The configuration for the session. @@ -166,6 +181,17 @@ struct SessionConfig { * handled like shutdown(session, false) is called. */ bool useSignalHandler; + /** + * Specify the callback function which will be invoked when download + * event occurred. See :type:`DownloadEvent` about the download + * event. The default value is ``NULL``. + */ + DownloadEventCallback downloadEventCallback; + /** + * Pointer to user defined data. libaria2 treats this as opaque + * pointer and will not free it. The default value is ``NULL``. + */ + void* userData; }; /** |
