pbf_parser 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 39a380f089b7268bb4e896f9ebdd39eabe223b54
4
+ data.tar.gz: 12e3a23d0c28f6a9c144058690af5c5c95bcc6fc
5
+ SHA512:
6
+ metadata.gz: f9e5d377fb865ba09704edca3626e070abb500d466ffc9f8955ebba2b13846556819e68979a202d3cce201aa091d774cbce781df3bba5b3744d223e6771310b2
7
+ data.tar.gz: 4ac0b30a31029d4e77442e04282bb19897b0e322dd84b530e92323639b6545243fbff14b67da98c4611c6e719655ce516d0f361a7ef84b4fa34a1546c756548a
@@ -0,0 +1,29 @@
1
+ require 'mkmf'
2
+
3
+ LIBDIR = RbConfig::CONFIG['libdir']
4
+ INCLUDEDIR = RbConfig::CONFIG['includedir']
5
+
6
+ HEADER_DIRS = [
7
+ '/opt/local/include',
8
+ '/usr/local/include',
9
+ '/usr/include',
10
+ INCLUDEDIR
11
+ ]
12
+
13
+ LIB_DIRS = [
14
+ '/opt/local/lib',
15
+ '/usr/local/lib',
16
+ '/usr/lib',
17
+ LIBDIR
18
+ ]
19
+
20
+ dir_config('protobuf-c', HEADER_DIRS, LIB_DIRS)
21
+ dir_config('zlib', HEADER_DIRS, LIB_DIRS)
22
+
23
+ abort "protobuf-c is required" unless find_header('google/protobuf-c/protobuf-c.h')
24
+ abort "zlib is required" unless find_header('zlib.h')
25
+
26
+ abort "protobuf-c is required" unless find_library('protobuf-c', 'protobuf_c_message_unpack')
27
+ abort "zlib is required" unless find_library('z', 'inflate')
28
+
29
+ create_makefile('pbf_parser/pbf_parser')
@@ -0,0 +1,248 @@
1
+ /* Generated by the protocol buffer compiler. DO NOT EDIT! */
2
+
3
+ /* Do not generate deprecated warnings for self */
4
+ #ifndef PROTOBUF_C_NO_DEPRECATED
5
+ #define PROTOBUF_C_NO_DEPRECATED
6
+ #endif
7
+
8
+ #include "fileformat.pb-c.h"
9
+ void blob__init
10
+ (Blob *message)
11
+ {
12
+ static Blob init_value = BLOB__INIT;
13
+ *message = init_value;
14
+ }
15
+ size_t blob__get_packed_size
16
+ (const Blob *message)
17
+ {
18
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob__descriptor);
19
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
20
+ }
21
+ size_t blob__pack
22
+ (const Blob *message,
23
+ uint8_t *out)
24
+ {
25
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob__descriptor);
26
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
27
+ }
28
+ size_t blob__pack_to_buffer
29
+ (const Blob *message,
30
+ ProtobufCBuffer *buffer)
31
+ {
32
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob__descriptor);
33
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
34
+ }
35
+ Blob *
36
+ blob__unpack
37
+ (ProtobufCAllocator *allocator,
38
+ size_t len,
39
+ const uint8_t *data)
40
+ {
41
+ return (Blob *)
42
+ protobuf_c_message_unpack (&blob__descriptor,
43
+ allocator, len, data);
44
+ }
45
+ void blob__free_unpacked
46
+ (Blob *message,
47
+ ProtobufCAllocator *allocator)
48
+ {
49
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob__descriptor);
50
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
51
+ }
52
+ void blob_header__init
53
+ (BlobHeader *message)
54
+ {
55
+ static BlobHeader init_value = BLOB_HEADER__INIT;
56
+ *message = init_value;
57
+ }
58
+ size_t blob_header__get_packed_size
59
+ (const BlobHeader *message)
60
+ {
61
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob_header__descriptor);
62
+ return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message));
63
+ }
64
+ size_t blob_header__pack
65
+ (const BlobHeader *message,
66
+ uint8_t *out)
67
+ {
68
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob_header__descriptor);
69
+ return protobuf_c_message_pack ((const ProtobufCMessage*)message, out);
70
+ }
71
+ size_t blob_header__pack_to_buffer
72
+ (const BlobHeader *message,
73
+ ProtobufCBuffer *buffer)
74
+ {
75
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob_header__descriptor);
76
+ return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer);
77
+ }
78
+ BlobHeader *
79
+ blob_header__unpack
80
+ (ProtobufCAllocator *allocator,
81
+ size_t len,
82
+ const uint8_t *data)
83
+ {
84
+ return (BlobHeader *)
85
+ protobuf_c_message_unpack (&blob_header__descriptor,
86
+ allocator, len, data);
87
+ }
88
+ void blob_header__free_unpacked
89
+ (BlobHeader *message,
90
+ ProtobufCAllocator *allocator)
91
+ {
92
+ PROTOBUF_C_ASSERT (message->base.descriptor == &blob_header__descriptor);
93
+ protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator);
94
+ }
95
+ static const ProtobufCFieldDescriptor blob__field_descriptors[5] =
96
+ {
97
+ {
98
+ "raw",
99
+ 1,
100
+ PROTOBUF_C_LABEL_OPTIONAL,
101
+ PROTOBUF_C_TYPE_BYTES,
102
+ PROTOBUF_C_OFFSETOF(Blob, has_raw),
103
+ PROTOBUF_C_OFFSETOF(Blob, raw),
104
+ NULL,
105
+ NULL,
106
+ 0, /* packed */
107
+ 0,NULL,NULL /* reserved1,reserved2, etc */
108
+ },
109
+ {
110
+ "raw_size",
111
+ 2,
112
+ PROTOBUF_C_LABEL_OPTIONAL,
113
+ PROTOBUF_C_TYPE_INT32,
114
+ PROTOBUF_C_OFFSETOF(Blob, has_raw_size),
115
+ PROTOBUF_C_OFFSETOF(Blob, raw_size),
116
+ NULL,
117
+ NULL,
118
+ 0, /* packed */
119
+ 0,NULL,NULL /* reserved1,reserved2, etc */
120
+ },
121
+ {
122
+ "zlib_data",
123
+ 3,
124
+ PROTOBUF_C_LABEL_OPTIONAL,
125
+ PROTOBUF_C_TYPE_BYTES,
126
+ PROTOBUF_C_OFFSETOF(Blob, has_zlib_data),
127
+ PROTOBUF_C_OFFSETOF(Blob, zlib_data),
128
+ NULL,
129
+ NULL,
130
+ 0, /* packed */
131
+ 0,NULL,NULL /* reserved1,reserved2, etc */
132
+ },
133
+ {
134
+ "lzma_data",
135
+ 4,
136
+ PROTOBUF_C_LABEL_OPTIONAL,
137
+ PROTOBUF_C_TYPE_BYTES,
138
+ PROTOBUF_C_OFFSETOF(Blob, has_lzma_data),
139
+ PROTOBUF_C_OFFSETOF(Blob, lzma_data),
140
+ NULL,
141
+ NULL,
142
+ 0, /* packed */
143
+ 0,NULL,NULL /* reserved1,reserved2, etc */
144
+ },
145
+ {
146
+ "OBSOLETE_bzip2_data",
147
+ 5,
148
+ PROTOBUF_C_LABEL_OPTIONAL,
149
+ PROTOBUF_C_TYPE_BYTES,
150
+ PROTOBUF_C_OFFSETOF(Blob, has_obsolete_bzip2_data),
151
+ PROTOBUF_C_OFFSETOF(Blob, obsolete_bzip2_data),
152
+ NULL,
153
+ NULL,
154
+ 0, /* packed */
155
+ 0,NULL,NULL /* reserved1,reserved2, etc */
156
+ },
157
+ };
158
+ static const unsigned blob__field_indices_by_name[] = {
159
+ 4, /* field[4] = OBSOLETE_bzip2_data */
160
+ 3, /* field[3] = lzma_data */
161
+ 0, /* field[0] = raw */
162
+ 1, /* field[1] = raw_size */
163
+ 2, /* field[2] = zlib_data */
164
+ };
165
+ static const ProtobufCIntRange blob__number_ranges[1 + 1] =
166
+ {
167
+ { 1, 0 },
168
+ { 0, 5 }
169
+ };
170
+ const ProtobufCMessageDescriptor blob__descriptor =
171
+ {
172
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
173
+ "Blob",
174
+ "Blob",
175
+ "Blob",
176
+ "",
177
+ sizeof(Blob),
178
+ 5,
179
+ blob__field_descriptors,
180
+ blob__field_indices_by_name,
181
+ 1, blob__number_ranges,
182
+ (ProtobufCMessageInit) blob__init,
183
+ NULL,NULL,NULL /* reserved[123] */
184
+ };
185
+ static const ProtobufCFieldDescriptor blob_header__field_descriptors[3] =
186
+ {
187
+ {
188
+ "type",
189
+ 1,
190
+ PROTOBUF_C_LABEL_REQUIRED,
191
+ PROTOBUF_C_TYPE_STRING,
192
+ 0, /* quantifier_offset */
193
+ PROTOBUF_C_OFFSETOF(BlobHeader, type),
194
+ NULL,
195
+ NULL,
196
+ 0, /* packed */
197
+ 0,NULL,NULL /* reserved1,reserved2, etc */
198
+ },
199
+ {
200
+ "indexdata",
201
+ 2,
202
+ PROTOBUF_C_LABEL_OPTIONAL,
203
+ PROTOBUF_C_TYPE_BYTES,
204
+ PROTOBUF_C_OFFSETOF(BlobHeader, has_indexdata),
205
+ PROTOBUF_C_OFFSETOF(BlobHeader, indexdata),
206
+ NULL,
207
+ NULL,
208
+ 0, /* packed */
209
+ 0,NULL,NULL /* reserved1,reserved2, etc */
210
+ },
211
+ {
212
+ "datasize",
213
+ 3,
214
+ PROTOBUF_C_LABEL_REQUIRED,
215
+ PROTOBUF_C_TYPE_INT32,
216
+ 0, /* quantifier_offset */
217
+ PROTOBUF_C_OFFSETOF(BlobHeader, datasize),
218
+ NULL,
219
+ NULL,
220
+ 0, /* packed */
221
+ 0,NULL,NULL /* reserved1,reserved2, etc */
222
+ },
223
+ };
224
+ static const unsigned blob_header__field_indices_by_name[] = {
225
+ 2, /* field[2] = datasize */
226
+ 1, /* field[1] = indexdata */
227
+ 0, /* field[0] = type */
228
+ };
229
+ static const ProtobufCIntRange blob_header__number_ranges[1 + 1] =
230
+ {
231
+ { 1, 0 },
232
+ { 0, 3 }
233
+ };
234
+ const ProtobufCMessageDescriptor blob_header__descriptor =
235
+ {
236
+ PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC,
237
+ "BlobHeader",
238
+ "BlobHeader",
239
+ "BlobHeader",
240
+ "",
241
+ sizeof(BlobHeader),
242
+ 3,
243
+ blob_header__field_descriptors,
244
+ blob_header__field_indices_by_name,
245
+ 1, blob_header__number_ranges,
246
+ (ProtobufCMessageInit) blob_header__init,
247
+ NULL,NULL,NULL /* reserved[123] */
248
+ };
@@ -0,0 +1,110 @@
1
+ /* Generated by the protocol buffer compiler. DO NOT EDIT! */
2
+
3
+ #ifndef PROTOBUF_C_fileformat_2eproto__INCLUDED
4
+ #define PROTOBUF_C_fileformat_2eproto__INCLUDED
5
+
6
+ #include <google/protobuf-c/protobuf-c.h>
7
+
8
+ PROTOBUF_C_BEGIN_DECLS
9
+
10
+
11
+ typedef struct _Blob Blob;
12
+ typedef struct _BlobHeader BlobHeader;
13
+
14
+
15
+ /* --- enums --- */
16
+
17
+
18
+ /* --- messages --- */
19
+
20
+ struct _Blob
21
+ {
22
+ ProtobufCMessage base;
23
+ protobuf_c_boolean has_raw;
24
+ ProtobufCBinaryData raw;
25
+ protobuf_c_boolean has_raw_size;
26
+ int32_t raw_size;
27
+ protobuf_c_boolean has_zlib_data;
28
+ ProtobufCBinaryData zlib_data;
29
+ protobuf_c_boolean has_lzma_data;
30
+ ProtobufCBinaryData lzma_data;
31
+ protobuf_c_boolean has_obsolete_bzip2_data PROTOBUF_C_DEPRECATED;
32
+ ProtobufCBinaryData obsolete_bzip2_data PROTOBUF_C_DEPRECATED;
33
+ };
34
+ #define BLOB__INIT \
35
+ { PROTOBUF_C_MESSAGE_INIT (&blob__descriptor) \
36
+ , 0,{0,NULL}, 0,0, 0,{0,NULL}, 0,{0,NULL}, 0,{0,NULL} }
37
+
38
+
39
+ struct _BlobHeader
40
+ {
41
+ ProtobufCMessage base;
42
+ char *type;
43
+ protobuf_c_boolean has_indexdata;
44
+ ProtobufCBinaryData indexdata;
45
+ int32_t datasize;
46
+ };
47
+ #define BLOB_HEADER__INIT \
48
+ { PROTOBUF_C_MESSAGE_INIT (&blob_header__descriptor) \
49
+ , NULL, 0,{0,NULL}, 0 }
50
+
51
+
52
+ /* Blob methods */
53
+ void blob__init
54
+ (Blob *message);
55
+ size_t blob__get_packed_size
56
+ (const Blob *message);
57
+ size_t blob__pack
58
+ (const Blob *message,
59
+ uint8_t *out);
60
+ size_t blob__pack_to_buffer
61
+ (const Blob *message,
62
+ ProtobufCBuffer *buffer);
63
+ Blob *
64
+ blob__unpack
65
+ (ProtobufCAllocator *allocator,
66
+ size_t len,
67
+ const uint8_t *data);
68
+ void blob__free_unpacked
69
+ (Blob *message,
70
+ ProtobufCAllocator *allocator);
71
+ /* BlobHeader methods */
72
+ void blob_header__init
73
+ (BlobHeader *message);
74
+ size_t blob_header__get_packed_size
75
+ (const BlobHeader *message);
76
+ size_t blob_header__pack
77
+ (const BlobHeader *message,
78
+ uint8_t *out);
79
+ size_t blob_header__pack_to_buffer
80
+ (const BlobHeader *message,
81
+ ProtobufCBuffer *buffer);
82
+ BlobHeader *
83
+ blob_header__unpack
84
+ (ProtobufCAllocator *allocator,
85
+ size_t len,
86
+ const uint8_t *data);
87
+ void blob_header__free_unpacked
88
+ (BlobHeader *message,
89
+ ProtobufCAllocator *allocator);
90
+ /* --- per-message closures --- */
91
+
92
+ typedef void (*Blob_Closure)
93
+ (const Blob *message,
94
+ void *closure_data);
95
+ typedef void (*BlobHeader_Closure)
96
+ (const BlobHeader *message,
97
+ void *closure_data);
98
+
99
+ /* --- services --- */
100
+
101
+
102
+ /* --- descriptors --- */
103
+
104
+ extern const ProtobufCMessageDescriptor blob__descriptor;
105
+ extern const ProtobufCMessageDescriptor blob_header__descriptor;
106
+
107
+ PROTOBUF_C_END_DECLS
108
+
109
+
110
+ #endif /* PROTOBUF_fileformat_2eproto__INCLUDED */