http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TSocket.as ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TSocket.as b/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TSocket.as deleted file mode 100644 index 6891388..0000000 --- a/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TSocket.as +++ /dev/null @@ -1,189 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.thrift.transport -{ - - import flash.events.EventDispatcher; - import flash.events.Event; - import flash.events.IOErrorEvent; - import flash.events.ProgressEvent; - import flash.events.SecurityErrorEvent; - import flash.errors.EOFError; - import flash.errors.IOError; - import flash.net.URLLoader; - import flash.net.URLLoaderDataFormat; - import flash.net.URLRequest; - import flash.net.URLRequestMethod; - import flash.utils.IDataInput; - import flash.utils.IDataOutput; - import flash.utils.ByteArray; - import flash.net.Socket; - - - /** - * Socket implementation of the TTransport interface. Used for working with a - * Thrift Socket Server based implementations. - */ - - public class TSocket extends TTransport - { - private var socket:Socket = null; - - private var host:String; - - private var port:int; - - private var obuffer:ByteArray = new ByteArray(); - - private var input:IDataInput; - - private var output:IDataOutput; - - private var ioCallback:Function = null; - - private var eventDispatcher:EventDispatcher = new EventDispatcher(); - - public function TSocket(host:String, port:int):void - { - this.host = host; - this.port = port; - } - - public override function close():void - { - this.input = null; - this.output = null; - socket.close() - } - - public override function peek():Boolean - { - if(socket.connected) - { - trace("Bytes remained:" + socket.bytesAvailable); - return socket.bytesAvailable>0; - } - return false; - } - - public override function read(buf:ByteArray, off:int, len:int):int - { - var n1:int = 0, n2:int = 0, n3:int = 0, n4:int = 0, cidx:int = 2; - var chunkSize:ByteArray = new ByteArray(); - - try - { - input.readBytes(buf, off, len); - return len; - } - catch (e:EOFError) - { - trace(e); - throw new TTransportError(TTransportError.END_OF_FILE, "No more data available."); - } - catch (e:IOError) - { - trace(e); - if(isOpen()) - { - throw new TTransportError(TTransportError.UNKNOWN, "IO error while reading: " + e); - } - else - { - throw new TTransportError(TTransportError.NOT_OPEN, "Socket seem not to be opened: " + e); - } - } - catch (e:Error) - { - trace(e); - throw new TTransportError(TTransportError.UNKNOWN, "Bad IO error: " + e); - } - return 0; - } - - public override function write(buf:ByteArray, off:int, len:int):void - { - obuffer.writeBytes(buf, off, len); - } - - public function addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void - { - this.eventDispatcher.addEventListener(type, listener, useCapture, priority, useWeakReference); - } - - public override function open():void - { - this.socket = new Socket(); - this.socket.addEventListener(Event.CONNECT, socketConnected); - this.socket.addEventListener(IOErrorEvent.IO_ERROR, socketError); - this.socket.addEventListener(SecurityErrorEvent.SECURITY_ERROR, socketSecurityError); - this.socket.addEventListener(ProgressEvent.SOCKET_DATA, socketDataHandler); - this.socket.connect(host, port); - } - - public function socketConnected(event:Event):void - { - this.output = this.socket; - this.input = this.socket; - this.eventDispatcher.dispatchEvent(event); - } - - public function socketError(event:IOErrorEvent):void - { - trace("Error Connecting:" + event); - this.close(); - if (ioCallback == null) - { - return; - } - ioCallback(new TTransportError(TTransportError.UNKNOWN, "IOError: " + event.text)); - this.eventDispatcher.dispatchEvent(event); - } - - public function socketSecurityError(event:SecurityErrorEvent):void - { - trace("Security Error Connecting:" + event); - this.close(); - this.eventDispatcher.dispatchEvent(event); - } - - public function socketDataHandler(event:ProgressEvent):void - { - if (ioCallback != null) - { - ioCallback(null); - } - this.eventDispatcher.dispatchEvent(event); - } - - public override function flush(callback:Function = null):void - { - this.ioCallback = callback; - this.output.writeBytes(this.obuffer); - this.socket.flush(); - this.obuffer.clear(); - } - - public override function isOpen():Boolean - { - return (this.socket == null ? false : this.socket.connected); - } - } -}
http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransport.as ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransport.as b/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransport.as deleted file mode 100644 index 83160af..0000000 --- a/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransport.as +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.thrift.transport { - - import flash.utils.ByteArray; - import org.apache.thrift.AbstractMethodError; - - public class TTransport { - - /** - * Queries whether the transport is open. - * - * @return True if the transport is open. - */ - public function isOpen():Boolean { - throw new AbstractMethodError(); - } - - /** - * Is there more data to be read? - * - * @return True if the remote side is still alive and feeding us - */ - public function peek():Boolean { - return isOpen(); - } - - /** - * Opens the transport for reading/writing. - * - * @throws TTransportException if the transport could not be opened - */ - public function open():void { - throw new AbstractMethodError(); - } - - /** - * Closes the transport. - */ - public function close():void { - throw new AbstractMethodError(); - }; - - /** - * Reads up to len bytes into buffer buf, starting att offset off. - * - * @param buf Array to read into - * @param off Index to start reading at - * @param len Maximum number of bytes to read - * @return The number of bytes actually read - * @throws TTransportException if there was an error reading data - */ - public function read(buf:ByteArray, off:int, len:int):int { - throw new AbstractMethodError(); - } - - /** - * Guarantees that all of len bytes are actually read off the transport. - * - * @param buf Array to read into - * @param off Index to start reading at - * @param len Maximum number of bytes to read - * @return The number of bytes actually read, which must be equal to len - * @throws TTransportException if there was an error reading data - */ - public function readAll(buf:ByteArray, off:int, len:int):int { - var got:int = 0; - var ret:int = 0; - while (got < len) { - ret = read(buf, off+got, len-got); - if (ret <= 0) { - throw new TTransportError(TTransportError.UNKNOWN, "Cannot read. Remote side has closed. Tried to read " + len + " bytes, but only got " + got + " bytes."); - } - got += ret; - } - return got; - } - - /** - * Writes the buffer to the output - * - * @param buf The output data buffer - * @throws TTransportException if an error occurs writing data - */ - public function writeAll(buf:ByteArray):void { - write(buf, 0, buf.length); - } - - /** - * Writes up to len bytes from the buffer. - * - * @param buf The output data buffer - * @param off The offset to start writing from - * @param len The number of bytes to write - * @throws TTransportException if there was an error writing data - */ - public function write(buf:ByteArray, off:int, len:int):void { - throw new AbstractMethodError(); - } - - /** - * Flush any pending data out of a transport buffer. - * - * @throws TTransportException if there was an error writing out data. - */ - public function flush(callback:Function=null):void { - throw new AbstractMethodError(); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransportError.as ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransportError.as b/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransportError.as deleted file mode 100644 index 10a6f62..0000000 --- a/depends/thirdparty/thrift/lib/as3/src/org/apache/thrift/transport/TTransportError.as +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -package org.apache.thrift.transport { - - import org.apache.thrift.TError; - - public class TTransportError extends TError { - - public static const UNKNOWN:int = 0; - public static const NOT_OPEN:int = 1; - public static const ALREADY_OPEN:int = 2; - public static const TIMED_OUT:int = 3; - public static const END_OF_FILE:int = 4; - - public function TTransportError(error:int = UNKNOWN, message:String = "") { - super(message, error); - } - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/CMakeLists.txt ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/CMakeLists.txt b/depends/thirdparty/thrift/lib/c_glib/CMakeLists.txt deleted file mode 100644 index 2c0ce76..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/CMakeLists.txt +++ /dev/null @@ -1,66 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - -# Find required packages -find_package(GLIB REQUIRED COMPONENTS gobject) -include_directories(${GLIB_INCLUDE_DIRS}) - -include_directories(src) - -# SYSLIBS contains libraries that need to be linked to all lib targets -set(SYSLIBS ${GLIB_LIBRARIES} ${GLIB_GOBJECT_LIBRARIES}) - -# Create the thrift C glib library -set(thrift_c_glib_SOURCES - src/thrift/c_glib/thrift.c - src/thrift/c_glib/thrift_struct.c - src/thrift/c_glib/thrift_application_exception.c - src/thrift/c_glib/processor/thrift_processor.c - src/thrift/c_glib/processor/thrift_dispatch_processor.c - src/thrift/c_glib/protocol/thrift_protocol.c - src/thrift/c_glib/protocol/thrift_protocol_factory.c - src/thrift/c_glib/protocol/thrift_binary_protocol.c - src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c - src/thrift/c_glib/transport/thrift_transport.c - src/thrift/c_glib/transport/thrift_transport_factory.c - src/thrift/c_glib/transport/thrift_buffered_transport_factory.c - src/thrift/c_glib/transport/thrift_framed_transport_factory.c - src/thrift/c_glib/transport/thrift_socket.c - src/thrift/c_glib/transport/thrift_server_transport.c - src/thrift/c_glib/transport/thrift_server_socket.c - src/thrift/c_glib/transport/thrift_buffered_transport.c - src/thrift/c_glib/transport/thrift_framed_transport.c - src/thrift/c_glib/transport/thrift_memory_buffer.c - src/thrift/c_glib/server/thrift_server.c - src/thrift/c_glib/server/thrift_simple_server.c -) - -# Contains the thrift specific ADD_LIBRARY_THRIFT and TARGET_LINK_LIBRARIES_THRIFT -include(ThriftMacros) - -ADD_LIBRARY_THRIFT(thrift_c_glib ${thrift_c_glib_SOURCES}) -TARGET_LINK_LIBRARIES_THRIFT(thrift_c_glib ${SYSLIBS}) - -# Install the headers -install(DIRECTORY "src/thrift" DESTINATION "${INCLUDE_INSTALL_DIR}" - FILES_MATCHING PATTERN "*.h") - -if(BUILD_TESTING) - add_subdirectory(test) -endif() http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/Makefile.am ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/Makefile.am b/depends/thirdparty/thrift/lib/c_glib/Makefile.am deleted file mode 100755 index 153d14b..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/Makefile.am +++ /dev/null @@ -1,99 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you under the Apache License, Version 2.0 (the -# "License"); you may not use this file except in compliance -# with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# -AUTOMAKE_OPTIONS = serial-tests -SUBDIRS = . test - -pkgconfigdir = $(libdir)/pkgconfig - -lib_LTLIBRARIES = libthrift_c_glib.la -pkgconfig_DATA = thrift_c_glib.pc - -AM_CPPFLAGS = -Isrc -I src/thrift/c_glib -AM_CFLAGS = -Wall -Wextra -pedantic - -# Define the source files for the module - -libthrift_c_glib_la_SOURCES = src/thrift/c_glib/thrift.c \ - src/thrift/c_glib/thrift_struct.c \ - src/thrift/c_glib/thrift_application_exception.c \ - src/thrift/c_glib/processor/thrift_processor.c \ - src/thrift/c_glib/processor/thrift_dispatch_processor.c \ - src/thrift/c_glib/protocol/thrift_protocol.c \ - src/thrift/c_glib/protocol/thrift_protocol_factory.c \ - src/thrift/c_glib/protocol/thrift_binary_protocol.c \ - src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c \ - src/thrift/c_glib/transport/thrift_transport.c \ - src/thrift/c_glib/transport/thrift_transport_factory.c \ - src/thrift/c_glib/transport/thrift_buffered_transport_factory.c \ - src/thrift/c_glib/transport/thrift_framed_transport_factory.c \ - src/thrift/c_glib/transport/thrift_socket.c \ - src/thrift/c_glib/transport/thrift_server_transport.c \ - src/thrift/c_glib/transport/thrift_server_socket.c \ - src/thrift/c_glib/transport/thrift_buffered_transport.c \ - src/thrift/c_glib/transport/thrift_framed_transport.c \ - src/thrift/c_glib/transport/thrift_memory_buffer.c \ - src/thrift/c_glib/server/thrift_server.c \ - src/thrift/c_glib/server/thrift_simple_server.c - -libthrift_c_glib_la_CFLAGS = $(AM_CFLAGS) $(GLIB_CFLAGS) - -include_thriftdir = $(includedir)/thrift/c_glib -include_thrift_HEADERS = \ - $(top_builddir)/config.h \ - src/thrift/c_glib/thrift.h \ - src/thrift/c_glib/thrift_application_exception.h \ - src/thrift/c_glib/thrift_struct.h - -include_protocoldir = $(include_thriftdir)/protocol -include_protocol_HEADERS = src/thrift/c_glib/protocol/thrift_protocol.h \ - src/thrift/c_glib/protocol/thrift_protocol_factory.h \ - src/thrift/c_glib/protocol/thrift_binary_protocol.h \ - src/thrift/c_glib/protocol/thrift_binary_protocol_factory.h - -include_transportdir = $(include_thriftdir)/transport -include_transport_HEADERS = src/thrift/c_glib/transport/thrift_buffered_transport.h \ - src/thrift/c_glib/transport/thrift_framed_transport.h \ - src/thrift/c_glib/transport/thrift_memory_buffer.h \ - src/thrift/c_glib/transport/thrift_server_socket.h \ - src/thrift/c_glib/transport/thrift_server_transport.h \ - src/thrift/c_glib/transport/thrift_socket.h \ - src/thrift/c_glib/transport/thrift_transport.h \ - src/thrift/c_glib/transport/thrift_transport_factory.h \ - src/thrift/c_glib/transport/thrift_buffered_transport_factory.h \ - src/thrift/c_glib/transport/thrift_framed_transport_factory.h - -include_serverdir = $(include_thriftdir)/server -include_server_HEADERS = src/thrift/c_glib/server/thrift_server.h \ - src/thrift/c_glib/server/thrift_simple_server.h - -include_processordir = $(include_thriftdir)/processor -include_processor_HEADERS = src/thrift/c_glib/processor/thrift_processor.h \ - src/thrift/c_glib/processor/thrift_dispatch_processor.h - - -EXTRA_DIST = \ - CMakeLists.txt \ - coding_standards.md \ - README.md \ - test/glib.suppress \ - thrift_c_glib.pc.in - -CLEANFILES = \ - *.gcno \ - *.gcda http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/README.md ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/README.md b/depends/thirdparty/thrift/lib/c_glib/README.md deleted file mode 100644 index fd70d08..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/README.md +++ /dev/null @@ -1,34 +0,0 @@ -Thrift C Software Library - -License -======= - -Licensed to the Apache Software Foundation (ASF) under one -or more contributor license agreements. See the NOTICE file -distributed with this work for additional information -regarding copyright ownership. The ASF licenses this file -to you under the Apache License, Version 2.0 (the -"License"); you may not use this file except in compliance -with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, -software distributed under the License is distributed on an -"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -KIND, either express or implied. See the License for the -specific language governing permissions and limitations -under the License. - -Using Thrift with C -=================== - -The Thrift C libraries are built using the GNU tools. Follow the instructions -in the top-level README in order to generate the Makefiles. - -Dependencies -============ - -GLib -http://www.gtk.org/ - http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/coding_standards.md ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/coding_standards.md b/depends/thirdparty/thrift/lib/c_glib/coding_standards.md deleted file mode 100644 index 24b3a00..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/coding_standards.md +++ /dev/null @@ -1,5 +0,0 @@ -## C Glib Coding Standards - -Please follow: - * [Thrift General Coding Standards](/doc/coding_standards.md) - * [GNOME C Coding Style](https://help.gnome.org/users/programming-guidelines/stable/c-coding-style.html.en) http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c deleted file mode 100644 index 57f0bed..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <thrift/c_glib/thrift.h> -#include <thrift/c_glib/thrift_application_exception.h> -#include <thrift/c_glib/processor/thrift_dispatch_processor.h> - -G_DEFINE_ABSTRACT_TYPE (ThriftDispatchProcessor, - thrift_dispatch_processor, - THRIFT_TYPE_PROCESSOR) - -gboolean -thrift_dispatch_processor_process (ThriftProcessor *processor, - ThriftProtocol *in, - ThriftProtocol *out, - GError **error) -{ - gchar *fname; - ThriftMessageType mtype; - gint32 seqid; - ThriftDispatchProcessor *dispatch_processor = - THRIFT_DISPATCH_PROCESSOR (processor); - - /* Read the start of the message, which we expect to be a method call */ - if (thrift_protocol_read_message_begin (in, - &fname, - &mtype, - &seqid, - error) < 0) { - g_warning ("error reading start of message: %s", - (error != NULL) ? (*error)->message : "(null)"); - return FALSE; - } - else if (mtype != T_CALL && mtype != T_ONEWAY) { - g_warning ("received invalid message type %d from client", mtype); - return FALSE; - } - - /* Dispatch the method call */ - return THRIFT_DISPATCH_PROCESSOR_GET_CLASS (dispatch_processor) - ->dispatch_call (dispatch_processor, - in, - out, - fname, - seqid, - error); -} - -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; -} - -static void -thrift_dispatch_processor_init (ThriftDispatchProcessor *self) -{ - THRIFT_UNUSED_VAR (self); -} - -static void -thrift_dispatch_processor_class_init (ThriftDispatchProcessorClass *klass) -{ - ThriftProcessorClass *processor_class = - THRIFT_PROCESSOR_CLASS (klass); - - /* Implement ThriftProcessor's process method */ - processor_class->process = thrift_dispatch_processor_process; - - /* Provide a default implement for dispatch_call, which returns an exception - to the client indicating the method name was not recognized */ - klass->dispatch_call = thrift_dispatch_processor_real_dispatch_call; -} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.h ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.h deleted file mode 100644 index 5afb85e..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_dispatch_processor.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifndef _THRIFT_DISPATCH_PROCESSOR_H -#define _THRIFT_DISPATCH_PROCESSOR_H - -#include <glib-object.h> - -#include <thrift/c_glib/processor/thrift_processor.h> - -G_BEGIN_DECLS - -/*! \file thrift_dispatch_processor.h - * \brief Parses a method-call message header and invokes a function - * to dispatch the call by function name. - * - * ThriftDispatchProcessor is an abstract helper class that parses the - * header of a method-call message and invokes a member function, - * dispatch_call, with the method's name. - * - * Subclasses must implement dispatch_call to dispatch the method call - * to the implementing function. - */ - -/* Type macros */ -#define THRIFT_TYPE_DISPATCH_PROCESSOR (thrift_dispatch_processor_get_type ()) -#define THRIFT_DISPATCH_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_DISPATCH_PROCESSOR, ThriftDispatchProcessor)) -#define THRIFT_IS_DISPATCH_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_DISPATCH_PROCESSOR)) -#define THRIFT_DISPATCH_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_DISPATCH_PROCESSOR, ThriftDispatchProcessorClass)) -#define THRIFT_IS_DISPATCH_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_DISPATCH_PROCESSOR)) -#define THRIFT_DISPATCH_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_DISPATCH_PROCESSOR, ThriftDispatchProcessorClass)) - -/*! - * Thrift Dispatch Processor object - */ -struct _ThriftDispatchProcessor -{ - ThriftProcessor parent; -}; -typedef struct _ThriftDispatchProcessor ThriftDispatchProcessor; - -/*! - * Thrift Dispatch Processor class - */ -struct _ThriftDispatchProcessorClass -{ - ThriftProcessorClass parent; - - /* public */ - gboolean (*process) (ThriftProcessor *processor, - ThriftProtocol *in, - ThriftProtocol *out, - GError **error); - - /* protected */ - gboolean (*dispatch_call) (ThriftDispatchProcessor *self, - ThriftProtocol *in, - ThriftProtocol *out, - gchar *fname, - gint32 seqid, - GError **error); -}; -typedef struct _ThriftDispatchProcessorClass ThriftDispatchProcessorClass; - -/* Used by THRIFT_TYPE_DISPATCH_PROCESSOR */ -GType thrift_dispatch_processor_get_type (void); - -/*! - * Processes a request. - * \public \memberof ThriftDispatchProcessorClass - */ -gboolean thrift_dispatch_processor_process (ThriftProcessor *processor, - ThriftProtocol *in, - ThriftProtocol *out, - GError **error); - -G_END_DECLS - -#endif /* _THRIFT_DISPATCH_PROCESSOR_H */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.c ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.c deleted file mode 100644 index c242c25..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <thrift/c_glib/thrift.h> -#include <thrift/c_glib/processor/thrift_processor.h> - -G_DEFINE_ABSTRACT_TYPE(ThriftProcessor, thrift_processor, G_TYPE_OBJECT) - -gboolean -thrift_processor_process (ThriftProcessor *processor, ThriftProtocol *in, - ThriftProtocol *out, GError **error) -{ - return - THRIFT_PROCESSOR_GET_CLASS (processor)->process (processor, in, out, error); -} - -/* class initializer for ThriftProcessor */ -static void -thrift_processor_class_init (ThriftProcessorClass *cls) -{ - /* set these as virtual methods to be implemented by a subclass */ - cls->process = thrift_processor_process; -} - -static void -thrift_processor_init (ThriftProcessor *processor) -{ - THRIFT_UNUSED_VAR (processor); -} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.h ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.h deleted file mode 100644 index ff2d2da..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/processor/thrift_processor.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifndef _THRIFT_PROCESSOR_H -#define _THRIFT_PROCESSOR_H - -#include <glib-object.h> - -#include <thrift/c_glib/protocol/thrift_protocol.h> - -G_BEGIN_DECLS - -/*! \file thrift_processor.h - * \brief Abstract class for Thrift processors. - */ - -/* type macros */ -#define THRIFT_TYPE_PROCESSOR (thrift_processor_get_type ()) -#define THRIFT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_PROCESSOR, ThriftProcessor)) -#define THRIFT_IS_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_PROCESSOR)) -#define THRIFT_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_PROCESSOR, ThriftProcessorClass)) -#define THRIFT_IS_PROCESSOR_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_PROCESSOR)) -#define THRIFT_PROCESSOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_PROCESSOR, ThriftProcessorClass)) - -/*! - * Thrift Processorobject - */ -struct _ThriftProcessor -{ - GObject parent; -}; -typedef struct _ThriftProcessor ThriftProcessor; - -/*! - * Thrift Processor class - */ -struct _ThriftProcessorClass -{ - GObjectClass parent; - - /* vtable */ - gboolean (*process) (ThriftProcessor *processor, ThriftProtocol *in, - ThriftProtocol *out, GError **error); -}; -typedef struct _ThriftProcessorClass ThriftProcessorClass; - -/* used by THRIFT_TYPE_PROCESSOR */ -GType thrift_processor_get_type (void); - -/*! - * Processes the request. - * \public \memberof ThriftProcessorClass - */ -gboolean thrift_processor_process (ThriftProcessor *processor, - ThriftProtocol *in, ThriftProtocol *out, - GError **error); - -G_END_DECLS - -#endif /* _THRIFT_PROCESSOR_H */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.c ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.c deleted file mode 100644 index 358396c..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.c +++ /dev/null @@ -1,904 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <string.h> -#include <stdio.h> - -#include <thrift/c_glib/thrift.h> -#include <thrift/c_glib/protocol/thrift_protocol.h> -#include <thrift/c_glib/protocol/thrift_binary_protocol.h> - -G_DEFINE_TYPE(ThriftBinaryProtocol, thrift_binary_protocol, THRIFT_TYPE_PROTOCOL) - -static guint64 -thrift_bitwise_cast_guint64 (gdouble v) -{ - union { - gdouble from; - guint64 to; - } u; - u.from = v; - return u.to; -} - -static gdouble -thrift_bitwise_cast_gdouble (guint64 v) -{ - union { - guint64 from; - gdouble to; - } u; - u.from = v; - return u.to; -} - -gint32 -thrift_binary_protocol_write_message_begin (ThriftProtocol *protocol, - const gchar *name, const ThriftMessageType message_type, - const gint32 seqid, GError **error) -{ - gint32 version = (THRIFT_BINARY_PROTOCOL_VERSION_1) - | ((gint32) message_type); - gint32 ret; - gint32 xfer = 0; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = thrift_protocol_write_i32 (protocol, version, error)) < 0) - { - return -1; - } - xfer += ret; - if ((ret = thrift_protocol_write_string (protocol, name, error)) < 0) - { - return -1; - } - xfer += ret; - if ((ret = thrift_protocol_write_i32 (protocol, seqid, error)) < 0) - { - return -1; - } - xfer += ret; - return xfer; -} - -gint32 -thrift_binary_protocol_write_message_end (ThriftProtocol *protocol, - GError **error) -{ - /* satisfy -Wall */ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_struct_begin (ThriftProtocol *protocol, - const gchar *name, - GError **error) -{ - /* satisfy -Wall */ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (name); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_struct_end (ThriftProtocol *protocol, - GError **error) -{ - /* satisfy -Wall */ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_field_begin (ThriftProtocol *protocol, - const gchar *name, - const ThriftType field_type, - const gint16 field_id, - GError **error) -{ - gint32 ret; - gint32 xfer = 0; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - THRIFT_UNUSED_VAR (name); - - if ((ret = thrift_protocol_write_byte (protocol, (gint8) field_type, - error)) < 0) - { - return -1; - } - xfer += ret; - if ((ret = thrift_protocol_write_i16 (protocol, field_id, error)) < 0) - { - return -1; - } - xfer += ret; - return xfer; -} - -gint32 -thrift_binary_protocol_write_field_end (ThriftProtocol *protocol, - GError **error) -{ - /* satisfy -Wall */ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_field_stop (ThriftProtocol *protocol, - GError **error) -{ - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - return thrift_protocol_write_byte (protocol, (gint8) T_STOP, error); -} - -gint32 -thrift_binary_protocol_write_map_begin (ThriftProtocol *protocol, - const ThriftType key_type, - const ThriftType value_type, - const guint32 size, - GError **error) -{ - gint32 ret; - gint32 xfer = 0; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = thrift_protocol_write_byte (protocol, (gint8) key_type, - error)) < 0) - { - return -1; - } - xfer += ret; - if ((ret = thrift_protocol_write_byte (protocol, (gint8) value_type, - error)) < 0) - { - return -1; - } - xfer += ret; - if ((ret = thrift_protocol_write_i32 (protocol, (gint32) size, error)) < 0) - { - return -1; - } - xfer += ret; - return xfer; -} - -gint32 -thrift_binary_protocol_write_map_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_list_begin (ThriftProtocol *protocol, - const ThriftType element_type, - const guint32 size, - GError **error) -{ - gint32 ret; - gint32 xfer = 0; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = thrift_protocol_write_byte (protocol, (gint8) element_type, - error)) < 0) - { - return -1; - } - xfer += ret; - - if ((ret = thrift_protocol_write_i32 (protocol, (gint32) size, error)) < 0) - { - return -1; - } - xfer += ret; - - return xfer; -} - -gint32 -thrift_binary_protocol_write_list_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_set_begin (ThriftProtocol *protocol, - const ThriftType element_type, - const guint32 size, - GError **error) -{ - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - return thrift_protocol_write_list_begin (protocol, element_type, - size, error); -} - -gint32 -thrift_binary_protocol_write_set_end (ThriftProtocol *protocol, GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_write_bool (ThriftProtocol *protocol, - const gboolean value, GError **error) -{ - guint8 tmp; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - tmp = value ? 1 : 0; - return thrift_protocol_write_byte (protocol, tmp, error); -} - -gint32 -thrift_binary_protocol_write_byte (ThriftProtocol *protocol, const gint8 value, - GError **error) -{ - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if (thrift_transport_write (protocol->transport, - (const gpointer) &value, 1, error)) - { - return 1; - } else { - return -1; - } -} - -gint32 -thrift_binary_protocol_write_i16 (ThriftProtocol *protocol, const gint16 value, - GError **error) -{ - gint16 net; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - net = g_htons (value); - if (thrift_transport_write (protocol->transport, - (const gpointer) &net, 2, error)) - { - return 2; - } else { - return -1; - } -} - -gint32 -thrift_binary_protocol_write_i32 (ThriftProtocol *protocol, const gint32 value, - GError **error) -{ - gint32 net; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - net = g_htonl (value); - if (thrift_transport_write (protocol->transport, - (const gpointer) &net, 4, error)) - { - return 4; - } else { - return -1; - } -} - -gint32 -thrift_binary_protocol_write_i64 (ThriftProtocol *protocol, const gint64 value, - GError **error) -{ - gint64 net; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - net = GUINT64_TO_BE (value); - if (thrift_transport_write (protocol->transport, - (const gpointer) &net, 8, error)) - { - return 8; - } else { - return -1; - } -} - -gint32 -thrift_binary_protocol_write_double (ThriftProtocol *protocol, - const gdouble value, GError **error) -{ - guint64 bits; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - bits = GUINT64_FROM_BE (thrift_bitwise_cast_guint64 (value)); - if (thrift_transport_write (protocol->transport, - (const gpointer) &bits, 8, error)) - { - return 8; - } else { - return -1; - } -} - -gint32 -thrift_binary_protocol_write_string (ThriftProtocol *protocol, - const gchar *str, GError **error) -{ - guint32 len; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - len = str != NULL ? strlen (str) : 0; - /* write the string length + 1 which includes the null terminator */ - return thrift_protocol_write_binary (protocol, (const gpointer) str, - len, error); -} - -gint32 -thrift_binary_protocol_write_binary (ThriftProtocol *protocol, - const gpointer buf, - const guint32 len, GError **error) -{ - gint32 ret; - gint32 xfer = 0; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = thrift_protocol_write_i32 (protocol, len, error)) < 0) - { - return -1; - } - xfer += ret; - - if (len > 0) - { - if (thrift_transport_write (protocol->transport, - (const gpointer) buf, len, error) == FALSE) - { - return -1; - } - xfer += len; - } - - return xfer; -} - -gint32 -thrift_binary_protocol_read_message_begin (ThriftProtocol *protocol, - gchar **name, - ThriftMessageType *message_type, - gint32 *seqid, GError **error) -{ - gint32 ret; - gint32 xfer = 0; - gint32 sz; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - 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; -} - -gint32 -thrift_binary_protocol_read_message_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_read_struct_begin (ThriftProtocol *protocol, - gchar **name, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - *name = NULL; - return 0; -} - -gint32 -thrift_binary_protocol_read_struct_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_read_field_begin (ThriftProtocol *protocol, - gchar **name, - ThriftType *field_type, - gint16 *field_id, - GError **error) -{ - gint32 ret; - gint32 xfer = 0; - gint8 type; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - THRIFT_UNUSED_VAR (name); - - if ((ret = thrift_protocol_read_byte (protocol, &type, error)) < 0) - { - return -1; - } - xfer += ret; - *field_type = (ThriftType) type; - if (*field_type == T_STOP) - { - *field_id = 0; - return xfer; - } - if ((ret = thrift_protocol_read_i16 (protocol, field_id, error)) < 0) - { - return -1; - } - xfer += ret; - return xfer; -} - -gint32 -thrift_binary_protocol_read_field_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_read_map_begin (ThriftProtocol *protocol, - ThriftType *key_type, - ThriftType *value_type, - guint32 *size, - GError **error) -{ - gint32 ret; - gint32 xfer = 0; - gint8 k, v; - gint32 sizei; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - 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_map_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_read_list_begin (ThriftProtocol *protocol, - ThriftType *element_type, - guint32 *size, GError **error) -{ - gint32 ret; - gint32 xfer = 0; - gint8 e; - gint32 sizei; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - 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) - { - 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_list_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_read_set_begin (ThriftProtocol *protocol, - ThriftType *element_type, - guint32 *size, GError **error) -{ - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - return thrift_protocol_read_list_begin (protocol, element_type, size, error); -} - -gint32 -thrift_binary_protocol_read_set_end (ThriftProtocol *protocol, - GError **error) -{ - THRIFT_UNUSED_VAR (protocol); - THRIFT_UNUSED_VAR (error); - return 0; -} - -gint32 -thrift_binary_protocol_read_bool (ThriftProtocol *protocol, gboolean *value, - GError **error) -{ - gint32 ret; - gpointer b[1]; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = - thrift_transport_read (protocol->transport, - b, 1, error)) < 0) - { - return -1; - } - *value = *(gint8 *) b != 0; - return ret; -} - -gint32 -thrift_binary_protocol_read_byte (ThriftProtocol *protocol, gint8 *value, - GError **error) -{ - gint32 ret; - gpointer b[1]; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = - thrift_transport_read (protocol->transport, - b, 1, error)) < 0) - { - return -1; - } - *value = *(gint8 *) b; - return ret; -} - -gint32 -thrift_binary_protocol_read_i16 (ThriftProtocol *protocol, gint16 *value, - GError **error) -{ - gint32 ret; - union - { - gint8 byte_array[2]; - gint16 int16; - } b; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = - thrift_transport_read (protocol->transport, - b.byte_array, 2, error)) < 0) - { - return -1; - } - *value = g_ntohs (b.int16); - return ret; -} - -gint32 -thrift_binary_protocol_read_i32 (ThriftProtocol *protocol, gint32 *value, - GError **error) -{ - gint32 ret; - union - { - gint8 byte_array[4]; - gint32 int32; - } b; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = - thrift_transport_read (protocol->transport, - b.byte_array, 4, error)) < 0) - { - return -1; - } - *value = g_ntohl (b.int32); - return ret; -} - -gint32 -thrift_binary_protocol_read_i64 (ThriftProtocol *protocol, gint64 *value, - GError **error) -{ - gint32 ret; - union - { - gint8 byte_array[8]; - gint64 int64; - } b; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = - thrift_transport_read (protocol->transport, - b.byte_array, 8, error)) < 0) - { - return -1; - } - *value = GUINT64_FROM_BE (b.int64); - return ret; -} - -gint32 -thrift_binary_protocol_read_double (ThriftProtocol *protocol, - gdouble *value, GError **error) -{ - gint32 ret; - union - { - gint8 byte_array[8]; - guint64 uint64; - } b; - - g_return_val_if_fail (THRIFT_IS_BINARY_PROTOCOL (protocol), -1); - - if ((ret = - thrift_transport_read (protocol->transport, - b.byte_array, 8, error)) < 0) - { - return -1; - } - *value = thrift_bitwise_cast_gdouble (GUINT64_FROM_BE (b.uint64)); - return ret; -} - -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) - { - /* 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; -} - -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 (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; -} - -static void -thrift_binary_protocol_init (ThriftBinaryProtocol *protocol) -{ - THRIFT_UNUSED_VAR (protocol); -} - -/* initialize the class */ -static void -thrift_binary_protocol_class_init (ThriftBinaryProtocolClass *klass) -{ - ThriftProtocolClass *cls = THRIFT_PROTOCOL_CLASS (klass); - - cls->write_message_begin = thrift_binary_protocol_write_message_begin; - cls->write_message_end = thrift_binary_protocol_write_message_end; - cls->write_struct_begin = thrift_binary_protocol_write_struct_begin; - cls->write_struct_end = thrift_binary_protocol_write_struct_end; - cls->write_field_begin = thrift_binary_protocol_write_field_begin; - cls->write_field_end = thrift_binary_protocol_write_field_end; - cls->write_field_stop = thrift_binary_protocol_write_field_stop; - cls->write_map_begin = thrift_binary_protocol_write_map_begin; - cls->write_map_end = thrift_binary_protocol_write_map_end; - cls->write_list_begin = thrift_binary_protocol_write_list_begin; - cls->write_list_end = thrift_binary_protocol_write_list_end; - cls->write_set_begin = thrift_binary_protocol_write_set_begin; - cls->write_set_end = thrift_binary_protocol_write_set_end; - cls->write_bool = thrift_binary_protocol_write_bool; - cls->write_byte = thrift_binary_protocol_write_byte; - cls->write_i16 = thrift_binary_protocol_write_i16; - cls->write_i32 = thrift_binary_protocol_write_i32; - cls->write_i64 = thrift_binary_protocol_write_i64; - cls->write_double = thrift_binary_protocol_write_double; - cls->write_string = thrift_binary_protocol_write_string; - cls->write_binary = thrift_binary_protocol_write_binary; - cls->read_message_begin = thrift_binary_protocol_read_message_begin; - cls->read_message_end = thrift_binary_protocol_read_message_end; - cls->read_struct_begin = thrift_binary_protocol_read_struct_begin; - cls->read_struct_end = thrift_binary_protocol_read_struct_end; - cls->read_field_begin = thrift_binary_protocol_read_field_begin; - cls->read_field_end = thrift_binary_protocol_read_field_end; - cls->read_map_begin = thrift_binary_protocol_read_map_begin; - cls->read_map_end = thrift_binary_protocol_read_map_end; - cls->read_list_begin = thrift_binary_protocol_read_list_begin; - cls->read_list_end = thrift_binary_protocol_read_list_end; - cls->read_set_begin = thrift_binary_protocol_read_set_begin; - cls->read_set_end = thrift_binary_protocol_read_set_end; - cls->read_bool = thrift_binary_protocol_read_bool; - cls->read_byte = thrift_binary_protocol_read_byte; - cls->read_i16 = thrift_binary_protocol_read_i16; - cls->read_i32 = thrift_binary_protocol_read_i32; - cls->read_i64 = thrift_binary_protocol_read_i64; - cls->read_double = thrift_binary_protocol_read_double; - cls->read_string = thrift_binary_protocol_read_string; - cls->read_binary = thrift_binary_protocol_read_binary; -} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.h ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.h deleted file mode 100644 index 5230bcc..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifndef _THRIFT_BINARY_PROTOCOL_H -#define _THRIFT_BINARY_PROTOCOL_H - -#include <glib-object.h> - -#include <thrift/c_glib/protocol/thrift_protocol.h> -#include <thrift/c_glib/transport/thrift_transport.h> - -G_BEGIN_DECLS - -/*! \file thrift_binary_protocol.h - * \brief Binary protocol implementation of a Thrift protocol. Implements the - * ThriftProtocol interface. - */ - -/* type macros */ -#define THRIFT_TYPE_BINARY_PROTOCOL (thrift_binary_protocol_get_type ()) -#define THRIFT_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocol)) -#define THRIFT_IS_BINARY_PROTOCOL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_BINARY_PROTOCOL)) -#define THRIFT_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocolClass)) -#define THRIFT_IS_BINARY_PROTOCOL_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_BINARY_PROTOCOL)) -#define THRIFT_BINARY_PROTOCOL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BINARY_PROTOCOL, ThriftBinaryProtocolClass)) - -/* version numbers */ -#define THRIFT_BINARY_PROTOCOL_VERSION_1 0x80010000 -#define THRIFT_BINARY_PROTOCOL_VERSION_MASK 0xffff0000 - -typedef struct _ThriftBinaryProtocol ThriftBinaryProtocol; - -/*! - * Thrift Binary Protocol instance. - */ -struct _ThriftBinaryProtocol -{ - ThriftProtocol parent; -}; - -typedef struct _ThriftBinaryProtocolClass ThriftBinaryProtocolClass; - -/*! - * Thrift Binary Protocol class. - */ -struct _ThriftBinaryProtocolClass -{ - ThriftProtocolClass parent; -}; - -/* used by THRIFT_TYPE_BINARY_PROTOCOL */ -GType thrift_binary_protocol_get_type (void); - -G_END_DECLS - -#endif /* _THRIFT_BINARY_PROTOCOL_H */ http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c deleted file mode 100644 index 774e9ad..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#include <thrift/c_glib/thrift.h> -#include <thrift/c_glib/protocol/thrift_binary_protocol.h> -#include <thrift/c_glib/protocol/thrift_binary_protocol_factory.h> - -G_DEFINE_TYPE(ThriftBinaryProtocolFactory, thrift_binary_protocol_factory, THRIFT_TYPE_PROTOCOL_FACTORY) - -ThriftProtocol * -thrift_binary_protocol_factory_get_protocol (ThriftProtocolFactory *factory, - ThriftTransport *transport) -{ - ThriftBinaryProtocol *tb = g_object_new (THRIFT_TYPE_BINARY_PROTOCOL, - "transport", transport, NULL); - - THRIFT_UNUSED_VAR (factory); - - return THRIFT_PROTOCOL (tb); -} - -static void -thrift_binary_protocol_factory_class_init (ThriftBinaryProtocolFactoryClass *cls) -{ - ThriftProtocolFactoryClass *protocol_factory_class = THRIFT_PROTOCOL_FACTORY_CLASS (cls); - - protocol_factory_class->get_protocol = thrift_binary_protocol_factory_get_protocol; -} - -static void -thrift_binary_protocol_factory_init (ThriftBinaryProtocolFactory *factory) -{ - THRIFT_UNUSED_VAR (factory); -} http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/928eade3/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.h ---------------------------------------------------------------------- diff --git a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.h b/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.h deleted file mode 100644 index eddc073..0000000 --- a/depends/thirdparty/thrift/lib/c_glib/src/thrift/c_glib/protocol/thrift_binary_protocol_factory.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ - -#ifndef _THRIFT_BINARY_PROTOCOL_FACTORY_H -#define _THRIFT_BINARY_PROTOCOL_FACTORY_H - -#include <glib-object.h> - -#include <thrift/c_glib/protocol/thrift_protocol_factory.h> - -G_BEGIN_DECLS - -/* type macros */ -#define THRIFT_TYPE_BINARY_PROTOCOL_FACTORY (thrift_binary_protocol_factory_get_type ()) -#define THRIFT_BINARY_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, ThriftBinaryProtocolFactory)) -#define THRIFT_IS_BINARY_PROTOCOL_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY)) -#define THRIFT_BINARY_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, ThriftBinaryProtocolFactoryClass)) -#define THRIFT_IS_BINARY_PROTOCOL_FACTORY_CLASS(c) (G_TYPE_CHECK_CLASS_TYPE ((c), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY)) -#define THRIFT_BINARY_PROTOCOL_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), THRIFT_TYPE_BINARY_PROTOCOL_FACTORY, ThriftBinaryProtocolFactoryClass)) - -typedef struct _ThriftBinaryProtocolFactory ThriftBinaryProtocolFactory; - -struct _ThriftBinaryProtocolFactory -{ - ThriftProtocolFactory parent; -}; - -typedef struct _ThriftBinaryProtocolFactoryClass ThriftBinaryProtocolFactoryClass; - -struct _ThriftBinaryProtocolFactoryClass -{ - ThriftProtocolFactoryClass parent; -}; - -/* used by THRIFT_TYPE_BINARY_PROTOCOL_FACTORY */ -GType thrift_binary_protocol_factory_get_type (void); - -G_END_DECLS - -#endif /* _THRIFT_BINARY_PROTOCOL_FACTORY_H */
