1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20 #include <thrift/c_glib/thrift.h>
21 #include <thrift/c_glib/protocol/thrift_protocol.h>
22 #include <thrift/c_glib/transport/thrift_transport.h>
23
24 /* define the GError domain string */
25 #define THRIFT_PROTOCOL_ERROR_DOMAIN "thrift-protocol-error-quark"
26
27 /* object properties */
28 enum _ThriftProtocolProperties
29 {
30 PROP_0,
31 PROP_THRIFT_PROTOCOL_TRANSPORT
32 };
33
G_DEFINE_ABSTRACT_TYPE(ThriftProtocol,thrift_protocol,G_TYPE_OBJECT)34 G_DEFINE_ABSTRACT_TYPE(ThriftProtocol, thrift_protocol, G_TYPE_OBJECT)
35
36 void
37 thrift_protocol_get_property (GObject *object, guint property_id,
38 GValue *value, GParamSpec *pspec)
39 {
40 ThriftProtocol *protocol = THRIFT_PROTOCOL (object);
41
42 THRIFT_UNUSED_VAR (pspec);
43
44 switch (property_id)
45 {
46 case PROP_THRIFT_PROTOCOL_TRANSPORT:
47 g_value_set_object (value, protocol->transport);
48 break;
49 }
50 }
51
52 void
thrift_protocol_set_property(GObject * object,guint property_id,const GValue * value,GParamSpec * pspec)53 thrift_protocol_set_property (GObject *object, guint property_id,
54 const GValue *value, GParamSpec *pspec)
55 {
56
57 ThriftProtocol *protocol = THRIFT_PROTOCOL (object);
58
59 THRIFT_UNUSED_VAR (pspec);
60
61 switch (property_id)
62 {
63 case PROP_THRIFT_PROTOCOL_TRANSPORT:
64 protocol->transport = g_value_dup_object (value);
65 break;
66 }
67 }
68
69
70 gint32
thrift_protocol_write_message_begin(ThriftProtocol * protocol,const gchar * name,const ThriftMessageType message_type,const gint32 seqid,GError ** error)71 thrift_protocol_write_message_begin (ThriftProtocol *protocol,
72 const gchar *name,
73 const ThriftMessageType message_type,
74 const gint32 seqid, GError **error)
75 {
76 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_message_begin
77 (protocol, name,
78 message_type, seqid,
79 error);
80 }
81
82 gint32
thrift_protocol_write_message_end(ThriftProtocol * protocol,GError ** error)83 thrift_protocol_write_message_end (ThriftProtocol *protocol, GError **error)
84 {
85 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_message_end (protocol,
86 error);
87 }
88
89 gint32
thrift_protocol_write_struct_begin(ThriftProtocol * protocol,const gchar * name,GError ** error)90 thrift_protocol_write_struct_begin (ThriftProtocol *protocol, const gchar *name,
91 GError **error)
92 {
93 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_struct_begin (protocol,
94 name, error);
95 }
96
97 gint32
thrift_protocol_write_struct_end(ThriftProtocol * protocol,GError ** error)98 thrift_protocol_write_struct_end (ThriftProtocol *protocol, GError **error)
99 {
100 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_struct_end (protocol,
101 error);
102 }
103
104 gint32
thrift_protocol_write_field_begin(ThriftProtocol * protocol,const gchar * name,const ThriftType field_type,const gint16 field_id,GError ** error)105 thrift_protocol_write_field_begin (ThriftProtocol *protocol,
106 const gchar *name,
107 const ThriftType field_type,
108 const gint16 field_id,
109 GError **error)
110 {
111 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_field_begin (protocol,
112 name, field_type,
113 field_id, error);
114 }
115
116 gint32
thrift_protocol_write_field_end(ThriftProtocol * protocol,GError ** error)117 thrift_protocol_write_field_end (ThriftProtocol *protocol, GError **error)
118 {
119 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_field_end (protocol,
120 error);
121 }
122
123 gint32
thrift_protocol_write_field_stop(ThriftProtocol * protocol,GError ** error)124 thrift_protocol_write_field_stop (ThriftProtocol *protocol, GError **error)
125 {
126 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_field_stop (protocol,
127 error);
128 }
129
130 gint32
thrift_protocol_write_map_begin(ThriftProtocol * protocol,const ThriftType key_type,const ThriftType value_type,const guint32 size,GError ** error)131 thrift_protocol_write_map_begin (ThriftProtocol *protocol,
132 const ThriftType key_type,
133 const ThriftType value_type,
134 const guint32 size, GError **error)
135 {
136 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_map_begin (protocol,
137 key_type, value_type,
138 size, error);
139 }
140
141 gint32
thrift_protocol_write_map_end(ThriftProtocol * protocol,GError ** error)142 thrift_protocol_write_map_end (ThriftProtocol *protocol, GError **error)
143 {
144 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_map_end (protocol,
145 error);
146 }
147
148 gint32
thrift_protocol_write_list_begin(ThriftProtocol * protocol,const ThriftType element_type,const guint32 size,GError ** error)149 thrift_protocol_write_list_begin (ThriftProtocol *protocol,
150 const ThriftType element_type,
151 const guint32 size, GError **error)
152 {
153 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_list_begin (protocol,
154 element_type, size,
155 error);
156 }
157
158 gint32
thrift_protocol_write_list_end(ThriftProtocol * protocol,GError ** error)159 thrift_protocol_write_list_end (ThriftProtocol *protocol, GError **error)
160 {
161 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_list_end (protocol,
162 error);
163 }
164
165 gint32
thrift_protocol_write_set_begin(ThriftProtocol * protocol,const ThriftType element_type,const guint32 size,GError ** error)166 thrift_protocol_write_set_begin (ThriftProtocol *protocol,
167 const ThriftType element_type,
168 const guint32 size, GError **error)
169 {
170 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_set_begin (protocol,
171 element_type, size,
172 error);
173 }
174
175 gint32
thrift_protocol_write_set_end(ThriftProtocol * protocol,GError ** error)176 thrift_protocol_write_set_end (ThriftProtocol *protocol, GError **error)
177 {
178 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_set_end (protocol,
179 error);
180 }
181
182 gint32
thrift_protocol_write_bool(ThriftProtocol * protocol,const gboolean value,GError ** error)183 thrift_protocol_write_bool (ThriftProtocol *protocol,
184 const gboolean value, GError **error)
185 {
186 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_bool (protocol, value,
187 error);
188 }
189
190 gint32
thrift_protocol_write_byte(ThriftProtocol * protocol,const gint8 value,GError ** error)191 thrift_protocol_write_byte (ThriftProtocol *protocol, const gint8 value,
192 GError **error)
193 {
194 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_byte (protocol, value,
195 error);
196 }
197
198 gint32
thrift_protocol_write_i16(ThriftProtocol * protocol,const gint16 value,GError ** error)199 thrift_protocol_write_i16 (ThriftProtocol *protocol, const gint16 value,
200 GError **error)
201 {
202 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_i16 (protocol, value,
203 error);
204 }
205
206 gint32
thrift_protocol_write_i32(ThriftProtocol * protocol,const gint32 value,GError ** error)207 thrift_protocol_write_i32 (ThriftProtocol *protocol, const gint32 value,
208 GError **error)
209 {
210 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_i32 (protocol, value,
211 error);
212 }
213
214 gint32
thrift_protocol_write_i64(ThriftProtocol * protocol,const gint64 value,GError ** error)215 thrift_protocol_write_i64 (ThriftProtocol *protocol, const gint64 value,
216 GError **error)
217 {
218 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_i64 (protocol, value,
219 error);
220 }
221
222 gint32
thrift_protocol_write_double(ThriftProtocol * protocol,const gdouble value,GError ** error)223 thrift_protocol_write_double (ThriftProtocol *protocol,
224 const gdouble value, GError **error)
225 {
226 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_double (protocol,
227 value, error);
228 }
229
230 gint32
thrift_protocol_write_string(ThriftProtocol * protocol,const gchar * str,GError ** error)231 thrift_protocol_write_string (ThriftProtocol *protocol,
232 const gchar *str, GError **error)
233 {
234 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_string (protocol, str,
235 error);
236 }
237
238 gint32
thrift_protocol_write_binary(ThriftProtocol * protocol,const gpointer buf,const guint32 len,GError ** error)239 thrift_protocol_write_binary (ThriftProtocol *protocol, const gpointer buf,
240 const guint32 len, GError **error)
241 {
242 return THRIFT_PROTOCOL_GET_CLASS (protocol)->write_binary (protocol, buf,
243 len, error);
244 }
245
246 gint32
thrift_protocol_read_message_begin(ThriftProtocol * protocol,gchar ** name,ThriftMessageType * message_type,gint32 * seqid,GError ** error)247 thrift_protocol_read_message_begin (ThriftProtocol *protocol,
248 gchar **name,
249 ThriftMessageType *message_type,
250 gint32 *seqid, GError **error)
251 {
252 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_message_begin (protocol,
253 name, message_type,
254 seqid, error);
255 }
256
257 gint32
thrift_protocol_read_message_end(ThriftProtocol * protocol,GError ** error)258 thrift_protocol_read_message_end (ThriftProtocol *protocol,
259 GError **error)
260 {
261 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_message_end (protocol,
262 error);
263 }
264
265 gint32
thrift_protocol_read_struct_begin(ThriftProtocol * protocol,gchar ** name,GError ** error)266 thrift_protocol_read_struct_begin (ThriftProtocol *protocol,
267 gchar **name,
268 GError **error)
269 {
270 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_struct_begin (protocol,
271 name,
272 error);
273 }
274
275 gint32
thrift_protocol_read_struct_end(ThriftProtocol * protocol,GError ** error)276 thrift_protocol_read_struct_end (ThriftProtocol *protocol, GError **error)
277 {
278 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_struct_end (protocol,
279 error);
280 }
281
282 gint32
thrift_protocol_read_field_begin(ThriftProtocol * protocol,gchar ** name,ThriftType * field_type,gint16 * field_id,GError ** error)283 thrift_protocol_read_field_begin (ThriftProtocol *protocol,
284 gchar **name,
285 ThriftType *field_type,
286 gint16 *field_id,
287 GError **error)
288 {
289 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_field_begin (protocol,
290 name,
291 field_type,
292 field_id,
293 error);
294 }
295
296 gint32
thrift_protocol_read_field_end(ThriftProtocol * protocol,GError ** error)297 thrift_protocol_read_field_end (ThriftProtocol *protocol,
298 GError **error)
299 {
300 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_field_end (protocol,
301 error);
302 }
303
304 gint32
thrift_protocol_read_map_begin(ThriftProtocol * protocol,ThriftType * key_type,ThriftType * value_type,guint32 * size,GError ** error)305 thrift_protocol_read_map_begin (ThriftProtocol *protocol,
306 ThriftType *key_type,
307 ThriftType *value_type, guint32 *size,
308 GError **error)
309 {
310 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_map_begin (protocol,
311 key_type,
312 value_type,
313 size,
314 error);
315 }
316
317 gint32
thrift_protocol_read_map_end(ThriftProtocol * protocol,GError ** error)318 thrift_protocol_read_map_end (ThriftProtocol *protocol, GError **error)
319 {
320 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_map_end (protocol,
321 error);
322 }
323
324 gint32
thrift_protocol_read_list_begin(ThriftProtocol * protocol,ThriftType * element_type,guint32 * size,GError ** error)325 thrift_protocol_read_list_begin (ThriftProtocol *protocol,
326 ThriftType *element_type,
327 guint32 *size, GError **error)
328 {
329 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_list_begin (protocol,
330 element_type,
331 size, error);
332 }
333
334 gint32
thrift_protocol_read_list_end(ThriftProtocol * protocol,GError ** error)335 thrift_protocol_read_list_end (ThriftProtocol *protocol, GError **error)
336 {
337 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_list_end (protocol,
338 error);
339 }
340
341 gint32
thrift_protocol_read_set_begin(ThriftProtocol * protocol,ThriftType * element_type,guint32 * size,GError ** error)342 thrift_protocol_read_set_begin (ThriftProtocol *protocol,
343 ThriftType *element_type,
344 guint32 *size, GError **error)
345 {
346 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_set_begin (protocol,
347 element_type,
348 size, error);
349 }
350
351 gint32
thrift_protocol_read_set_end(ThriftProtocol * protocol,GError ** error)352 thrift_protocol_read_set_end (ThriftProtocol *protocol, GError **error)
353 {
354 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_set_end (protocol,
355 error);
356 }
357
358 gint32
thrift_protocol_read_bool(ThriftProtocol * protocol,gboolean * value,GError ** error)359 thrift_protocol_read_bool (ThriftProtocol *protocol, gboolean *value,
360 GError **error)
361 {
362 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_bool (protocol, value,
363 error);
364 }
365
366 gint32
thrift_protocol_read_byte(ThriftProtocol * protocol,gint8 * value,GError ** error)367 thrift_protocol_read_byte (ThriftProtocol *protocol, gint8 *value,
368 GError **error)
369 {
370 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_byte (protocol, value,
371 error);
372 }
373
374 gint32
thrift_protocol_read_i16(ThriftProtocol * protocol,gint16 * value,GError ** error)375 thrift_protocol_read_i16 (ThriftProtocol *protocol, gint16 *value,
376 GError **error)
377 {
378 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_i16 (protocol, value,
379 error);
380 }
381
382 gint32
thrift_protocol_read_i32(ThriftProtocol * protocol,gint32 * value,GError ** error)383 thrift_protocol_read_i32 (ThriftProtocol *protocol, gint32 *value,
384 GError **error)
385 {
386 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_i32 (protocol, value,
387 error);
388 }
389
390 gint32
thrift_protocol_read_i64(ThriftProtocol * protocol,gint64 * value,GError ** error)391 thrift_protocol_read_i64 (ThriftProtocol *protocol, gint64 *value,
392 GError **error)
393 {
394 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_i64 (protocol, value,
395 error);
396 }
397
398 gint32
thrift_protocol_read_double(ThriftProtocol * protocol,gdouble * value,GError ** error)399 thrift_protocol_read_double (ThriftProtocol *protocol,
400 gdouble *value, GError **error)
401 {
402 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_double (protocol, value,
403 error);
404 }
405
406 gint32
thrift_protocol_read_string(ThriftProtocol * protocol,gchar ** str,GError ** error)407 thrift_protocol_read_string (ThriftProtocol *protocol,
408 gchar **str, GError **error)
409 {
410 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_string (protocol, str,
411 error);
412 }
413
414 gint32
thrift_protocol_read_binary(ThriftProtocol * protocol,gpointer * buf,guint32 * len,GError ** error)415 thrift_protocol_read_binary (ThriftProtocol *protocol, gpointer *buf,
416 guint32 *len, GError **error)
417 {
418 return THRIFT_PROTOCOL_GET_CLASS (protocol)->read_binary (protocol, buf,
419 len, error);
420 }
421
422 gint
thrift_protocol_get_min_serialized_size(ThriftProtocol * protocol,ThriftType type,GError ** error)423 thrift_protocol_get_min_serialized_size (ThriftProtocol *protocol, ThriftType type, GError ** error)
424 {
425 return THRIFT_PROTOCOL_GET_CLASS (protocol)->get_min_serialized_size (protocol,
426 type, error);
427 }
428
429 #define THRIFT_SKIP_RESULT_OR_RETURN(_RES, _CALL) \
430 { \
431 gint32 _x = (_CALL); \
432 if (_x < 0) { return _x; } \
433 (_RES) += _x; \
434 }
435
436 gint32
thrift_protocol_skip(ThriftProtocol * protocol,ThriftType type,GError ** error)437 thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error)
438 {
439 switch (type)
440 {
441 case T_BOOL:
442 {
443 gboolean boolv;
444 return thrift_protocol_read_bool (protocol, &boolv, error);
445 }
446 case T_BYTE:
447 {
448 gint8 bytev;
449 return thrift_protocol_read_byte (protocol, &bytev, error);
450 }
451
452 case T_I16:
453 {
454 gint16 i16;
455 return thrift_protocol_read_i16 (protocol, &i16, error);
456 }
457 case T_I32:
458 {
459 gint32 i32;
460 return thrift_protocol_read_i32 (protocol, &i32, error);
461 }
462 case T_I64:
463 {
464 gint64 i64;
465 return thrift_protocol_read_i64 (protocol, &i64, error);
466 }
467 case T_DOUBLE:
468 {
469 gdouble dub;
470 return thrift_protocol_read_double (protocol, &dub, error);
471 }
472 case T_STRING:
473 {
474 gpointer data;
475 guint32 len;
476 gint32 ret = thrift_protocol_read_binary (protocol, &data, &len, error);
477 g_free (data);
478 return ret;
479 }
480 case T_STRUCT:
481 {
482 gint32 result = 0;
483 gchar *name;
484 gint16 fid;
485 ThriftType ftype;
486 THRIFT_SKIP_RESULT_OR_RETURN(result,
487 thrift_protocol_read_struct_begin (protocol, &name, error))
488 while (1)
489 {
490 THRIFT_SKIP_RESULT_OR_RETURN(result,
491 thrift_protocol_read_field_begin (protocol, &name, &ftype,
492 &fid, error))
493 if (ftype == T_STOP)
494 {
495 break;
496 }
497 THRIFT_SKIP_RESULT_OR_RETURN(result,
498 thrift_protocol_skip (protocol, ftype, error))
499 THRIFT_SKIP_RESULT_OR_RETURN(result,
500 thrift_protocol_read_field_end (protocol, error))
501 }
502 THRIFT_SKIP_RESULT_OR_RETURN(result,
503 thrift_protocol_read_struct_end (protocol, error))
504 return result;
505 }
506 case T_SET:
507 {
508 gint32 result = 0;
509 ThriftType elem_type;
510 guint32 i, size;
511 THRIFT_SKIP_RESULT_OR_RETURN(result,
512 thrift_protocol_read_set_begin (protocol, &elem_type, &size,
513 error))
514 for (i = 0; i < size; i++)
515 {
516 THRIFT_SKIP_RESULT_OR_RETURN(result,
517 thrift_protocol_skip (protocol, elem_type, error))
518 }
519 THRIFT_SKIP_RESULT_OR_RETURN(result,
520 thrift_protocol_read_set_end (protocol, error))
521 return result;
522 }
523 case T_MAP:
524 {
525 gint32 result = 0;
526 ThriftType elem_type;
527 ThriftType key_type;
528 guint32 i, size;
529 THRIFT_SKIP_RESULT_OR_RETURN(result,
530 thrift_protocol_read_map_begin (protocol, &key_type, &elem_type, &size,
531 error))
532 for (i = 0; i < size; i++)
533 {
534 THRIFT_SKIP_RESULT_OR_RETURN(result,
535 thrift_protocol_skip (protocol, key_type, error))
536 THRIFT_SKIP_RESULT_OR_RETURN(result,
537 thrift_protocol_skip (protocol, elem_type, error))
538 }
539 THRIFT_SKIP_RESULT_OR_RETURN(result,
540 thrift_protocol_read_map_end (protocol, error))
541 return result;
542 }
543 case T_LIST:
544 {
545 gint32 result = 0;
546 ThriftType elem_type;
547 guint32 i, size;
548 THRIFT_SKIP_RESULT_OR_RETURN(result,
549 thrift_protocol_read_list_begin (protocol, &elem_type, &size,
550 error))
551 for (i = 0; i < size; i++)
552 {
553 THRIFT_SKIP_RESULT_OR_RETURN(result,
554 thrift_protocol_skip (protocol, elem_type, error))
555 }
556 THRIFT_SKIP_RESULT_OR_RETURN(result,
557 thrift_protocol_read_list_end (protocol, error))
558 return result;
559 }
560 default:
561 break;
562 }
563
564 g_set_error (error, THRIFT_PROTOCOL_ERROR,
565 THRIFT_PROTOCOL_ERROR_INVALID_DATA,
566 "unrecognized type");
567 return -1;
568 }
569
570 /* define the GError domain for Thrift protocols */
571 GQuark
thrift_protocol_error_quark(void)572 thrift_protocol_error_quark (void)
573 {
574 return g_quark_from_static_string (THRIFT_PROTOCOL_ERROR_DOMAIN);
575 }
576
577
578 static void
thrift_protocol_init(ThriftProtocol * protocol)579 thrift_protocol_init (ThriftProtocol *protocol)
580 {
581 protocol->transport = NULL;
582 }
583
584 static void
thrift_protocol_dispose(GObject * gobject)585 thrift_protocol_dispose (GObject *gobject)
586 {
587 ThriftProtocol *self = THRIFT_PROTOCOL (gobject);
588
589 g_clear_object(&self->transport);
590
591 /* Always chain up to the parent class; there is no need to check if
592 * the parent class implements the dispose() virtual function: it is
593 * always guaranteed to do so
594 */
595 G_OBJECT_CLASS (thrift_protocol_parent_class)->dispose(gobject);
596 }
597
598 static void
thrift_protocol_class_init(ThriftProtocolClass * cls)599 thrift_protocol_class_init (ThriftProtocolClass *cls)
600 {
601 GObjectClass *gobject_class = G_OBJECT_CLASS (cls);
602
603 gobject_class->get_property = thrift_protocol_get_property;
604 gobject_class->set_property = thrift_protocol_set_property;
605 gobject_class->dispose = thrift_protocol_dispose;
606
607 g_object_class_install_property (gobject_class,
608 PROP_THRIFT_PROTOCOL_TRANSPORT,
609 g_param_spec_object ("transport", "Transport", "Thrift Transport",
610 THRIFT_TYPE_TRANSPORT,
611 G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
612
613 cls->write_message_begin = thrift_protocol_write_message_begin;
614 cls->write_message_end = thrift_protocol_write_message_end;
615 cls->write_struct_begin = thrift_protocol_write_struct_begin;
616 cls->write_struct_end = thrift_protocol_write_struct_end;
617 cls->write_field_begin = thrift_protocol_write_field_begin;
618 cls->write_field_end = thrift_protocol_write_field_end;
619 cls->write_field_stop = thrift_protocol_write_field_stop;
620 cls->write_map_begin = thrift_protocol_write_map_begin;
621 cls->write_map_end = thrift_protocol_write_map_end;
622 cls->write_list_begin = thrift_protocol_write_list_begin;
623 cls->write_list_end = thrift_protocol_write_list_end;
624 cls->write_set_begin = thrift_protocol_write_set_begin;
625 cls->write_set_end = thrift_protocol_write_set_end;
626 cls->write_bool = thrift_protocol_write_bool;
627 cls->write_byte = thrift_protocol_write_byte;
628 cls->write_i16 = thrift_protocol_write_i16;
629 cls->write_i32 = thrift_protocol_write_i32;
630 cls->write_i64 = thrift_protocol_write_i64;
631 cls->write_double = thrift_protocol_write_double;
632 cls->write_string = thrift_protocol_write_string;
633 cls->write_binary = thrift_protocol_write_binary;
634 cls->read_message_begin = thrift_protocol_read_message_begin;
635 cls->read_message_end = thrift_protocol_read_message_end;
636 cls->read_struct_begin = thrift_protocol_read_struct_begin;
637 cls->read_struct_end = thrift_protocol_read_struct_end;
638 cls->read_field_begin = thrift_protocol_read_field_begin;
639 cls->read_field_end = thrift_protocol_read_field_end;
640 cls->read_map_begin = thrift_protocol_read_map_begin;
641 cls->read_map_end = thrift_protocol_read_map_end;
642 cls->read_list_begin = thrift_protocol_read_list_begin;
643 cls->read_set_begin = thrift_protocol_read_set_begin;
644 cls->read_set_end = thrift_protocol_read_set_end;
645 cls->read_bool = thrift_protocol_read_bool;
646 cls->read_byte = thrift_protocol_read_byte;
647 cls->read_i16 = thrift_protocol_read_i16;
648 cls->read_i32 = thrift_protocol_read_i32;
649 cls->read_i64 = thrift_protocol_read_i64;
650 cls->read_double = thrift_protocol_read_double;
651 cls->read_string = thrift_protocol_read_string;
652 cls->read_binary = thrift_protocol_read_binary;
653 cls->get_min_serialized_size = thrift_protocol_get_min_serialized_size;
654 }
655