gboolean t_test_second_service_client_send_blah_blah (TTestSecondServiceIf * iface, GError ** error) { gint32 cseqid = 0; ThriftProtocol * protocol = T_TEST_SECOND_SERVICE_CLIENT (iface)->output_protocol; if (thrift_protocol_write_message_begin (protocol, "blahBlah", T_CALL, cseqid, error) < 0) return FALSE; { gint32 ret; gint32 xfer = 0; if ((ret = thrift_protocol_write_struct_begin (protocol, "blahBlah_args", error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_stop (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_struct_end (protocol, error)) < 0) return 0; xfer += ret; } if (thrift_protocol_write_message_end (protocol, error) < 0) return FALSE; if (!thrift_transport_flush (protocol->transport, error)) return FALSE; if (!thrift_transport_write_end (protocol->transport, error)) return FALSE; return TRUE; }
gboolean calculator_client_send_ping (CalculatorIf * iface, GError ** error) { gint32 cseqid = 0; ThriftProtocol * protocol = SHARED_SERVICE_CLIENT (iface)->output_protocol; if (thrift_protocol_write_message_begin (protocol, "ping", T_CALL, cseqid, error) < 0) return FALSE; { gint32 ret; gint32 xfer = 0; if ((ret = thrift_protocol_write_struct_begin (protocol, "ping_args", error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_stop (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_struct_end (protocol, error)) < 0) return 0; xfer += ret; } if (thrift_protocol_write_message_end (protocol, error) < 0) return FALSE; if (!thrift_transport_flush (protocol->transport, error)) return FALSE; if (!thrift_transport_write_end (protocol->transport, error)) return FALSE; return TRUE; }
static gboolean thrift_dispatch_processor_real_dispatch_call (ThriftDispatchProcessor *self, ThriftProtocol *in, ThriftProtocol *out, gchar *fname, gint32 seqid, GError **error) { ThriftTransport *transport; ThriftApplicationException *xception; gchar *message; gint32 result; gboolean dispatch_result = FALSE; THRIFT_UNUSED_VAR (self); /* By default, return an application exception to the client indicating the method name is not recognized. */ if ((thrift_protocol_skip (in, T_STRUCT, error) < 0) || (thrift_protocol_read_message_end (in, error) < 0)) return FALSE; g_object_get (in, "transport", &transport, NULL); result = thrift_transport_read_end (transport, error); g_object_unref (transport); if (result < 0) return FALSE; if (thrift_protocol_write_message_begin (out, fname, T_EXCEPTION, seqid, error) < 0) return FALSE; message = g_strconcat ("Invalid method name: '", fname, "'", NULL); xception = g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION, "type", THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN_METHOD, "message", message, NULL); g_free (message); result = thrift_struct_write (THRIFT_STRUCT (xception), out, error); g_object_unref (xception); if ((result < 0) || (thrift_protocol_write_message_end (out, error) < 0)) return FALSE; g_object_get (out, "transport", &transport, NULL); dispatch_result = ((thrift_transport_write_end (transport, error) >= 0) && (thrift_transport_flush (transport, error) >= 0)); g_object_unref (transport); return dispatch_result; }
gboolean calculator_client_send_calculate (CalculatorIf * iface, const gint32 logid, const Work * w, GError ** error) { gint32 cseqid = 0; ThriftProtocol * protocol = SHARED_SERVICE_CLIENT (iface)->output_protocol; if (thrift_protocol_write_message_begin (protocol, "calculate", T_CALL, cseqid, error) < 0) return FALSE; { gint32 ret; gint32 xfer = 0; if ((ret = thrift_protocol_write_struct_begin (protocol, "calculate_args", error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_begin (protocol, "logid", T_I32, 1, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_i32 (protocol, logid, error)) < 0) return 0; if ((ret = thrift_protocol_write_field_end (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_begin (protocol, "w", T_STRUCT, 2, error)) < 0) return 0; xfer += ret; if ((ret = thrift_struct_write (THRIFT_STRUCT (w), protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_end (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_stop (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_struct_end (protocol, error)) < 0) return 0; xfer += ret; } if (thrift_protocol_write_message_end (protocol, error) < 0) return FALSE; if (!thrift_transport_flush (protocol->transport, error)) return FALSE; if (!thrift_transport_write_end (protocol->transport, error)) return FALSE; return TRUE; }
gboolean bucket_store_mapping_client_send_get_mapping (BucketStoreMappingIf * iface, const gchar * category, GError ** error) { gint32 cseqid = 0; ThriftProtocol * protocol = BUCKET_STORE_MAPPING_CLIENT (iface)->output_protocol; if (thrift_protocol_write_message_begin (protocol, "getMapping", T_CALL, cseqid, error) < 0) return FALSE; { gint32 ret; gint32 xfer = 0; if ((ret = thrift_protocol_write_struct_begin (protocol, "getMapping_args", error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_begin (protocol, "category", T_STRING, 1, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_string (protocol, category, error)) < 0) return 0; if ((ret = thrift_protocol_write_field_end (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_field_stop (protocol, error)) < 0) return 0; xfer += ret; if ((ret = thrift_protocol_write_struct_end (protocol, error)) < 0) return 0; xfer += ret; } if (thrift_protocol_write_message_end (protocol, error) < 0) return FALSE; if (!thrift_transport_flush (protocol->transport, error)) return FALSE; if (!thrift_transport_write_end (protocol->transport, error)) return FALSE; return TRUE; }
static gboolean t_test_second_service_processor_process_secondtest_string (TTestSecondServiceProcessor *self, gint32 sequence_id, ThriftProtocol *input_protocol, ThriftProtocol *output_protocol, GError **error) { gboolean result = TRUE; ThriftTransport * transport; TTestSecondServiceSecondtestStringArgs * args = g_object_new (T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_ARGS, NULL); g_object_get (input_protocol, "transport", &transport, NULL); if ((thrift_struct_read (THRIFT_STRUCT (args), input_protocol, error) != -1) && (thrift_protocol_read_message_end (input_protocol, error) != -1) && (thrift_transport_read_end (transport, error) != FALSE)) { gchar * thing; gchar * return_value; TTestSecondServiceSecondtestStringResult * result_struct; g_object_get (args, "thing", &thing, NULL); g_object_unref (transport); g_object_get (output_protocol, "transport", &transport, NULL); result_struct = g_object_new (T_TEST_TYPE_SECOND_SERVICE_SECONDTEST_STRING_RESULT, NULL); g_object_get (result_struct, "success", &return_value, NULL); if (t_test_second_service_handler_secondtest_string (T_TEST_SECOND_SERVICE_IF (self->handler), &return_value, thing, error) == TRUE) { g_object_set (result_struct, "success", return_value, NULL); if (return_value != NULL) g_free (return_value); result = ((thrift_protocol_write_message_begin (output_protocol, "secondtestString", T_REPLY, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (result_struct), output_protocol, error) != -1)); } else { if (*error == NULL) g_warning ("SecondService.secondtestString implementation returned FALSE " "but did not set an error"); ThriftApplicationException *xception = g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION, "type", *error != NULL ? (*error)->code : THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN, "message", *error != NULL ? (*error)->message : NULL, NULL); g_clear_error (error); result = ((thrift_protocol_write_message_begin (output_protocol, "secondtestString", T_EXCEPTION, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (xception), output_protocol, error) != -1)); g_object_unref (xception); } if (thing != NULL) g_free (thing); g_object_unref (result_struct); if (result == TRUE) result = ((thrift_protocol_write_message_end (output_protocol, error) != -1) && (thrift_transport_write_end (transport, error) != FALSE) && (thrift_transport_flush (transport, error) != FALSE)); } else result = FALSE; g_object_unref (transport); g_object_unref (args); return result; }
static gboolean calculator_processor_process_calculate (CalculatorProcessor *self, gint32 sequence_id, ThriftProtocol *input_protocol, ThriftProtocol *output_protocol, GError **error) { gboolean result = TRUE; ThriftTransport * transport; ThriftApplicationException *xception; CalculatorCalculateArgs * args = g_object_new (TYPE_CALCULATOR_CALCULATE_ARGS, NULL); g_object_get (input_protocol, "transport", &transport, NULL); if ((thrift_struct_read (THRIFT_STRUCT (args), input_protocol, error) != -1) && (thrift_protocol_read_message_end (input_protocol, error) != -1) && (thrift_transport_read_end (transport, error) != FALSE)) { gint logid; Work * w; InvalidOperation * ouch = NULL; gint return_value; CalculatorCalculateResult * result_struct; g_object_get (args, "logid", &logid, "w", &w, NULL); g_object_unref (transport); g_object_get (output_protocol, "transport", &transport, NULL); result_struct = g_object_new (TYPE_CALCULATOR_CALCULATE_RESULT, NULL); g_object_get (result_struct, "success", &return_value, NULL); if (calculator_handler_calculate (CALCULATOR_IF (self->handler), (gint32 *)&return_value, logid, w, &ouch, error) == TRUE) { g_object_set (result_struct, "success", return_value, NULL); result = ((thrift_protocol_write_message_begin (output_protocol, "calculate", T_REPLY, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (result_struct), output_protocol, error) != -1)); } else { if (ouch != NULL) { g_object_set (result_struct, "ouch", ouch, NULL); result = ((thrift_protocol_write_message_begin (output_protocol, "calculate", T_REPLY, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (result_struct), output_protocol, error) != -1)); } else { if (*error == NULL) g_warning ("Calculator.calculate implementation returned FALSE " "but did not set an error"); xception = g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION, "type", *error != NULL ? (*error)->code : THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN, "message", *error != NULL ? (*error)->message : NULL, NULL); g_clear_error (error); result = ((thrift_protocol_write_message_begin (output_protocol, "calculate", T_EXCEPTION, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (xception), output_protocol, error) != -1)); g_object_unref (xception); } } if (w != NULL) g_object_unref (w); g_object_unref (result_struct); if (result == TRUE) result = ((thrift_protocol_write_message_end (output_protocol, error) != -1) && (thrift_transport_write_end (transport, error) != FALSE) && (thrift_transport_flush (transport, error) != FALSE)); } else result = FALSE; g_object_unref (transport); g_object_unref (args); return result; }
static gboolean calculator_processor_process_ping (CalculatorProcessor *self, gint32 sequence_id, ThriftProtocol *input_protocol, ThriftProtocol *output_protocol, GError **error) { gboolean result = TRUE; ThriftTransport * transport; ThriftApplicationException *xception; CalculatorPingArgs * args = g_object_new (TYPE_CALCULATOR_PING_ARGS, NULL); g_object_get (input_protocol, "transport", &transport, NULL); if ((thrift_struct_read (THRIFT_STRUCT (args), input_protocol, error) != -1) && (thrift_protocol_read_message_end (input_protocol, error) != -1) && (thrift_transport_read_end (transport, error) != FALSE)) { CalculatorPingResult * result_struct; g_object_unref (transport); g_object_get (output_protocol, "transport", &transport, NULL); result_struct = g_object_new (TYPE_CALCULATOR_PING_RESULT, NULL); if (calculator_handler_ping (CALCULATOR_IF (self->handler), error) == TRUE) { result = ((thrift_protocol_write_message_begin (output_protocol, "ping", T_REPLY, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (result_struct), output_protocol, error) != -1)); } else { if (*error == NULL) g_warning ("Calculator.ping implementation returned FALSE " "but did not set an error"); xception = g_object_new (THRIFT_TYPE_APPLICATION_EXCEPTION, "type", *error != NULL ? (*error)->code : THRIFT_APPLICATION_EXCEPTION_ERROR_UNKNOWN, "message", *error != NULL ? (*error)->message : NULL, NULL); g_clear_error (error); result = ((thrift_protocol_write_message_begin (output_protocol, "ping", T_EXCEPTION, sequence_id, error) != -1) && (thrift_struct_write (THRIFT_STRUCT (xception), output_protocol, error) != -1)); g_object_unref (xception); } g_object_unref (result_struct); if (result == TRUE) result = ((thrift_protocol_write_message_end (output_protocol, error) != -1) && (thrift_transport_write_end (transport, error) != FALSE) && (thrift_transport_flush (transport, error) != FALSE)); } else result = FALSE; g_object_unref (transport); g_object_unref (args); return result; }