File: xdser.h

package info (click to toggle)
xdelta 1.0.0-1
  • links: PTS
  • area: main
  • in suites: slink
  • size: 876 kB
  • ctags: 696
  • sloc: ansic: 5,154; sh: 4,717; lisp: 777; makefile: 64
file content (146 lines) | stat: -rw-r--r-- 5,139 bytes parent folder | download
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
/* -*-Mode: C;-*-
 * Xdelta - A binary delta library
 * Copyright (C) 1997, 1998  Josh MacDonald
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *
 * Author: Josh MacDonald <jmacd@CS.Berkeley.EDU>
 *
 * This file was AUTOMATICALLY GENERATED using:
 *
 * $Id: reposer.el 1.22 Thu, 01 Oct 1998 04:56:35 -0700 jmacd $
 */

#ifndef _XDSER_H_
#define _XDSER_H_

#include "serializeio.h"
/* Init */
gboolean xdser_init (void);

/* Serial Types */

enum _SerialXdType {

  ST_XdeltaChecksum = (1<<(0+SER_LIBRARY_OFFSET_BITS))+3, 
  ST_XdeltaInstruction = (1<<(1+SER_LIBRARY_OFFSET_BITS))+3, 
  ST_XdeltaSourceInfo = (1<<(2+SER_LIBRARY_OFFSET_BITS))+3, 
  ST_XdeltaControl = (1<<(3+SER_LIBRARY_OFFSET_BITS))+3, 
  ST_XdeltaIndex = (1<<(4+SER_LIBRARY_OFFSET_BITS))+3, 
  ST_RsyncIndex = (1<<(5+SER_LIBRARY_OFFSET_BITS))+3, 
  ST_RsyncIndexElt = (1<<(6+SER_LIBRARY_OFFSET_BITS))+3
};

typedef struct _SerialRsyncIndexElt SerialRsyncIndexElt;
typedef struct _SerialRsyncIndex SerialRsyncIndex;
typedef struct _SerialXdeltaIndex SerialXdeltaIndex;
typedef struct _SerialXdeltaControl SerialXdeltaControl;
typedef struct _SerialXdeltaSourceInfo SerialXdeltaSourceInfo;
typedef struct _SerialXdeltaInstruction SerialXdeltaInstruction;
typedef struct _SerialXdeltaChecksum SerialXdeltaChecksum;


struct _SerialXdeltaChecksum {
  guint16 high;
  guint16 low;
};

SerialStatus unserialize_xdeltachecksum (SerialSource *source, SerialXdeltaChecksum**);
SerialStatus serialize_xdeltachecksum (SerialSink *sink, guint16 high, guint16 low);

SerialStatus serialize_xdeltachecksum_obj (SerialSink *sink, SerialXdeltaChecksum* obj);

struct _SerialXdeltaInstruction {
  guint32 offset;
  guint32 length;
  guint8 type;
  guint8 index;
};

SerialStatus unserialize_xdeltainstruction (SerialSource *source, SerialXdeltaInstruction**);
SerialStatus serialize_xdeltainstruction (SerialSink *sink, guint32 offset, guint32 length);

SerialStatus serialize_xdeltainstruction_obj (SerialSink *sink, SerialXdeltaInstruction* obj);

struct _SerialXdeltaSourceInfo {
  guint8 md5[16];
  guint8 real_md5[16];
  guint32 length;
};

SerialStatus unserialize_xdeltasourceinfo (SerialSource *source, SerialXdeltaSourceInfo**);
SerialStatus serialize_xdeltasourceinfo (SerialSink *sink, guint8 md5[16], guint8 real_md5[16], guint32 length);

SerialStatus serialize_xdeltasourceinfo_obj (SerialSink *sink, SerialXdeltaSourceInfo* obj);

struct _SerialXdeltaControl {
  gboolean normalized;
  guint32 data_len;
  SerialXdeltaSourceInfo to_info;
  guint32 source_info_len;
  SerialXdeltaSourceInfo** source_info;
  guint32 inst_len;
  SerialXdeltaInstruction* inst;
  GArray    *inst_array;
  GPtrArray *source_info_array;
};

SerialStatus unserialize_xdeltacontrol (SerialSource *source, SerialXdeltaControl**);
SerialStatus serialize_xdeltacontrol (SerialSink *sink, gboolean normalized, guint32 data_len, SerialXdeltaSourceInfo* to_info, guint32 source_info_len, SerialXdeltaSourceInfo** source_info, guint32 inst_len, SerialXdeltaInstruction* inst);

SerialStatus serialize_xdeltacontrol_obj (SerialSink *sink, SerialXdeltaControl* obj);

struct _SerialXdeltaIndex {
  guint32 file_len;
  guint8 file_md5[16];
  guint32 index_len;
  SerialXdeltaChecksum* index;
};

SerialStatus unserialize_xdeltaindex (SerialSource *source, SerialXdeltaIndex**);
SerialStatus serialize_xdeltaindex (SerialSink *sink, guint32 file_len, guint8 file_md5[16], guint32 index_len, SerialXdeltaChecksum* index);

SerialStatus serialize_xdeltaindex_obj (SerialSink *sink, SerialXdeltaIndex* obj);

struct _SerialRsyncIndex {
  guint32 seg_len;
  guint32 file_len;
  guint8 file_md5[16];
  guint32 index_len;
  SerialRsyncIndexElt* index;
  SerialRsyncIndexElt** table;
  guint table_size;
};

SerialStatus unserialize_rsyncindex (SerialSource *source, SerialRsyncIndex**);
SerialStatus serialize_rsyncindex (SerialSink *sink, guint32 seg_len, guint32 file_len, guint8 file_md5[16], guint32 index_len, SerialRsyncIndexElt* index);

SerialStatus serialize_rsyncindex_obj (SerialSink *sink, SerialRsyncIndex* obj);

struct _SerialRsyncIndexElt {
  guint8 md5[16];
  SerialXdeltaChecksum cksum;
  SerialRsyncIndexElt* next;
  gint match_offset;
};

SerialStatus unserialize_rsyncindexelt (SerialSource *source, SerialRsyncIndexElt**);
SerialStatus serialize_rsyncindexelt (SerialSink *sink, guint8 md5[16], SerialXdeltaChecksum* cksum);

SerialStatus serialize_rsyncindexelt_obj (SerialSink *sink, SerialRsyncIndexElt* obj);


#endif /* _XDSER_H_ */