diff options
Diffstat (limited to 'src/main/extractor_datasource.h')
-rw-r--r-- | src/main/extractor_datasource.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/src/main/extractor_datasource.h b/src/main/extractor_datasource.h index 5037377..1769a72 100644 --- a/src/main/extractor_datasource.h +++ b/src/main/extractor_datasource.h | |||
@@ -30,10 +30,13 @@ struct EXTRACTOR_Datasource; | |||
30 | * Create a datasource from a file on disk. | 30 | * Create a datasource from a file on disk. |
31 | * | 31 | * |
32 | * @param filename name of the file on disk | 32 | * @param filename name of the file on disk |
33 | * @return handle to the datasource | 33 | * @param proc metadata callback to call with meta data found upon opening |
34 | * @param proc_cls callback cls | ||
35 | * @return handle to the datasource, NULL on error | ||
34 | */ | 36 | */ |
35 | struct EXTRACTOR_Datasource * | 37 | struct EXTRACTOR_Datasource * |
36 | EXTRACTOR_datasource_create_from_file_ (const char *filename); | 38 | EXTRACTOR_datasource_create_from_file_ (const char *filename, |
39 | EXTRACTOR_MetaDataProcessor proc, void *proc_cls); | ||
37 | 40 | ||
38 | 41 | ||
39 | /** | 42 | /** |
@@ -41,24 +44,27 @@ EXTRACTOR_datasource_create_from_file_ (const char *filename); | |||
41 | * | 44 | * |
42 | * @param buf data in memory | 45 | * @param buf data in memory |
43 | * @param size number of bytes in 'buf' | 46 | * @param size number of bytes in 'buf' |
44 | * @return handle to the datasource | 47 | * @param proc metadata callback to call with meta data found upon opening |
48 | * @param proc_cls callback cls | ||
49 | * @return handle to the datasource, NULL on error | ||
45 | */ | 50 | */ |
46 | struct EXTRACTOR_Datasource * | 51 | struct EXTRACTOR_Datasource * |
47 | EXTRACTOR_datasource_create_from_buffer_ (const char *buf, | 52 | EXTRACTOR_datasource_create_from_buffer_ (const char *buf, |
48 | size_t size); | 53 | size_t size, |
54 | EXTRACTOR_MetaDataProcessor proc, void *proc_cls); | ||
49 | 55 | ||
50 | 56 | ||
51 | /** | 57 | /** |
52 | * Destroy a data source. | 58 | * Destroy a data source. |
53 | * | 59 | * |
54 | * @param datasource source to destroy | 60 | * @param ds source to destroy |
55 | */ | 61 | */ |
56 | void | 62 | void |
57 | EXTRACTOR_datasource_destroy_ (struct EXTRACTOR_Datasource *datasource); | 63 | EXTRACTOR_datasource_destroy_ (struct EXTRACTOR_Datasource *ds); |
58 | 64 | ||
59 | 65 | ||
60 | /** | 66 | /** |
61 | * Make 'size' bytes of data from the data source available at '*data'. | 67 | * Make 'size' bytes of data from the data source available at 'data'. |
62 | * | 68 | * |
63 | * @param cls must be a 'struct EXTRACTOR_Datasource' | 69 | * @param cls must be a 'struct EXTRACTOR_Datasource' |
64 | * @param data where the data should be copied to | 70 | * @param data where the data should be copied to |
@@ -77,12 +83,12 @@ EXTRACTOR_datasource_read_ (void *cls, | |||
77 | * obtain the current position in the file. | 83 | * obtain the current position in the file. |
78 | * | 84 | * |
79 | * @param cls must be a 'struct EXTRACTOR_Datasource' | 85 | * @param cls must be a 'struct EXTRACTOR_Datasource' |
80 | * @param pos position to seek (see 'man lseek') | 86 | * @param pos position to seek (see 'man lseek')o |
81 | * @param whence how to see (absolute to start, relative, absolute to end) | 87 | * @param whence how to see (absolute to start, relative, absolute to end) |
82 | * @return new absolute position, UINT64_MAX on error (i.e. desired position | 88 | * @return new absolute position, -1 on error (i.e. desired position |
83 | * does not exist) | 89 | * does not exist) |
84 | */ | 90 | */ |
85 | uint64_t | 91 | int64_t |
86 | EXTRACTOR_datasource_seek_ (void *cls, | 92 | EXTRACTOR_datasource_seek_ (void *cls, |
87 | uint64_t pos, | 93 | uint64_t pos, |
88 | int whence); | 94 | int whence); |
@@ -92,9 +98,9 @@ EXTRACTOR_datasource_seek_ (void *cls, | |||
92 | * Determine the overall size of the data source (after compression). | 98 | * Determine the overall size of the data source (after compression). |
93 | * | 99 | * |
94 | * @param cls must be a 'struct EXTRACTOR_Datasource' | 100 | * @param cls must be a 'struct EXTRACTOR_Datasource' |
95 | * @return overall file size, UINT64_MAX on error (i.e. IPC failure) | 101 | * @return overall file size, -1 on error or unknown |
96 | */ | 102 | */ |
97 | uint64_t | 103 | int64_t |
98 | EXTRACTOR_datasource_get_size_ (void *cls); | 104 | EXTRACTOR_datasource_get_size_ (void *cls); |
99 | 105 | ||
100 | 106 | ||