1;; -*- Emacs-Lisp -*-
2
3(defmodule xd 3 "xdelta.h" nil)
4
5(defimport "libedsio/edsio.ser")
6
7(defsertype XdeltaChecksum 1
8  ((high uint16)
9   (low  uint16)
10   )
11  ()
12  )
13
14(defsertype XdeltaIndex 2
15  ((file_len uint)
16   (file_md5 (bytes 16))
17   (index    (array XdeltaChecksum))
18   )
19  ()
20  )
21
22(defsertype XdeltaSourceInfo 3
23  ((name string)
24   (md5 (bytes 16))
25   (len uint)
26   (isdata     boolean) ;;; if true, then its source index is 0 and it is the data segment
27   (sequential boolean) ;;; if true, then offset field is not persistent, but instead
28                        ;;; recomputed when loaded as the sum of
29			;;; previous instruction's length fields, to
30			;;; indicate a sequential read
31   )
32  ("guint32       position"
33   "guint32       copies"
34   "guint32       copy_length"
35   "FileHandle   *in")
36  )
37
38(defsertype XdeltaControl 7
39  ((to_md5         (bytes 16))
40   (to_len         uint)
41   (has_data       boolean)
42   (source_info    (array (ptr XdeltaSourceInfo)))
43   (inst           (array XdeltaInstruction))
44   )
45  ("GArray    *inst_array"
46   "GPtrArray *source_info_array"
47   )
48  )
49
50(defsertype XdeltaInstruction 8
51  ((index  uint)
52   (offset uint)
53   (length uint)
54   )
55  ("guint32 output_start")
56  )
57
58;; rsync stuff
59
60(defsertype RsyncIndexElt 9
61  ((md5   (bytes 16))
62   (cksum XdeltaChecksum)
63   )
64  ("SerialRsyncIndexElt* next"
65   "gint match_offset")
66  )
67
68(defsertype RsyncIndex 10
69  ((seg_len  uint)
70   (file_len uint)
71   (file_md5 (bytes 16))
72   (index    (array RsyncIndexElt))
73   )
74  ("SerialRsyncIndexElt** table"
75   "guint table_size")
76  )
77
78;; backward compat, these are the 1.0 defs
79
80(defsertype Version0SourceInfo 4
81  ((md5 (bytes 16))
82   (real_md5 (bytes 16))
83   (length uint)
84   )
85  ()
86  )
87
88(defsertype Version0Control 5
89  ((normalized boolean)
90   (data_len   uint)
91   (to_info    Version0SourceInfo)
92   (source_info (array (ptr Version0SourceInfo)))
93   (inst        (array Version0Instruction))
94   )
95  ("GArray    *inst_array"
96   "GPtrArray *source_info_array"
97   )
98  )
99
100(defsertype Version0Instruction 6
101  ((offset uint)
102   (length uint)
103   )
104  ("guint8 type"  ;; these two fields get packed into length
105   "guint8 index"
106   )
107  )
108
109;; events
110
111(defetype handle "FileHandle*")
112
113(defevent TooFewSources Error () ()
114  "Too few input sources")
115
116(defevent TooManySources Error () ()
117  "Too many input sources")
118
119(defevent OutOfRangeSourceIndex Error ((index int)) ()
120  "Instruction references out-of-range source index: ${INDEX}")
121
122(defevent InvalidControl Error () ()
123  "Delta control is corrupt")
124
125(defevent InvalidRsyncCache Error () ()
126  "The rsync checksum cache is corrupt")
127
128(defevent IncompatibleDelta Error () ()
129  "The delta was not produced according by the `xdelta delta' command")
130
131(defevent StreamChecksumFailed Error ((stream handle) (expected string) (received string)) ()
132  "${STREAM}: Checksum validation failed, expected: ${EXPECTED}, received: ${RECEIVED}")
133
134(defevent StreamLengthFailed Error ((stream handle) (expected int) (received int)) ()
135  "${STREAM}: Length validation failed, expected: ${EXPECTED}, received: ${RECEIVED}")
136
137(defevent BackwardCompatibilityMode Information ((version string)) ()
138  "Reading a version ${VERSION} delta control")
139