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 <inttypes.h>
21 #include <string.h>
22 #include <unistd.h>
23
24 #include <thrift/c_glib/thrift.h>
25 #include <thrift/c_glib/thrift_application_exception.h>
26
27 #include "thrift_second_service_handler.h"
28
29 /* A handler that implements the TTestSecondServiceIf interface */
30
31 G_DEFINE_TYPE (SecondServiceHandler,
32 second_service_handler,
33 T_TEST_TYPE_SECOND_SERVICE_HANDLER);
34
35
36 gboolean
second_service_handler_secondtest_string(TTestSecondServiceIf * iface,gchar ** _return,const gchar * thing,GError ** error)37 second_service_handler_secondtest_string (TTestSecondServiceIf *iface,
38 gchar **_return,
39 const gchar *thing,
40 GError **error)
41 {
42 THRIFT_UNUSED_VAR (iface);
43 THRIFT_UNUSED_VAR (error);
44 gchar buffer[256];
45
46 printf ("testSecondServiceMultiplexSecondTestString(\"%s\")\n", thing);
47 snprintf(buffer, 255, "testString(\"%s\")", thing);
48 *_return = g_strdup (buffer);
49
50 return TRUE;
51 }
52
53 static void
second_service_handler_init(SecondServiceHandler * self)54 second_service_handler_init (SecondServiceHandler *self)
55 {
56 THRIFT_UNUSED_VAR (self);
57 }
58
59 static void
second_service_handler_class_init(SecondServiceHandlerClass * klass)60 second_service_handler_class_init (SecondServiceHandlerClass *klass)
61 {
62 TTestSecondServiceHandlerClass *base_class =
63 T_TEST_SECOND_SERVICE_HANDLER_CLASS (klass);
64
65
66 base_class->secondtest_string =
67 second_service_handler_secondtest_string;
68
69 }
70