File: programming.txt

package info (click to toggle)
libewf 20140816-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 20,940 kB
  • sloc: ansic: 347,781; sh: 8,203; cpp: 3,819; makefile: 2,096; yacc: 1,104; python: 439; lex: 394; sed: 16
file content (75 lines) | stat: -rw-r--r-- 1,981 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
Getting started with programming libewf:

Define a handle object and make sure to set it to NULL, like:
libewf_handle_t *handle = NULL;

Initialize the handle:
libewf_error_t *error = NULL;

if( libewf_handle_initialize(
     &handle,
     &error ) != 1 )
{
	<error>
}

The &error argument can also be NULL. Libewf created an error object on error (return value -1).
The information in the error object can be accessed with the corresponding 'libewf_error_' functions.
After use 'free' the error object using 'libewf_error_free'.

After initializing the handle object it can be used to open a set of EWF files.
E.g. to open a set of EWF files for reading.

if( libewf_handle_open(
     handle,
     filename,
     number_of_filenames,
     LIBEWF_OPEN_READ,
     error ) != 1 )
{
	<error>
}

You'll need to pass all the filenames part of the set.
If you only have the first filename of the set use the 'libewf_glob' function to determine the
others.

After the handle object has been opened the storage media data can be read from the EWF files
using 'libewf_handle_read_buffer' or 'libewf_handle_read_random'.

If done reading or writing close the handle object.

if( libewf_handle_close(
     handle,
     &error ) != 0 )
{
	<error>
}

Note that the return value corresponds to that of the 'close' function.

After use 'free' the handle object using:

if( libewf_handle_free(
     &handle,
     &error ) != 1 )
{
	<error>
}


Multi-threading and low-level IO:

Libewf is not tread-safe but offers several functions to perform 'low-level IO'.
These are:
* libewf_handle_prepare_read_chunk
* libewf_handle_read_chunk
* libewf_handle_prepare_write_chunk
* libewf_handle_write_chunk

The 'libewf_handle_read_chunk' function read a chunk of data as stored in the EWF files,
The 'libewf_handle_prepare_read_chunk' prepares the chunk of data for processing, i.e. if
the chunk is compressed the function will decompress the data.

The prepare functions can be used by multiple threads.