]> git.wh0rd.org Git - dump.git/blob - common/transformation_null.c
Encryption (and compression as plugins) support.
[dump.git] / common / transformation_null.c
1 #include <stdio.h>
2 #include <config.h>
3
4 #include "transformation.h"
5
6 /*
7  * Initialize
8  */
9 static int
10 null_initialize(Transformation *xform, int enc)
11 {
12         return 0;
13 }
14
15 /*
16  * Shut down.
17  */
18 static int
19 null_shutdown(Transformation *xform)
20 {
21         return 0;
22 }
23
24 /*
25  * Handle fork.
26  */
27 static int
28 null_startNewTape(Transformation *xform, struct tapebuf *tpbin,
29         unsigned long *destlen)
30 {
31         return 0;
32 }
33
34 /*
35  * Start slave process.
36  */
37 static int
38 null_startDiskIOProcess(Transformation *xform)
39 {
40         return 0;
41 }
42
43 /*
44  * End slave process.
45  */
46 static int
47 null_endDiskIOProcess(Transformation *xform)
48 {
49         return 0;
50 }
51
52 /*
53  * Compress a buffer.
54  */
55 static int
56 null_compress(Transformation *xform, struct tapebuf *tpbin, unsigned long *destlen,
57                 const char *src, int srclen)
58 {
59         memcpy(tpbin->buf, src, srclen);
60         *destlen = srclen;
61
62         return 1;
63 }
64
65 /*
66  * Decompress a buffer.
67  */
68 static int
69 null_decompress(Transformation *xform, struct tapebuf *tpbin, unsigned long *destlen,
70                 const char *src, int srclen, char **reason)
71 {
72         memcpy(tpbin->buf, src, srclen);
73         *destlen = srclen;
74
75         return 1;
76 }
77
78 /*
79  *
80  */
81 Transformation transformation_null =
82 {
83         0,
84         NULL,
85         "null",
86         0,
87         &null_initialize,
88         &null_shutdown,
89         &null_startNewTape,
90         &null_startDiskIOProcess,
91         &null_endDiskIOProcess,
92         &null_compress,
93         &null_decompress
94 };