From: Roger Meier Date: Sat, 14 Apr 2012 11:03:21 +0000 (+0000) Subject: Merge branch 'trunk' of https://github.com/benoitdion/thrift into trunk X-Git-Tag: 0.9.1~400 X-Git-Url: https://source.supwisdom.com/gerrit/gitweb?a=commitdiff_plain;h=1516be04e0262762c63d3205a8a136dff269177a;p=common%2Fthrift.git Merge branch 'trunk' of https://github.com/benoitdion/thrift into trunk git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1326086 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/.gitignore b/.gitignore index b97e312d..6b0462ff 100644 --- a/.gitignore +++ b/.gitignore @@ -241,3 +241,13 @@ *.user *.ipch *.sdf + +*_ReSharper* +lib/cpp/Debug/ +lib/cpp/Release/ +*.opensdf +lib/cpp/x64/Debug/ +lib/cpp/x64/Release +compiler/cpp/src/thrifty.h +compiler/cpp/src/thrifty.cc +compiler/cpp/src/thriftl.cc \ No newline at end of file diff --git a/compiler/cpp/compiler.vcxproj b/compiler/cpp/compiler.vcxproj index 16ea2c06..04e108d4 100644 --- a/compiler/cpp/compiler.vcxproj +++ b/compiler/cpp/compiler.vcxproj @@ -19,66 +19,65 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - - + + {89975A1A-F799-4556-98B8-64E30AB39A90} @@ -126,25 +125,25 @@ true - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath) + $(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath) thrift $(ExecutablePath);C:\Program Files (x86)\Git\bin true - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath) + $(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath) thrift $(ExecutablePath);C:\Program Files (x86)\Git\bin false - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath) + $(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath) thrift $(ExecutablePath);C:\Program Files (x86)\Git\bin false - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(IncludePath) + $(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(IncludePath) thrift $(ExecutablePath);C:\Program Files (x86)\Git\bin @@ -163,8 +162,8 @@ true - flex -o "src\thrift\thriftl.cc" src/thriftl.ll -bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy + flex -o "src\\thriftl.cc" src/thriftl.ll +bison -y -o "src\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy @@ -182,8 +181,8 @@ bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yytrue - flex -o "src\thrift\thriftl.cc" src/thriftl.ll -bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy + flex -o "src\thriftl.cc" src/thriftl.ll +bison -y -o "src\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy @@ -205,8 +204,8 @@ bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yytrue - flex -o "src\thrift\thriftl.cc" src/thriftl.ll -bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy + flex -o "src\thriftl.cc" src/thriftl.ll +bison -y -o "src\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy @@ -228,8 +227,8 @@ bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yytrue - flex -o "src\thrift\thriftl.cc" src/thriftl.ll -bison -y -o "src\thrift\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy + flex -o "src\thriftl.cc" src/thriftl.ll +bison -y -o "src\thrifty.cc" --defines="src/thrifty.h" src/thrifty.yy diff --git a/compiler/cpp/compiler.vcxproj.filters b/compiler/cpp/compiler.vcxproj.filters index 16a690fa..0720b870 100644 --- a/compiler/cpp/compiler.vcxproj.filters +++ b/compiler/cpp/compiler.vcxproj.filters @@ -1,13 +1,18 @@  - - - windows + + generate - - windows + + generate + + + generate + + + parse @@ -62,32 +67,19 @@ parse - - generate - - - generate - - - generate - - - - - generated + + + windows + + + windows {ae9d0a15-57ae-4f01-87a4-81f790249b83} - - {c9be9380-57bb-438a-a647-4a6943326d6b} - - - {79697fe7-fdf0-4ed4-bb4f-3128632c3446} - {5df016bb-591b-420a-a535-4330d9187fbf} @@ -96,16 +88,9 @@ - - - parse - generate - - generate - generate @@ -115,22 +100,28 @@ generate + + generate + generate generate + + generate + generate generate - + generate - + generate @@ -145,6 +136,9 @@ generate + + generate + generate @@ -154,27 +148,16 @@ generate + - - generated - - - generated - - - generate - - - generate + + parse + + - - resources - - - resources - - + + \ No newline at end of file diff --git a/lib/cpp/libthrift.vcxproj b/lib/cpp/libthrift.vcxproj index 4a285739..bc5f0be2 100644 --- a/lib/cpp/libthrift.vcxproj +++ b/lib/cpp/libthrift.vcxproj @@ -19,192 +19,192 @@ - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - - + + + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + %(PreprocessorDefinitions) %(PreprocessorDefinitions) %(PreprocessorDefinitions) %(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - + + true true - - - + + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - + + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - + + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + true true true true - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - - - + + + NotUsing NotUsing NotUsing NotUsing - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - + + {DD26F57E-60F2-4F37-A616-D219A9BF338F} @@ -252,16 +252,16 @@ - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;..\..\..\..\boost;..\..\..\..\boost\boost;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath) - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath) - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;..\..\..\..\boost;..\..\..\..\boost\boost;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath) - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath) + $(ProjectDir)\src\$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath) @@ -269,7 +269,7 @@ Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) $(IntDir)libthrift.pdb @@ -283,7 +283,7 @@ Level3 Disabled WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) Windows @@ -298,7 +298,7 @@ true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) $(IntDir)libthrift.pdb @@ -316,7 +316,7 @@ true true WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) Windows @@ -328,4 +328,4 @@ - + \ No newline at end of file diff --git a/lib/cpp/libthrift.vcxproj.filters b/lib/cpp/libthrift.vcxproj.filters index 4025270c..3922988f 100644 --- a/lib/cpp/libthrift.vcxproj.filters +++ b/lib/cpp/libthrift.vcxproj.filters @@ -96,10 +96,10 @@ windows - + transport - + transport @@ -218,10 +218,10 @@ windows - + transport - + transport diff --git a/lib/cpp/libthriftnb.vcxproj b/lib/cpp/libthriftnb.vcxproj index 640397c0..7b9cc83b 100644 --- a/lib/cpp/libthriftnb.vcxproj +++ b/lib/cpp/libthriftnb.vcxproj @@ -19,41 +19,41 @@ - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) _CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - + - - - - - - - - + + + + + + + + {D8696CCE-7D46-4659-B432-91754A41DEB0} @@ -100,16 +100,16 @@ - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) - $(ProjectDir)\src\thrift\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) + $(ProjectDir)\src\;$(THIRD_PARTY)\boost\boost_1_47_0\include;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\WIN32-Code\;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\include;$(THIRD_PARTY)\libevent\libevent-2.0.13-stable\;$(IncludePath) @@ -118,7 +118,7 @@ Level3 Disabled WIN32;HAVE_CONFIG_H;_DEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) $(IntDir)libthriftnb.pdb @@ -133,7 +133,7 @@ Level3 Disabled WIN32;HAVE_CONFIG_H;_DEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) Windows @@ -149,7 +149,7 @@ true true WIN32;HAVE_CONFIG_H;NDEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) $(IntDir)libthriftnb.pdb @@ -168,7 +168,7 @@ true true WIN32;HAVE_CONFIG_H;NDEBUG;_LIB;%(PreprocessorDefinitions) - force_inc.h;%(ForcedIncludeFiles) + thrift\windows\force_inc.h;%(ForcedIncludeFiles) Windows diff --git a/lib/cpp/src/thrift/async/TAsyncChannel.cpp b/lib/cpp/src/thrift/async/TAsyncChannel.cpp index bfde660e..18dbb8c8 100644 --- a/lib/cpp/src/thrift/async/TAsyncChannel.cpp +++ b/lib/cpp/src/thrift/async/TAsyncChannel.cpp @@ -18,7 +18,7 @@ */ #include -#include +#include namespace apache { namespace thrift { namespace async { diff --git a/lib/cpp/src/thrift/async/TAsyncChannel.h b/lib/cpp/src/thrift/async/TAsyncChannel.h index 634b6a43..beec0031 100644 --- a/lib/cpp/src/thrift/async/TAsyncChannel.h +++ b/lib/cpp/src/thrift/async/TAsyncChannel.h @@ -20,7 +20,7 @@ #ifndef _THRIFT_ASYNC_TASYNCCHANNEL_H_ #define _THRIFT_ASYNC_TASYNCCHANNEL_H_ 1 -#include +#include #include namespace apache { namespace thrift { namespace transport { diff --git a/lib/cpp/src/thrift/concurrency/ThreadManager.h b/lib/cpp/src/thrift/concurrency/ThreadManager.h index 6d7b0ef5..08a0b1d7 100644 --- a/lib/cpp/src/thrift/concurrency/ThreadManager.h +++ b/lib/cpp/src/thrift/concurrency/ThreadManager.h @@ -21,7 +21,7 @@ #define _THRIFT_CONCURRENCY_THREADMANAGER_H_ 1 #include -#include +#include #include #include "Thread.h" diff --git a/lib/cpp/src/thrift/processor/PeekProcessor.h b/lib/cpp/src/thrift/processor/PeekProcessor.h index 60e1559c..9cfb35a6 100644 --- a/lib/cpp/src/thrift/processor/PeekProcessor.h +++ b/lib/cpp/src/thrift/processor/PeekProcessor.h @@ -21,7 +21,7 @@ #define PEEKPROCESSOR_H #include -#include +#include #include #include #include diff --git a/lib/cpp/src/thrift/protocol/TDenseProtocol.cpp b/lib/cpp/src/thrift/protocol/TDenseProtocol.cpp index 86e5e285..f60e7fff 100644 --- a/lib/cpp/src/thrift/protocol/TDenseProtocol.cpp +++ b/lib/cpp/src/thrift/protocol/TDenseProtocol.cpp @@ -90,7 +90,7 @@ absent and prefix them with an 0x01 byte if they are present #define __STDC_LIMIT_MACROS #include #include "TDenseProtocol.h" -#include "TReflectionLocal.h" +#include "thrift/TReflectionLocal.h" // Leaving this on for now. Disabling it will turn off asserts, which should // give a performance boost. When we have *really* thorough test cases, diff --git a/lib/cpp/src/thrift/transport/TPipe.cpp b/lib/cpp/src/thrift/transport/TPipe.cpp new file mode 100644 index 00000000..2c7cf56d --- /dev/null +++ b/lib/cpp/src/thrift/transport/TPipe.cpp @@ -0,0 +1,209 @@ +/* +* 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. +*/ + +#ifdef _WIN32 + +#include "TTransportException.h" +#include "TPipe.h" + +namespace apache { namespace thrift { namespace transport { + +using namespace std; + +/** +* TPipe implementation. +*/ + +//---- Constructors ---- +TPipe::TPipe(HANDLE hpipe) : + pipename_(""), + hPipe_(hpipe), + TimeoutSeconds_(3), + isAnonymous(false) +{} + +TPipe::TPipe(string pipename) : + pipename_(pipename), + hPipe_(INVALID_HANDLE_VALUE), + TimeoutSeconds_(3), + isAnonymous(false) +{} + +TPipe::TPipe(HANDLE hPipeRd, HANDLE hPipeWrt) : + pipename_(""), + hPipe_(hPipeRd), + hPipeWrt_(hPipeWrt), + TimeoutSeconds_(3), + isAnonymous(true) +{} + + TPipe::TPipe() : + pipename_(""), + hPipe_(INVALID_HANDLE_VALUE), + TimeoutSeconds_(3) +{} + +//---- Destructor ---- +TPipe::~TPipe() { + close(); +} + + +bool TPipe::isOpen() { + return (hPipe_ != INVALID_HANDLE_VALUE); +} + +//--------------------------------------------------------- +// Transport callbacks +//--------------------------------------------------------- + +bool TPipe::peek() { + if (!isOpen()) { + return false; + } + DWORD bytesavail = 0; + int PeekRet = 0; + PeekRet = PeekNamedPipe(hPipe_, NULL, 0, NULL, &bytesavail, NULL); + return (PeekRet != 0 && bytesavail > 0); +} + +void TPipe::open() { + if (isOpen()) { + return; + } + + int SleepInterval = 500; //ms + int retries = TimeoutSeconds_ * 1000 / SleepInterval; + for(int i=0; i { + public: + + // Constructs a new pipe object. + TPipe(); + // Named pipe constructors - + TPipe(HANDLE hPipe); + TPipe(std::string path); + // Anonymous pipe - + TPipe(HANDLE hPipeRd, HANDLE hPipeWrt); + + // Destroys the pipe object, closing it if necessary. + virtual ~TPipe(); + + // Returns whether the pipe is open & valid. + virtual bool isOpen(); + + // Checks whether more data is available in the pipe. + virtual bool peek(); + + // Creates and opens the named/anonymous pipe. + virtual void open(); + + // Shuts down communications on the pipe. + virtual void close(); + + // Reads from the pipe. + virtual uint32_t read(uint8_t* buf, uint32_t len); + + // Writes to the pipe. + virtual void write(const uint8_t* buf, uint32_t len); + + + //Accessors + std::string getPipename(); + void setPipename(std::string pipename); + HANDLE getPipeHandle(); //doubles as the read handle for anon pipe + void setPipeHandle(HANDLE pipehandle); + HANDLE getWrtPipeHandle(); + void setWrtPipeHandle(HANDLE pipehandle); + long getConnectTimeout(); + void setConnectTimeout(long seconds); + + private: + std::string pipename_; + //Named pipe handles are R/W, while anonymous pipes are one or the other (half duplex). + HANDLE hPipe_, hPipeWrt_; + long TimeoutSeconds_; + bool isAnonymous; + +}; + +}}} // apache::thrift::transport + +#endif //_WIN32 +#endif // #ifndef _THRIFT_TRANSPORT_TPIPE_H_ + diff --git a/lib/cpp/src/thrift/transport/TPipeServer.cpp b/lib/cpp/src/thrift/transport/TPipeServer.cpp new file mode 100644 index 00000000..6f2f73db --- /dev/null +++ b/lib/cpp/src/thrift/transport/TPipeServer.cpp @@ -0,0 +1,313 @@ +/* + * 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. + */ + +#ifdef _WIN32 + +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +#include "TPipe.h" +#include "TPipeServer.h" +#include +#include +#include + +namespace apache { namespace thrift { namespace transport { + +using namespace std; +using boost::shared_ptr; + +//---- Constructors ---- +TPipeServer::TPipeServer(string pipename, uint32_t bufsize) : + pipename_(pipename), + bufsize_(bufsize), + hPipe_(INVALID_HANDLE_VALUE), + isAnonymous(false), + maxconns_(TPIPE_SERVER_MAX_CONNS_DEFAULT) + {} + +TPipeServer::TPipeServer(string pipename, uint32_t bufsize, uint32_t maxconnections) : + pipename_(pipename), + bufsize_(bufsize), + hPipe_(INVALID_HANDLE_VALUE), + isAnonymous(false) + { //Restrict maxconns_ to 1-255 + if(maxconnections == 0) + maxconns_ = 1; + else if (maxconnections > 255) + maxconns_ = 255; + else + maxconns_ = maxconnections; + } + +TPipeServer::TPipeServer(string pipename) : + pipename_(pipename), + bufsize_(1024), + hPipe_(INVALID_HANDLE_VALUE), + isAnonymous(false), + maxconns_(TPIPE_SERVER_MAX_CONNS_DEFAULT) + {} + +TPipeServer::TPipeServer(int bufsize) : + pipename_(""), + bufsize_(bufsize), + hPipe_(INVALID_HANDLE_VALUE), + isAnonymous(true), + maxconns_(1) + { + //The anonymous pipe needs to be created first so that the server can + //pass the handles on to the client before the serve (acceptImpl) + //blocking call. + if (!TCreateAnonPipe()) { + GlobalOutput.perror("TPipeServer Create(Anon)Pipe failed, GLE=", GetLastError()); + throw TTransportException(TTransportException::NOT_OPEN, " TPipeServer Create(Anon)Pipe failed"); + } +} + +TPipeServer::TPipeServer() : + pipename_(""), + bufsize_(1024), + hPipe_(INVALID_HANDLE_VALUE), + isAnonymous(true), + maxconns_(1) +{ + if (!TCreateAnonPipe()) { + GlobalOutput.perror("TPipeServer Create(Anon)Pipe failed, GLE=", GetLastError()); + throw TTransportException(TTransportException::NOT_OPEN, " TPipeServer Create(Anon)Pipe failed"); + } +} + +//---- Destructor ---- +TPipeServer::~TPipeServer() { + close(); +} + +//--------------------------------------------------------- +// Transport callbacks +//--------------------------------------------------------- + +shared_ptr TPipeServer::acceptImpl() { + shared_ptr client; + + if(isAnonymous) + { //Anonymous Pipe + //This 0-byte read serves merely as a blocking call. + byte buf; + DWORD br; + int fSuccess = ReadFile( + hPipe_, // pipe handle + &buf, // buffer to receive reply + 0, // size of buffer + &br, // number of bytes read + NULL); // not overlapped + + if ( !fSuccess && GetLastError() != ERROR_MORE_DATA ) { + GlobalOutput.perror("TPipeServer unable to initiate pipe comms, GLE=", GetLastError()); + throw TTransportException(TTransportException::NOT_OPEN, " TPipeServer unable to initiate pipe comms"); + } + client.reset(new TPipe(hPipe_, hPipeW_)); + } + else + { //Named Pipe + int ConnectRet; + while (true) + { + if (!TCreateNamedPipe()) { + GlobalOutput.perror("TPipeServer CreateNamedPipe failed, GLE=", GetLastError()); + throw TTransportException(TTransportException::NOT_OPEN, " TPipeServer CreateNamedPipe failed"); + } + + // Wait for the client to connect; if it succeeds, the + // function returns a nonzero value. If the function returns + // zero, GetLastError should return ERROR_PIPE_CONNECTED. + ConnectRet = ConnectNamedPipe(hPipe_, NULL) ? + TRUE : (GetLastError() == ERROR_PIPE_CONNECTED); + + if (ConnectRet == TRUE) + { + GlobalOutput.printf("Client connected."); + break; + } + else + { + close(); + GlobalOutput.perror("TPipeServer ConnectNamedPipe GLE=", GetLastError()); + throw TTransportException(TTransportException::NOT_OPEN, "TPipeServer: client connection failed"); + } + } + client.reset(new TPipe(hPipe_)); + } + + return client; +} + +void TPipeServer::interrupt() { + if(hPipe_ != INVALID_HANDLE_VALUE) { + CancelIo(hPipe_); + } +} + +void TPipeServer::close() { + if(!isAnonymous) + { + if(hPipe_ != INVALID_HANDLE_VALUE) { + DisconnectNamedPipe(hPipe_); + CloseHandle(hPipe_); + hPipe_ = INVALID_HANDLE_VALUE; + } + } + else + { + try { + CloseHandle(hPipe_); + CloseHandle(hPipeW_); + CloseHandle(ClientAnonRead); + CloseHandle(ClientAnonWrite); + } + catch(...) { + GlobalOutput.perror("TPipeServer anon close GLE=", GetLastError()); + } + } +} + + +bool TPipeServer::TCreateNamedPipe() { + + //Windows - set security to allow non-elevated apps + //to access pipes created by elevated apps. + SID_IDENTIFIER_AUTHORITY SIDAuthWorld = SECURITY_WORLD_SID_AUTHORITY; + PSID everyone_sid = NULL; + AllocateAndInitializeSid(&SIDAuthWorld, 1, SECURITY_WORLD_RID, 0, 0, 0, 0, 0, 0, 0, &everyone_sid); + + EXPLICIT_ACCESS ea; + ZeroMemory(&ea, sizeof(EXPLICIT_ACCESS)); + ea.grfAccessPermissions = SPECIFIC_RIGHTS_ALL | STANDARD_RIGHTS_ALL; + ea.grfAccessMode = SET_ACCESS; + ea.grfInheritance = NO_INHERITANCE; + ea.Trustee.TrusteeForm = TRUSTEE_IS_SID; + ea.Trustee.TrusteeType = TRUSTEE_IS_WELL_KNOWN_GROUP; + ea.Trustee.ptstrName = (LPSTR)everyone_sid; + + PACL acl = NULL; + SetEntriesInAcl(1, &ea, NULL, &acl); + + PSECURITY_DESCRIPTOR sd = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR,SECURITY_DESCRIPTOR_MIN_LENGTH); + InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION); + SetSecurityDescriptorDacl(sd, TRUE, acl, FALSE); + + SECURITY_ATTRIBUTES sa; + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.lpSecurityDescriptor = sd; + sa.bInheritHandle = FALSE; + + // Create an instance of the named pipe + hPipe_ = CreateNamedPipe( + pipename_.c_str(), // pipe name + PIPE_ACCESS_DUPLEX, // read/write access + PIPE_TYPE_MESSAGE | // message type pipe + PIPE_READMODE_MESSAGE, // message-read mode + maxconns_, // max. instances + bufsize_, // output buffer size + bufsize_, // input buffer size + 0, // client time-out + &sa); // default security attribute + + return (hPipe_ != INVALID_HANDLE_VALUE); +} + +bool TPipeServer::TCreateAnonPipe() { + SECURITY_ATTRIBUTES sa; + SECURITY_DESCRIPTOR sd; //security information for pipes + + InitializeSecurityDescriptor(&sd,SECURITY_DESCRIPTOR_REVISION); + SetSecurityDescriptorDacl(&sd, true, NULL, false); + sa.lpSecurityDescriptor = &sd; + sa.lpSecurityDescriptor = NULL; + sa.nLength = sizeof(SECURITY_ATTRIBUTES); + sa.bInheritHandle = true; //allow passing handle to child + + if (!CreatePipe(&ClientAnonRead,&hPipeW_,&sa,0)) //create stdin pipe + { + GlobalOutput.perror("TPipeServer CreatePipe (anon) failed, GLE=", GetLastError()); + return false; + } + if (!CreatePipe(&hPipe_,&ClientAnonWrite,&sa,0)) //create stdout pipe + { + GlobalOutput.perror("TPipeServer CreatePipe (anon) failed, GLE=", GetLastError()); + CloseHandle(ClientAnonRead); + CloseHandle(hPipeW_); + return false; + } + + return true; +} + + +//--------------------------------------------------------- +// Accessors +//--------------------------------------------------------- + +string TPipeServer::getPipename() { + return pipename_; +} + +void TPipeServer::setPipename(std::string pipename) { + pipename_ = pipename; +} + +int TPipeServer::getBufferSize() { + return bufsize_; +} + +void TPipeServer::setBufferSize(int bufsize) { + bufsize_ = bufsize; +} + +HANDLE TPipeServer::getPipeHandle() { + return hPipe_; +} + +HANDLE TPipeServer::getWrtPipeHandle() +{ + return hPipeW_; +} + +HANDLE TPipeServer::getClientRdPipeHandle() +{ + return ClientAnonRead; +} + +HANDLE TPipeServer::getClientWrtPipeHandle() +{ + return ClientAnonWrite; +} + +bool TPipeServer::getAnonymous() { + return isAnonymous; +} + +void TPipeServer::setAnonymous(bool anon) { + isAnonymous = anon; +} + +}}} // apache::thrift::transport + +#endif //_WIN32 diff --git a/lib/cpp/src/thrift/transport/TPipeServer.h b/lib/cpp/src/thrift/transport/TPipeServer.h new file mode 100644 index 00000000..1732546a --- /dev/null +++ b/lib/cpp/src/thrift/transport/TPipeServer.h @@ -0,0 +1,85 @@ +/* + * 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_TRANSPORT_TSERVERWINPIPES_H_ +#define _THRIFT_TRANSPORT_TSERVERWINPIPES_H_ 1 +#ifdef _WIN32 + +#include "TServerTransport.h" +#include + +#define TPIPE_SERVER_MAX_CONNS_DEFAULT 10 + +namespace apache { namespace thrift { namespace transport { + +/** + * Windows Pipes implementation of TServerTransport. + */ +class TPipeServer : public TServerTransport { + public: + //Constructors + // Named Pipe - + TPipeServer(std::string pipename, uint32_t bufsize); + TPipeServer(std::string pipename, uint32_t bufsize, uint32_t maxconnections); + TPipeServer(std::string pipename); + // Anonymous pipe - + TPipeServer(int bufsize); + TPipeServer(); + + //Destructor + ~TPipeServer(); + + //Standard transport callbacks + //void listen(); //Unnecessary for Windows pipes + void interrupt(); + void close(); + protected: + boost::shared_ptr acceptImpl(); + + bool TCreateNamedPipe(); + bool TCreateAnonPipe(); + + public: + //Accessors + std::string getPipename(); + void setPipename(std::string pipename); + int getBufferSize(); + void setBufferSize(int bufsize); + HANDLE getPipeHandle(); //Named Pipe R/W -or- Anonymous pipe Read handle + HANDLE getWrtPipeHandle(); + HANDLE getClientRdPipeHandle(); + HANDLE getClientWrtPipeHandle(); + bool getAnonymous(); + void setAnonymous(bool anon); + + private: + std::string pipename_; + uint32_t bufsize_; + uint32_t maxconns_; + HANDLE hPipe_; //Named Pipe (R/W) or Anonymous Pipe (R) + HANDLE hPipeW_; //Anonymous Pipe (W) + HANDLE ClientAnonRead, ClientAnonWrite; //Client side anonymous pipe handles + //? Do we need duplicates to send to client? + bool isAnonymous; +}; + +}}} // apache::thrift::transport + +#endif //_WIN32 +#endif // #ifndef _THRIFT_TRANSPORT_TSERVERWINPIPES_H_ diff --git a/lib/cpp/src/thrift/transport/TTransportException.cpp b/lib/cpp/src/thrift/transport/TTransportException.cpp index e24198ae..f474e7db 100644 --- a/lib/cpp/src/thrift/transport/TTransportException.cpp +++ b/lib/cpp/src/thrift/transport/TTransportException.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include using std::string; using boost::lexical_cast; diff --git a/lib/cpp/src/thrift/windows/force_inc.h b/lib/cpp/src/thrift/windows/force_inc.h index f9af3122..beca4066 100644 --- a/lib/cpp/src/thrift/windows/force_inc.h +++ b/lib/cpp/src/thrift/windows/force_inc.h @@ -42,7 +42,7 @@ # define _WIN32_WINNT 0x0601 #endif -#include +#include "config.h" #undef gai_strerror #define gai_strerror gai_strerrorA