int32_t thrift_binary_protocol_read_list_begin (ThriftProtocol *protocol, ThriftType *element_type, u_int32_t *size, int *error) { int32_t ret; int32_t xfer = 0; int8_t e; int32_t sizei; if ((ret = thrift_protocol_read_byte (protocol, &e, error)) < 0) { return -1; } xfer += ret; *element_type = (ThriftType) e; if ((ret = thrift_protocol_read_i32 (protocol, &sizei, error)) < 0) { return -1; } xfer += ret; if (sizei < 0) { *error = THRIFT_PROTOCOL_ERROR_NEGATIVE_SIZE; os_log(OS_LOG_ERR, "Got negative size of %d", sizei); return -1; } *size = (u_int32_t) sizei; return xfer; }
gint32 thrift_binary_protocol_read_message_begin (ThriftProtocol *protocol, gchar **name, ThriftMessageType *message_type, gint32 *seqid, GError **error) { g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); gint32 ret; gint32 xfer = 0; gint32 sz; if ((ret = thrift_protocol_read_i32 (protocol, &sz, error)) < 0) { return -1; } xfer += ret; if (sz < 0) { /* check for version */ guint32 version = sz & THRIFT_BINARY_PROTOCOL_VERSION_MASK; if (version != THRIFT_BINARY_PROTOCOL_VERSION_1) { g_set_error (error, THRIFT_PROTOCOL_ERROR, THRIFT_PROTOCOL_ERROR_BAD_VERSION, "expected version %d, got %d", THRIFT_BINARY_PROTOCOL_VERSION_1, version); return -1; } *message_type = (ThriftMessageType) (sz & 0x000000ff); if ((ret = thrift_protocol_read_string (protocol, name, error)) < 0) { return -1; } xfer += ret; if ((ret = thrift_protocol_read_i32 (protocol, seqid, error)) < 0) { return -1; } xfer += ret; } return xfer; }
int32_t thrift_binary_protocol_read_message_begin (ThriftProtocol *protocol, char **name, ThriftMessageType *message_type, int32_t *seqid, int *error) { int32_t ret; int32_t xfer = 0; int32_t sz; if ((ret = thrift_protocol_read_i32 (protocol, &sz, error)) < 0) { return -1; } xfer += ret; if (sz < 0) { /* check for version */ u_int32_t version = sz & THRIFT_BINARY_PROTOCOL_VERSION_MASK; if (version != THRIFT_BINARY_PROTOCOL_VERSION_1) { *error = THRIFT_PROTOCOL_ERROR_BAD_VERSION; os_log(OS_LOG_ERR, "Expected version %d, got %d", THRIFT_BINARY_PROTOCOL_VERSION_1, version); return -1; } *message_type = (ThriftMessageType) (sz & 0x000000ff); if ((ret = thrift_protocol_read_string (protocol, name, error)) < 0) { return -1; } xfer += ret; if ((ret = thrift_protocol_read_i32 (protocol, seqid, error)) < 0) { return -1; } xfer += ret; } return xfer; }
gint32 thrift_binary_protocol_read_string (ThriftProtocol *protocol, gchar **str, GError **error) { guint32 len; gint32 ret; gint32 xfer = 0; gint32 read_len = 0; g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); /* read the length into read_len */ if ((ret = thrift_protocol_read_i32 (protocol, &read_len, error)) < 0) { return -1; } xfer += ret; if (read_len < 0) { g_set_error (error, THRIFT_PROTOCOL_ERROR, THRIFT_PROTOCOL_ERROR_NEGATIVE_SIZE, "got negative size of %d", read_len); *str = NULL; return -1; } /* allocate the memory for the string */ len = (guint32) read_len + 1; /* space for null terminator */ *str = g_new0 (gchar, len); if (read_len > 0) { if ((ret = thrift_transport_read_all (protocol->transport, *str, read_len, error)) < 0) { g_free (*str); *str = NULL; len = 0; return -1; } xfer += ret; } else { **str = 0; } return xfer; }
gint32 thrift_binary_protocol_read_map_begin (ThriftProtocol *protocol, ThriftType *key_type, ThriftType *value_type, guint32 *size, GError **error) { g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); gint32 ret; gint32 xfer = 0; gint8 k, v; gint32 sizei; if ((ret = thrift_protocol_read_byte (protocol, &k, error)) < 0) { return -1; } xfer += ret; *key_type = (ThriftType) k; if ((ret = thrift_protocol_read_byte (protocol, &v, error)) < 0) { return -1; } xfer += ret; *value_type = (ThriftType) v; if ((ret = thrift_protocol_read_i32 (protocol, &sizei, error)) <0) { return -1; } xfer += ret; if (sizei < 0) { g_set_error (error, THRIFT_PROTOCOL_ERROR, THRIFT_PROTOCOL_ERROR_NEGATIVE_SIZE, "got negative size of %d", sizei); return -1; } *size = (guint32) sizei; return xfer; }
gint32 thrift_binary_protocol_read_binary (ThriftProtocol *protocol, gpointer *buf, guint32 *len, GError **error) { gint32 ret; gint32 xfer = 0; gint32 read_len = 0; g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); /* read the length into read_len */ if ((ret = thrift_protocol_read_i32 (protocol, &read_len, error)) < 0) { return -1; } xfer += ret; if (read_len > 0) { /* allocate the memory as an array of unsigned char for binary data */ *len = (guint32) read_len; *buf = g_new (guchar, *len); if ((ret = thrift_transport_read_all (protocol->transport, *buf, *len, error)) < 0) { g_free (*buf); *buf = NULL; *len = 0; return -1; } xfer += ret; } else { *len = (guint32) read_len; *buf = NULL; } return xfer; }
gint32 thrift_binary_protocol_read_string (ThriftProtocol *protocol, gchar **str, GError **error) { g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); guint32 len; gint32 ret; gint32 xfer = 0; gint32 read_len = 0; /* read the length into read_len */ if ((ret = thrift_protocol_read_i32 (protocol, &read_len, error)) < 0) { return -1; } xfer += ret; if (read_len > 0) { /* allocate the memory for the string */ len = (guint32) read_len + 1; // space for null terminator *str = g_new0 (gchar, len); if ((ret = thrift_transport_read (protocol->transport, *str, read_len, error)) < 0) { g_free (*str); *str = NULL; len = 0; return -1; } xfer += ret; } else { *str = NULL; } return xfer; }
int32_t thrift_binary_protocol_read_binary (ThriftProtocol *protocol, void **buf, u_int32_t *len, int *error) { int32_t ret; int32_t xfer = 0; int32_t read_len = 0; /* read the length into read_len */ if ((ret = thrift_protocol_read_i32 (protocol, &read_len, error)) < 0) { return -1; } xfer += ret; if (read_len > 0) { /* allocate the memory as an array of unsigned char for binary data */ *len = (u_int32_t) read_len; *buf = os_malloc (*len); memset (*buf, 0, *len); if ((ret = thrift_transport_read (protocol->transport, *buf, *len, error)) < 0) { os_free (*buf); *buf = NULL; *len = 0; return -1; } xfer += ret; } else { *buf = NULL; } return xfer; }
int32_t thrift_binary_protocol_read_string (ThriftProtocol *protocol, char **str, int *error) { u_int32_t len; int32_t ret; int32_t xfer = 0; int32_t read_len = 0; /* read the length into read_len */ if ((ret = thrift_protocol_read_i32 (protocol, &read_len, error)) < 0) { return -1; } xfer += ret; if (read_len > 0) { /* allocate the memory for the string */ len = (u_int32_t) read_len + 1; // space for null terminator *str = os_malloc (len); memset (*str, 0, len); if ((ret = thrift_transport_read (protocol->transport, *str, read_len, error)) < 0) { os_free (*str); *str = NULL; len = 0; return -1; } xfer += ret; } else { *str = NULL; } return xfer; }
gboolean bucket_store_mapping_client_recv_get_mapping (BucketStoreMappingIf * iface, GHashTable ** _return, BucketStoreMappingException ** e, GError ** error) { gint32 rseqid; gchar * fname; ThriftMessageType mtype; ThriftProtocol * protocol = BUCKET_STORE_MAPPING_CLIENT (iface)->input_protocol; if (thrift_protocol_read_message_begin (protocol, &fname, &mtype, &rseqid, error) < 0) { if (fname) g_free (fname); return FALSE; } if (mtype == T_EXCEPTION) { if (fname) g_free (fname); ThriftApplicationException *xception = g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION, NULL); thrift_struct_read (THRIFT_STRUCT (xception), protocol, NULL); thrift_protocol_read_message_end (protocol, NULL); thrift_transport_read_end (protocol->transport, NULL); g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR, xception->type, "application error: %s", xception->message); g_object_unref (xception); return FALSE; } else if (mtype != T_REPLY) { if (fname) g_free (fname); thrift_protocol_skip (protocol, T_STRUCT, NULL); thrift_protocol_read_message_end (protocol, NULL); thrift_transport_read_end (protocol->transport, NULL); g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR, THRIFT_APPLICATION_EXCEPTION_ERROR_INVALID_MESSAGE_TYPE, "invalid message type %d, expected T_REPLY", mtype); return FALSE; } else if (strncmp (fname, "getMapping", 10) != 0) { thrift_protocol_skip (protocol, T_STRUCT, NULL); thrift_protocol_read_message_end (protocol, error); thrift_transport_read_end (protocol->transport, error); g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR, THRIFT_APPLICATION_EXCEPTION_ERROR_WRONG_METHOD_NAME, "wrong method name %s, expected getMapping", fname); if (fname) g_free (fname); return FALSE; } if (fname) g_free (fname); { gint32 ret; gint32 xfer = 0; gchar *name = NULL; ThriftType ftype; gint16 fid; guint32 len = 0; gpointer data = NULL; /* satisfy -Wall in case these aren't used */ THRIFT_UNUSED_VAR (len); THRIFT_UNUSED_VAR (data); /* read the struct begin marker */ if ((ret = thrift_protocol_read_struct_begin (protocol, &name, error)) < 0) { if (name) g_free (name); return 0; } xfer += ret; if (name) g_free (name); name = NULL; /* read the struct fields */ while (1) { /* read the beginning of a field */ if ((ret = thrift_protocol_read_field_begin (protocol, &name, &ftype, &fid, error)) < 0) { if (name) g_free (name); return 0; } xfer += ret; if (name) g_free (name); name = NULL; /* break if we get a STOP field */ if (ftype == T_STOP) { break; } switch (fid) { case 0: if (ftype == T_MAP) { { guint32 size; ThriftType key_type; ThriftType value_type; /* read the map begin marker */ if ((ret = thrift_protocol_read_map_begin (protocol, &key_type, &value_type, &size, error)) < 0) return 0; xfer += ret; /* iterate through each of the map's fields */ guint32 i; for (i = 0; i < size; i++) { gint32* key0 = g_new (gint32, 1); HostPort * val1 = NULL; if ((ret = thrift_protocol_read_i32 (protocol, &*key0, error)) < 0) return 0; xfer += ret; if ( val1 != NULL) { g_object_unref (val1); } val1 = g_object_new (TYPE_HOST_PORT, NULL); if ((ret = thrift_struct_read (THRIFT_STRUCT (val1), protocol, error)) < 0) { g_object_unref (val1); return 0; } xfer += ret; g_hash_table_insert ((GHashTable *)*_return, (gpointer) key0, (gpointer) val1); } /* read the map end marker */ if ((ret = thrift_protocol_read_map_end (protocol, error)) < 0) return 0; xfer += ret; } } else { if ((ret = thrift_protocol_skip (protocol, ftype, error)) < 0) return 0; xfer += ret; } break; case 1: if (ftype == T_STRUCT) { /* This struct is an exception */ if ( *e != NULL) { g_object_unref (*e); } *e = g_object_new (TYPE_BUCKET_STORE_MAPPING_EXCEPTION, NULL); if ((ret = thrift_struct_read (THRIFT_STRUCT (*e), protocol, error)) < 0) { g_object_unref (*e); return 0; } xfer += ret; } else { if ((ret = thrift_protocol_skip (protocol, ftype, error)) < 0) return 0; xfer += ret; } break; default: if ((ret = thrift_protocol_skip (protocol, ftype, error)) < 0) return 0; xfer += ret; break; } if ((ret = thrift_protocol_read_field_end (protocol, error)) < 0) return 0; xfer += ret; } if ((ret = thrift_protocol_read_struct_end (protocol, error)) < 0) return 0; xfer += ret; } if (thrift_protocol_read_message_end (protocol, error) < 0) return FALSE; if (!thrift_transport_read_end (protocol->transport, error)) return FALSE; if (*e != NULL) { g_set_error (error, BUCKET_STORE_MAPPING_EXCEPTION_ERROR, BUCKET_STORE_MAPPING_EXCEPTION_ERROR_CODE, "BucketStoreMappingException"); return FALSE; } return TRUE; }
static void thrift_server_primitives (const int port) { ThriftServerTransport *transport = NULL; ThriftTransport *client = NULL; ThriftBinaryProtocol *tbp = NULL; ThriftProtocol *protocol = NULL; gboolean value_boolean = FALSE; gint8 value_byte = 0; gint16 value_16 = 0; gint32 value_32 = 0; gint64 value_64 = 0; gdouble value_double = 0; gchar *string = NULL; gpointer binary = NULL; guint32 len = 0; void *comparator = (void *) TEST_STRING; ThriftServerSocket *tsocket = g_object_new (THRIFT_TYPE_SERVER_SOCKET, "port", port, NULL); transport = THRIFT_SERVER_TRANSPORT (tsocket); thrift_server_transport_listen (transport, NULL); client = thrift_server_transport_accept (transport, NULL); assert (client != NULL); tbp = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, "transport", client, NULL); protocol = THRIFT_PROTOCOL (tbp); assert (thrift_binary_protocol_read_bool (protocol, &value_boolean, NULL) > 0); assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) > 0); assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) > 0); assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) > 0); assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) > 0); assert (thrift_binary_protocol_read_double (protocol, &value_double, NULL) > 0); assert (thrift_binary_protocol_read_string (protocol, &string, NULL) > 0); assert (thrift_binary_protocol_read_binary (protocol, &binary, &len, NULL) > 0); assert (value_boolean == TEST_BOOL); assert (value_byte = TEST_BYTE); assert (value_16 = TEST_I16); assert (value_32 = TEST_I32); assert (value_64 = TEST_I64); assert (value_double = TEST_DOUBLE); assert (strcmp (TEST_STRING, string) == 0); assert (memcmp (comparator, binary, len) == 0); g_free (string); g_free (binary); thrift_binary_protocol_read_binary (protocol, &binary, &len, NULL); g_free (binary); transport_read_count = 0; transport_read_error_at = 0; assert (thrift_binary_protocol_read_binary (protocol, &binary, &len, NULL) == -1); transport_read_error_at = -1; transport_read_count = 0; transport_read_error_at = 1; assert (thrift_binary_protocol_read_binary (protocol, &binary, &len, NULL) == -1); transport_read_error_at = -1; transport_read_error = 1; assert (thrift_binary_protocol_read_bool (protocol, &value_boolean, NULL) == -1); assert (thrift_binary_protocol_read_byte (protocol, &value_byte, NULL) == -1); assert (thrift_binary_protocol_read_i16 (protocol, &value_16, NULL) == -1); assert (thrift_binary_protocol_read_i32 (protocol, &value_32, NULL) == -1); assert (thrift_binary_protocol_read_i64 (protocol, &value_64, NULL) == -1); assert (thrift_binary_protocol_read_double (protocol, &value_double, NULL) == -1); transport_read_error = 0; /* test partial write failure */ thrift_protocol_read_i32 (protocol, &value_32, NULL); thrift_transport_read_end (client, NULL); thrift_transport_close (client, NULL); g_object_unref (tbp); g_object_unref (client); g_object_unref (tsocket); }
int32_t thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, int *error) { switch (type) { case T_BOOL: { u_int8_t boolv; return thrift_protocol_read_bool (protocol, &boolv, error); } case T_BYTE: { int8_t bytev; return thrift_protocol_read_byte (protocol, &bytev, error); } case T_I16: { int16_t i16; return thrift_protocol_read_i16 (protocol, &i16, error); } case T_I32: { int32_t i32; return thrift_protocol_read_i32 (protocol, &i32, error); } case T_I64: { int64_t i64; return thrift_protocol_read_i64 (protocol, &i64, error); } case T_U16: { u_int16_t u16; return thrift_protocol_read_u16 (protocol, &u16, error); } case T_U32: { u_int32_t u32; return thrift_protocol_read_u32 (protocol, &u32, error); } case T_U64: { u_int64_t u64; return thrift_protocol_read_u64 (protocol, &u64, error); } case T_DOUBLE: { double dub; return thrift_protocol_read_double (protocol, &dub, error); } case T_STRING: case T_XML: { void *data; u_int32_t len; u_int32_t ret = thrift_protocol_read_binary (protocol, &data, &len, error); os_free (data); return ret; } case T_STRUCT: { u_int32_t result = 0; char *name; int16_t fid; ThriftType ftype; result += thrift_protocol_read_struct_begin (protocol, &name, error); while (1) { result += thrift_protocol_read_field_begin (protocol, &name, &ftype, &fid, error); if (ftype == T_STOP) { break; } result += thrift_protocol_skip (protocol, ftype, error); result += thrift_protocol_read_field_end (protocol, error); } result += thrift_protocol_read_struct_end (protocol, error); return result; } case T_MAP: { u_int32_t result = 0; ThriftType elem_type; u_int32_t i, size; result += thrift_protocol_read_set_begin (protocol, &elem_type, &size, error); for (i = 0; i < size; i++) { result += thrift_protocol_skip (protocol, elem_type, error); } result += thrift_protocol_read_set_end (protocol, error); return result; } case T_LIST: { u_int32_t result = 0; ThriftType elem_type; u_int32_t i, size; result += thrift_protocol_read_list_begin (protocol, &elem_type, &size, error); for (i = 0; i < size; i++) { result += thrift_protocol_skip (protocol, elem_type, error); } result += thrift_protocol_read_list_end (protocol, error); return result; } default: return 0; } }
gboolean calculator_client_recv_calculate (CalculatorIf * iface, gint32* _return, InvalidOperation ** ouch, GError ** error) { gint32 rseqid; gchar * fname = NULL; ThriftMessageType mtype; ThriftProtocol * protocol = SHARED_SERVICE_CLIENT (iface)->input_protocol; ThriftApplicationException *xception; if (thrift_protocol_read_message_begin (protocol, &fname, &mtype, &rseqid, error) < 0) { if (fname) g_free (fname); return FALSE; } if (mtype == T_EXCEPTION) { if (fname) g_free (fname); xception = g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION, NULL); thrift_struct_read (THRIFT_STRUCT (xception), protocol, NULL); thrift_protocol_read_message_end (protocol, NULL); thrift_transport_read_end (protocol->transport, NULL); g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR,xception->type, "application error: %s", xception->message); g_object_unref (xception); return FALSE; } else if (mtype != T_REPLY) { if (fname) g_free (fname); thrift_protocol_skip (protocol, T_STRUCT, NULL); thrift_protocol_read_message_end (protocol, NULL); thrift_transport_read_end (protocol->transport, NULL); g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR, THRIFT_APPLICATION_EXCEPTION_ERROR_INVALID_MESSAGE_TYPE, "invalid message type %d, expected T_REPLY", mtype); return FALSE; } else if (strncmp (fname, "calculate", 9) != 0) { thrift_protocol_skip (protocol, T_STRUCT, NULL); thrift_protocol_read_message_end (protocol,error); thrift_transport_read_end (protocol->transport, error); g_set_error (error, THRIFT_APPLICATION_EXCEPTION_ERROR, THRIFT_APPLICATION_EXCEPTION_ERROR_WRONG_METHOD_NAME, "wrong method name %s, expected calculate", fname); if (fname) g_free (fname); return FALSE; } if (fname) g_free (fname); { gint32 ret; gint32 xfer = 0; gchar *name = NULL; ThriftType ftype; gint16 fid; guint32 len = 0; gpointer data = NULL; /* satisfy -Wall in case these aren't used */ THRIFT_UNUSED_VAR (len); THRIFT_UNUSED_VAR (data); /* read the struct begin marker */ if ((ret = thrift_protocol_read_struct_begin (protocol, &name, error)) < 0) { if (name) g_free (name); return 0; } xfer += ret; if (name) g_free (name); name = NULL; /* read the struct fields */ while (1) { /* read the beginning of a field */ if ((ret = thrift_protocol_read_field_begin (protocol, &name, &ftype, &fid, error)) < 0) { if (name) g_free (name); return 0; } xfer += ret; if (name) g_free (name); name = NULL; /* break if we get a STOP field */ if (ftype == T_STOP) { break; } switch (fid) { case 0: if (ftype == T_I32) { if ((ret = thrift_protocol_read_i32 (protocol, &*_return, error)) < 0) return 0; xfer += ret; } else { if ((ret = thrift_protocol_skip (protocol, ftype, error)) < 0) return 0; xfer += ret; } break; case 1: if (ftype == T_STRUCT) { /* This struct is an exception */ if ( *ouch != NULL) { g_object_unref (*ouch); } *ouch = g_object_new (TYPE_INVALID_OPERATION, NULL); if ((ret = thrift_struct_read (THRIFT_STRUCT (*ouch), protocol, error)) < 0) { g_object_unref (*ouch); *ouch = NULL; return 0; } xfer += ret; } else { if ((ret = thrift_protocol_skip (protocol, ftype, error)) < 0) return 0; xfer += ret; } break; default: if ((ret = thrift_protocol_skip (protocol, ftype, error)) < 0) return 0; xfer += ret; break; } if ((ret = thrift_protocol_read_field_end (protocol, error)) < 0) return 0; xfer += ret; } if ((ret = thrift_protocol_read_struct_end (protocol, error)) < 0) return 0; xfer += ret; } if (thrift_protocol_read_message_end (protocol, error) < 0) return FALSE; if (!thrift_transport_read_end (protocol->transport, error)) return FALSE; if (*ouch != NULL) { g_set_error (error, INVALID_OPERATION_ERROR, INVALID_OPERATION_ERROR_CODE, "InvalidOperation"); return FALSE; } return TRUE; }
gint32 thrift_protocol_skip (ThriftProtocol *protocol, ThriftType type, GError **error) { switch (type) { case T_BOOL: { gboolean boolv; return thrift_protocol_read_bool (protocol, &boolv, error); } case T_BYTE: { gint8 bytev; return thrift_protocol_read_byte (protocol, &bytev, error); } case T_I16: { gint16 i16; return thrift_protocol_read_i16 (protocol, &i16, error); } case T_I32: { gint32 i32; return thrift_protocol_read_i32 (protocol, &i32, error); } case T_I64: { gint64 i64; return thrift_protocol_read_i64 (protocol, &i64, error); } case T_DOUBLE: { gdouble dub; return thrift_protocol_read_double (protocol, &dub, error); } case T_STRING: { gpointer data; guint32 len; gint32 ret = thrift_protocol_read_binary (protocol, &data, &len, error); g_free (data); return ret; } case T_STRUCT: { guint32 result = 0; gchar *name; gint16 fid; ThriftType ftype; result += thrift_protocol_read_struct_begin (protocol, &name, error); while (1) { result += thrift_protocol_read_field_begin (protocol, &name, &ftype, &fid, error); if (ftype == T_STOP) { break; } result += thrift_protocol_skip (protocol, ftype, error); result += thrift_protocol_read_field_end (protocol, error); } result += thrift_protocol_read_struct_end (protocol, error); return result; } case T_SET: { guint32 result = 0; ThriftType elem_type; guint32 i, size; result += thrift_protocol_read_set_begin (protocol, &elem_type, &size, error); for (i = 0; i < size; i++) { result += thrift_protocol_skip (protocol, elem_type, error); } result += thrift_protocol_read_set_end (protocol, error); return result; } case T_MAP: { guint32 result = 0; ThriftType elem_type; ThriftType key_type; guint32 i, size; result += thrift_protocol_read_map_begin (protocol, &key_type, &elem_type, &size, error); for (i = 0; i < size; i++) { result += thrift_protocol_skip (protocol, key_type, error); result += thrift_protocol_skip (protocol, elem_type, error); } result += thrift_protocol_read_map_end (protocol, error); return result; } case T_LIST: { guint32 result = 0; ThriftType elem_type; guint32 i, size; result += thrift_protocol_read_list_begin (protocol, &elem_type, &size, error); for (i = 0; i < size; i++) { result += thrift_protocol_skip (protocol, elem_type, error); } result += thrift_protocol_read_list_end (protocol, error); return result; } default: return 0; } }