diff options
Diffstat (limited to 'src/main/extractor_ipc.h')
-rw-r--r-- | src/main/extractor_ipc.h | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/main/extractor_ipc.h b/src/main/extractor_ipc.h index 9372133..e1d2f37 100644 --- a/src/main/extractor_ipc.h +++ b/src/main/extractor_ipc.h | |||
@@ -21,6 +21,47 @@ | |||
21 | * @file main/extractor_ipc.h | 21 | * @file main/extractor_ipc.h |
22 | * @brief IPC with plugin (OS-independent API) | 22 | * @brief IPC with plugin (OS-independent API) |
23 | * @author Christian Grothoff | 23 | * @author Christian Grothoff |
24 | * | ||
25 | * @detail | ||
26 | * The IPC communication between plugins and the main library works | ||
27 | * as follows. Each message begins with a 1-character opcode which | ||
28 | * specifies the message type. The main library starts the plugins | ||
29 | * by forking the helper process and establishes two pipes for | ||
30 | * communication in both directions. | ||
31 | * First, the main library send an 'INIT_STATE' message | ||
32 | * to the plugin. The start message specifies the name (and size) | ||
33 | * of a shared memory segment which will contain parts of the the (uncompressed) | ||
34 | * data of the file that is being processed. The same shared memory | ||
35 | * segment is used throughout the lifetime of the plugin. | ||
36 | * | ||
37 | * Then, the following messages are exchanged for each file. | ||
38 | * First, an EXTRACT_START message is sent with the specific | ||
39 | * size of the file (or -1 if unknown) and the number of bytes | ||
40 | * ready in the shared memory segment. The plugin then answers | ||
41 | * with either: | ||
42 | * 1) MESSAGE_DONE to indicate that no further processing is | ||
43 | * required for this file; the IPC continues with the | ||
44 | * EXTRACT_START message for the next file afterwards; | ||
45 | * 2) MESSAGE_SEEK to indicate that the plugin would like to | ||
46 | * read data at a different offset; the main library can | ||
47 | * then either | ||
48 | * a) respond with a MESSAGE_DISCARD_STATE to | ||
49 | * tell the plugin to abort processing (the next message will | ||
50 | * then be another EXTRACT_START) | ||
51 | * b) respond with a MESSAGE_UPDATED_SHM which notifies the | ||
52 | * plugin that the shared memory segment was moved to a | ||
53 | * different location in the overall file; the target of the | ||
54 | * seek should now be within the new range (but does NOT have | ||
55 | * to be at the beginning of the seek) | ||
56 | * 3) MESSAGE_META to provide extracted meta data to the main | ||
57 | * library. The main library can then either: | ||
58 | * a) respond with a MESSAGE_DISCARD_STATE to | ||
59 | * tell the plugin to abort processing (the next message will | ||
60 | * then be another EXTRACT_START) | ||
61 | * b) respond with a MESSAGE_CONTINUE_EXTRACTING to | ||
62 | * tell the plugin to continue extracting meta data; in this | ||
63 | * case, the plugin is then expected to produce another | ||
64 | * MESSAGE_DONE, MESSAGE_SEEK or MESSAGE_META round of messages. | ||
24 | */ | 65 | */ |
25 | #ifndef EXTRACTOR_IPC_H | 66 | #ifndef EXTRACTOR_IPC_H |
26 | #define EXTRACTOR_IPC_H | 67 | #define EXTRACTOR_IPC_H |