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 #ifndef _THRIFT_PROCESSOR_H 21 #define _THRIFT_PROCESSOR_H 22 23 #include <glib-object.h> 24 25 #include <thrift/c_glib/protocol/thrift_protocol.h> 26 27 G_BEGIN_DECLS 28 29 /*! \file thrift_processor.h 30 * \brief Abstract class for Thrift processors. 31 */ 32 33 /* type macros */ 34 #define THRIFT_TYPE_PROCESSOR (thrift_processor_get_type ()) 35 #define THRIFT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_PROCESSOR, ThriftProcessor)) 36 #define THRIFT_IS_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_PROCESSOR)) 37 #define THRIFT_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_PROCESSOR, ThriftProcessorClass)) 38 #define THRIFT_IS_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_PROCESSOR)) 39 #define THRIFT_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_PROCESSOR, ThriftProcessorClass)) 40 41 /*! 42 * Thrift Processorobject 43 */ 44 struct _ThriftProcessor 45 { 46 GObject parent; 47 }; 48 typedef struct _ThriftProcessor ThriftProcessor; 49 50 /*! 51 * Thrift Processor class 52 */ 53 struct _ThriftProcessorClass 54 { 55 GObjectClass parent; 56 57 /* vtable */ 58 gboolean (*process) (ThriftProcessor *processor, ThriftProtocol *in, 59 ThriftProtocol *out, GError **error); 60 }; 61 typedef struct _ThriftProcessorClass ThriftProcessorClass; 62 63 /* used by THRIFT_TYPE_PROCESSOR */ 64 GType thrift_processor_get_type (void); 65 66 /*! 67 * Processes the request. 68 * \public \memberof ThriftProcessorClass 69 */ 70 gboolean thrift_processor_process (ThriftProcessor *processor, 71 ThriftProtocol *in, ThriftProtocol *out, 72 GError **error); 73 74 G_END_DECLS 75 76 #endif /* _THRIFT_PROCESSOR_H */ 77