mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-1031 Patch to compile Thrift for vc++ 9.0 and 10.0
Patch: James Dickson and Alexandre Parenteau git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1171777 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
508b317269
commit
84e4a3c181
42
compiler/cpp/src/windows/config.h
Normal file
42
compiler/cpp/src/windows/config.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 cogoright 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 cogo 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_WINDOWS_CONFIG_H_
|
||||
#define _THRIFT_WINDOWS_CONFIG_H_ 1
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error "This is a Windows header only"
|
||||
#endif
|
||||
|
||||
#include <io.h>
|
||||
#include <stdlib.h>
|
||||
#include <direct.h>
|
||||
|
||||
#define strtoll(begin_ptr, end_ptr, length) strtol(begin_ptr, end_ptr, length)
|
||||
|
||||
#define PRIu64 "I64d"
|
||||
#define PRIi64 "I64d"
|
||||
|
||||
#pragma warning(disable:4996)
|
||||
|
||||
#endif // _THRIFT_WINDOWS_CONFIG_H_
|
42
compiler/cpp/src/windows/version.h
Normal file
42
compiler/cpp/src/windows/version.h
Normal file
@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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 cogoright 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 cogo 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_WINDOWS_VERSION_H_
|
||||
#define _THRIFT_WINDOWS_VERSION_H_ 1
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error "This is a Windows header only"
|
||||
#endif
|
||||
|
||||
#define PATH_MAX MAX_PATH
|
||||
#define THRIFT_VERSION "0.8.0-dev"
|
||||
|
||||
#ifndef S_ISDIR
|
||||
#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifndef S_ISREG
|
||||
#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG)
|
||||
#endif
|
||||
|
||||
#endif // _THRIFT_WINDOWS_VERSION_H_
|
90
lib/cpp/README_WINDOWS
Normal file
90
lib/cpp/README_WINDOWS
Normal file
@ -0,0 +1,90 @@
|
||||
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++
|
||||
=====================
|
||||
|
||||
You need to define an enviroment variable called THIRD_PARTY. The project
|
||||
assumes that you have extracted the dependancies into their default structure
|
||||
into the path defined by THIRD_PARTY.
|
||||
|
||||
e.g. $(THIRD_PARTY)/boost/boost_1_47_0/
|
||||
|
||||
Thrift is divided into two libraries.
|
||||
|
||||
libthrift
|
||||
The core Thrift library contains all the core Thrift code. It requires
|
||||
boost shared pointers and pthreads_win32.
|
||||
|
||||
libthriftnb
|
||||
This library contains the Thrift nonblocking server, which uses libevent.
|
||||
To link this library you will also need to link libevent.
|
||||
|
||||
You MUST apply this patch to make generated code compile.
|
||||
https://issues.apache.org/jira/browse/THRIFT-1139
|
||||
|
||||
Linking Against Thrift
|
||||
======================
|
||||
|
||||
You need to link your project that uses thrift against all the thrift
|
||||
dependancies; in the case of libthrift, pthreads_win32, boost and for
|
||||
libthriftnb, libevent.
|
||||
|
||||
In the project properties you must also set HAVE_CONFIG_H as force include
|
||||
the config header: "windows/confg.h"
|
||||
|
||||
Dependencies
|
||||
============
|
||||
|
||||
boost shared pointers
|
||||
http://www.boost.org/libs/smart_ptr/smart_ptr.htm
|
||||
|
||||
libevent (for libthriftnb only)
|
||||
http://monkey.org/~provos/libevent/
|
||||
|
||||
pthreads win32
|
||||
http://sources.redhat.com/pthreads-win32/
|
||||
|
||||
Known issues
|
||||
============
|
||||
|
||||
- Endianess has not been fully tested, may not work with doubles.
|
||||
- Currently does not support the non-blocking connect path.
|
||||
- Only supports the creation of clients, server sockets are not yet ported.
|
||||
- Does not support named pipes. (Supported in unix through unix domain sockets).
|
||||
|
||||
TODO
|
||||
====
|
||||
|
||||
- Port remaining classes in libthrift:
|
||||
- TFDTransport
|
||||
- TFileTransport
|
||||
- THttpClient
|
||||
- THttpServer
|
||||
- TSimpleFileTransport
|
||||
- TSSLSocket
|
||||
|
||||
- Port test cases. (Not even started this. Run test cases in release mode?)
|
||||
|
||||
- Autolink libraries depending on debug\release build.
|
||||
|
||||
- Auto versioning.
|
246
lib/cpp/libthrift.vcxproj
Normal file
246
lib/cpp/libthrift.vcxproj
Normal file
@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\async\TAsyncChannel.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\Monitor.cpp">
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">config.h</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">config.h</ForcedIncludeFiles>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\Mutex.cpp" />
|
||||
<ClCompile Include="src\concurrency\PosixThreadFactory.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\ThreadManager.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\TimerManager.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\Util.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">HAVE_GETTIMEOFDAY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">HAVE_GETTIMEOFDAY;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\processor\PeekProcessor.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TBase64Utils.cpp" />
|
||||
<ClCompile Include="src\protocol\TDebugProtocol.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TDenseProtocol.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TJSONProtocol.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\server\TSimpleServer.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\server\TThreadPoolServer.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\TApplicationException.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Thrift.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TBufferTransports.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TFDTransport.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TFileTransport.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\THttpClient.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\THttpServer.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\THttpTransport.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TServerSocket.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">force_inc.h</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">force_inc.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TSimpleFileTransport.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TSocket.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">force_inc.h</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">force_inc.h</ForcedIncludeFiles>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TSSLSocket.cpp">
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TTransportException.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TTransportUtils.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\Fcntl.cpp" />
|
||||
<ClCompile Include="src\windows\GetTimeOfDay.cpp" />
|
||||
<ClCompile Include="src\windows\SocketPair.cpp" />
|
||||
<ClCompile Include="src\windows\StdAfx.cpp">
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\TWinsockSingleton.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\async\TAsyncChannel.h" />
|
||||
<ClInclude Include="src\concurrency\Exception.h" />
|
||||
<ClInclude Include="src\concurrency\Monitor.h" />
|
||||
<ClInclude Include="src\concurrency\Mutex.h" />
|
||||
<ClInclude Include="src\processor\PeekProcessor.h" />
|
||||
<ClInclude Include="src\protocol\TBinaryProtocol.h" />
|
||||
<ClInclude Include="src\protocol\TDebugProtocol.h" />
|
||||
<ClInclude Include="src\protocol\TDenseProtocol.h" />
|
||||
<ClInclude Include="src\protocol\TJSONProtocol.h" />
|
||||
<ClInclude Include="src\protocol\TProtocol.h" />
|
||||
<ClInclude Include="src\protocol\TVirtualProtocol.h" />
|
||||
<ClInclude Include="src\server\TServer.h" />
|
||||
<ClInclude Include="src\server\TSimpleServer.h" />
|
||||
<ClInclude Include="src\server\TThreadPoolServer.h" />
|
||||
<ClInclude Include="src\TApplicationException.h" />
|
||||
<ClInclude Include="src\Thrift.h" />
|
||||
<ClInclude Include="src\TProcessor.h" />
|
||||
<ClInclude Include="src\transport\TBufferTransports.h" />
|
||||
<ClInclude Include="src\transport\TFDTransport.h" />
|
||||
<ClInclude Include="src\transport\TFileTransport.h" />
|
||||
<ClInclude Include="src\transport\THttpClient.h" />
|
||||
<ClInclude Include="src\transport\THttpServer.h" />
|
||||
<ClInclude Include="src\transport\TServerSocket.h" />
|
||||
<ClInclude Include="src\transport\TServerTransport.h" />
|
||||
<ClInclude Include="src\transport\TSimpleFileTransport.h" />
|
||||
<ClInclude Include="src\transport\TSocket.h" />
|
||||
<ClInclude Include="src\transport\TSSLSocket.h" />
|
||||
<ClInclude Include="src\transport\TTransport.h" />
|
||||
<ClInclude Include="src\transport\TTransportException.h" />
|
||||
<ClInclude Include="src\transport\TTransportUtils.h" />
|
||||
<ClInclude Include="src\transport\TVirtualTransport.h" />
|
||||
<ClInclude Include="src\windows\config.h" />
|
||||
<ClInclude Include="src\windows\Fcntl.h" />
|
||||
<ClInclude Include="src\windows\force_inc.h" />
|
||||
<ClInclude Include="src\windows\GetTimeOfDay.h" />
|
||||
<ClInclude Include="src\windows\Operators.h" />
|
||||
<ClInclude Include="src\windows\SocketPair.h" />
|
||||
<ClInclude Include="src\windows\StdAfx.h" />
|
||||
<ClInclude Include="src\windows\TargetVersion.h" />
|
||||
<ClInclude Include="src\windows\TWinsockSingleton.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="src\protocol\TBinaryProtocol.tcc" />
|
||||
<None Include="src\windows\tr1\functional" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{DD26F57E-60F2-4F37-A616-D219A9BF338F}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>thrift</RootNamespace>
|
||||
<ProjectName>libthrift</ProjectName>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(ProjectDir)\src\transport\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(THIRD_PARTY)\openssl\OpenSSL-Win32\include\;$(IncludePath)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NOMINMAX;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NOMINMAX;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
250
lib/cpp/libthrift.vcxproj.filters
Normal file
250
lib/cpp/libthrift.vcxproj.filters
Normal file
@ -0,0 +1,250 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\transport\TBufferTransports.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\Thrift.cpp" />
|
||||
<ClCompile Include="src\TApplicationException.cpp" />
|
||||
<ClCompile Include="src\windows\StdAfx.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\Monitor.cpp">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\Mutex.cpp">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TTransportException.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\GetTimeOfDay.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\PosixThreadFactory.cpp">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\ThreadManager.cpp">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\TimerManager.cpp">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\concurrency\Util.cpp">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TDebugProtocol.cpp">
|
||||
<Filter>protocal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TDenseProtocol.cpp">
|
||||
<Filter>protocal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TBase64Utils.cpp">
|
||||
<Filter>protocal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\protocol\TJSONProtocol.cpp">
|
||||
<Filter>protocal</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TFDTransport.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TFileTransport.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TSimpleFileTransport.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\THttpTransport.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\THttpClient.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\THttpServer.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TSSLSocket.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TTransportUtils.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\server\TSimpleServer.cpp">
|
||||
<Filter>server</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\server\TThreadPoolServer.cpp">
|
||||
<Filter>server</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\async\TAsyncChannel.cpp">
|
||||
<Filter>async</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\processor\PeekProcessor.cpp">
|
||||
<Filter>processor</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TServerSocket.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\transport\TSocket.cpp">
|
||||
<Filter>transport</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\Fcntl.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\TWinsockSingleton.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\SocketPair.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\transport\TBufferTransports.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TSocket.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\protocol\TBinaryProtocol.h">
|
||||
<Filter>protocal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\Thrift.h" />
|
||||
<ClInclude Include="src\TProcessor.h" />
|
||||
<ClInclude Include="src\TApplicationException.h" />
|
||||
<ClInclude Include="src\windows\StdAfx.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\TargetVersion.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\concurrency\Monitor.h">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\concurrency\Mutex.h">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\concurrency\Exception.h">
|
||||
<Filter>concurrency</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TVirtualTransport.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TTransport.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TTransportException.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\GetTimeOfDay.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TServerTransport.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\config.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\protocol\TProtocol.h">
|
||||
<Filter>protocal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\protocol\TVirtualProtocol.h">
|
||||
<Filter>protocal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\server\TServer.h">
|
||||
<Filter>server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\server\TSimpleServer.h">
|
||||
<Filter>server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\server\TThreadPoolServer.h">
|
||||
<Filter>server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\async\TAsyncChannel.h">
|
||||
<Filter>async</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\processor\PeekProcessor.h">
|
||||
<Filter>processor</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TFDTransport.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TFileTransport.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\THttpClient.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\THttpServer.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TSSLSocket.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TTransportUtils.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TSimpleFileTransport.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\protocol\TJSONProtocol.h">
|
||||
<Filter>protocal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\protocol\TDenseProtocol.h">
|
||||
<Filter>protocal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\protocol\TDebugProtocol.h">
|
||||
<Filter>protocal</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\transport\TServerSocket.h">
|
||||
<Filter>transport</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\Operators.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\Fcntl.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\TWinsockSingleton.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\SocketPair.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\force_inc.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="protocal">
|
||||
<UniqueIdentifier>{07ced19b-b72a-4105-9ffb-6d2bcf64497e}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="transport">
|
||||
<UniqueIdentifier>{e9f61404-1148-4103-bd6f-e5869d37fa79}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="windows">
|
||||
<UniqueIdentifier>{2814002a-3c68-427e-b0eb-33acd2f406ae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="concurrency">
|
||||
<UniqueIdentifier>{addd4707-dbaa-4d0c-bef6-fff8be7b495a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="server">
|
||||
<UniqueIdentifier>{f55a8e9b-6959-487f-a396-c31b4d6c61d6}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="async">
|
||||
<UniqueIdentifier>{d526885b-1b3e-4ee3-8027-e694fe98ad63}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="processor">
|
||||
<UniqueIdentifier>{8f428da8-5a83-44fb-9578-de935fb415e1}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="windows\tr1">
|
||||
<UniqueIdentifier>{eea10406-3380-4f2d-9365-c26fa2875dae}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="src\protocol\TBinaryProtocol.tcc">
|
||||
<Filter>protocal</Filter>
|
||||
</None>
|
||||
<None Include="src\windows\tr1\functional">
|
||||
<Filter>windows\tr1</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
109
lib/cpp/libthriftnb.vcxproj
Normal file
109
lib/cpp/libthriftnb.vcxproj
Normal file
@ -0,0 +1,109 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\async\TAsyncProtocolProcessor.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\async\TEvhttpClientChannel.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\async\TEvhttpServer.cpp">
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\server\TNonblockingServer.cpp">
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">config.h</ForcedIncludeFiles>
|
||||
<ForcedIncludeFiles Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">config.h</ForcedIncludeFiles>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\StdAfx.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\async\TAsyncProtocolProcessor.h" />
|
||||
<ClInclude Include="src\async\TEvhttpClientChannel.h" />
|
||||
<ClInclude Include="src\async\TEvhttpServer.h" />
|
||||
<ClInclude Include="src\server\TNonblockingServer.h" />
|
||||
<ClInclude Include="src\windows\config.h" />
|
||||
<ClInclude Include="src\windows\StdAfx.h" />
|
||||
<ClInclude Include="src\windows\TargetVersion.h" />
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{D8696CCE-7D46-4659-B432-91754A41DEB0}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<RootNamespace>libthriftnb</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(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)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<IncludePath>$(ProjectDir)\src\;$(ProjectDir)\src\windows\;$(THIRD_PARTY)\boost\boost_1_47_0\;$(THIRD_PARTY)\pthreads\;$(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)</IncludePath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<PreprocessorDefinitions>WIN32;HAVE_CONFIG_H;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
54
lib/cpp/libthriftnb.vcxproj.filters
Normal file
54
lib/cpp/libthriftnb.vcxproj.filters
Normal file
@ -0,0 +1,54 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="server">
|
||||
<UniqueIdentifier>{bf449d92-4be8-4f6f-a010-c536f57c6f13}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="async">
|
||||
<UniqueIdentifier>{0294d0a6-ce46-4be8-a659-826d6e98ae41}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="windows">
|
||||
<UniqueIdentifier>{60fc9e5e-0866-4aba-8662-439bb4a461d3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="src\server\TNonblockingServer.cpp">
|
||||
<Filter>server</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\async\TEvhttpClientChannel.cpp">
|
||||
<Filter>async</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\async\TEvhttpServer.cpp">
|
||||
<Filter>async</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\async\TAsyncProtocolProcessor.cpp">
|
||||
<Filter>async</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="src\windows\StdAfx.cpp">
|
||||
<Filter>windows</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="src\server\TNonblockingServer.h">
|
||||
<Filter>server</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\async\TEvhttpClientChannel.h">
|
||||
<Filter>async</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\async\TEvhttpServer.h">
|
||||
<Filter>async</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\async\TAsyncProtocolProcessor.h">
|
||||
<Filter>async</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\config.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\StdAfx.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="src\windows\TargetVersion.h">
|
||||
<Filter>windows</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -68,7 +68,11 @@ class PthreadThread: public Thread {
|
||||
public:
|
||||
|
||||
PthreadThread(int policy, int priority, int stackSize, bool detached, shared_ptr<Runnable> runnable) :
|
||||
|
||||
#ifndef _WIN32
|
||||
pthread_(0),
|
||||
#endif // _WIN32
|
||||
|
||||
state_(uninitialized),
|
||||
policy_(policy),
|
||||
priority_(priority),
|
||||
@ -152,7 +156,12 @@ class PthreadThread: public Thread {
|
||||
}
|
||||
|
||||
Thread::id_t getId() {
|
||||
|
||||
#ifndef _WIN32
|
||||
return (Thread::id_t)pthread_;
|
||||
#else
|
||||
return (Thread::id_t)pthread_.p;
|
||||
#endif // _WIN32
|
||||
}
|
||||
|
||||
shared_ptr<Runnable> runnable() const { return Thread::runnable(); }
|
||||
@ -286,7 +295,13 @@ class PosixThreadFactory::Impl {
|
||||
void setDetached(bool value) { detached_ = value; }
|
||||
|
||||
Thread::id_t getCurrentThreadId() const {
|
||||
|
||||
#ifndef _WIN32
|
||||
return (Thread::id_t)pthread_self();
|
||||
#else
|
||||
return (Thread::id_t)pthread_self().p;
|
||||
#endif // _WIN32
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -60,7 +60,11 @@ using apache::thrift::concurrency::ThreadManager;
|
||||
#endif
|
||||
|
||||
#ifndef SOCKOPT_CAST_T
|
||||
#define SOCKOPT_CAST_T void
|
||||
# ifndef _WIN32
|
||||
# define SOCKOPT_CAST_T void
|
||||
# else
|
||||
# define SOCKOPT_CAST_T char
|
||||
# endif // _WIN32
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
|
@ -52,6 +52,24 @@
|
||||
#define AF_LOCAL AF_UNIX
|
||||
#endif
|
||||
|
||||
#ifndef SOCKOPT_CAST_T
|
||||
# ifndef _WIN32
|
||||
# define SOCKOPT_CAST_T void
|
||||
# else
|
||||
# define SOCKOPT_CAST_T char
|
||||
# endif // _WIN32
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline const SOCKOPT_CAST_T* const_cast_sockopt(const T* v) {
|
||||
return reinterpret_cast<const SOCKOPT_CAST_T*>(v);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline SOCKOPT_CAST_T* cast_sockopt(T* v) {
|
||||
return reinterpret_cast<SOCKOPT_CAST_T*>(v);
|
||||
}
|
||||
|
||||
namespace apache { namespace thrift { namespace transport {
|
||||
|
||||
using namespace std;
|
||||
@ -182,7 +200,7 @@ void TServerSocket::listen() {
|
||||
// Set reusaddress to prevent 2MSL delay on accept
|
||||
int one = 1;
|
||||
if (-1 == setsockopt(serverSocket_, SOL_SOCKET, SO_REUSEADDR,
|
||||
&one, sizeof(one))) {
|
||||
cast_sockopt(&one), sizeof(one))) {
|
||||
int errno_copy = errno;
|
||||
GlobalOutput.perror("TServerSocket::listen() setsockopt() SO_REUSEADDR ", errno_copy);
|
||||
close();
|
||||
@ -192,7 +210,7 @@ void TServerSocket::listen() {
|
||||
// Set TCP buffer sizes
|
||||
if (tcpSendBuffer_ > 0) {
|
||||
if (-1 == setsockopt(serverSocket_, SOL_SOCKET, SO_SNDBUF,
|
||||
&tcpSendBuffer_, sizeof(tcpSendBuffer_))) {
|
||||
cast_sockopt(&tcpSendBuffer_), sizeof(tcpSendBuffer_))) {
|
||||
int errno_copy = errno;
|
||||
GlobalOutput.perror("TServerSocket::listen() setsockopt() SO_SNDBUF ", errno_copy);
|
||||
close();
|
||||
@ -202,7 +220,7 @@ void TServerSocket::listen() {
|
||||
|
||||
if (tcpRecvBuffer_ > 0) {
|
||||
if (-1 == setsockopt(serverSocket_, SOL_SOCKET, SO_RCVBUF,
|
||||
&tcpRecvBuffer_, sizeof(tcpRecvBuffer_))) {
|
||||
cast_sockopt(&tcpRecvBuffer_), sizeof(tcpRecvBuffer_))) {
|
||||
int errno_copy = errno;
|
||||
GlobalOutput.perror("TServerSocket::listen() setsockopt() SO_RCVBUF ", errno_copy);
|
||||
close();
|
||||
@ -225,7 +243,7 @@ void TServerSocket::listen() {
|
||||
if (res->ai_family == AF_INET6 && path_.empty()) {
|
||||
int zero = 0;
|
||||
if (-1 == setsockopt(serverSocket_, IPPROTO_IPV6, IPV6_V6ONLY,
|
||||
&zero, sizeof(zero))) {
|
||||
cast_sockopt(&zero), sizeof(zero))) {
|
||||
GlobalOutput.perror("TServerSocket::listen() IPV6_V6ONLY ", errno);
|
||||
}
|
||||
}
|
||||
@ -234,7 +252,7 @@ void TServerSocket::listen() {
|
||||
// Turn linger off, don't want to block on calls to close
|
||||
struct linger ling = {0, 0};
|
||||
if (-1 == setsockopt(serverSocket_, SOL_SOCKET, SO_LINGER,
|
||||
&ling, sizeof(ling))) {
|
||||
cast_sockopt(&ling), sizeof(ling))) {
|
||||
int errno_copy = errno;
|
||||
GlobalOutput.perror("TServerSocket::listen() setsockopt() SO_LINGER ", errno_copy);
|
||||
close();
|
||||
@ -245,7 +263,7 @@ void TServerSocket::listen() {
|
||||
if (path_.empty()) {
|
||||
// TCP Nodelay, speed over bandwidth
|
||||
if (-1 == setsockopt(serverSocket_, IPPROTO_TCP, TCP_NODELAY,
|
||||
&one, sizeof(one))) {
|
||||
cast_sockopt(&one), sizeof(one))) {
|
||||
int errno_copy = errno;
|
||||
GlobalOutput.perror("TServerSocket::listen() setsockopt() TCP_NODELAY ", errno_copy);
|
||||
close();
|
||||
@ -273,6 +291,9 @@ void TServerSocket::listen() {
|
||||
int retries = 0;
|
||||
|
||||
if (! path_.empty()) {
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
// Unix Domain Socket
|
||||
struct sockaddr_un address;
|
||||
socklen_t len;
|
||||
@ -303,6 +324,12 @@ void TServerSocket::listen() {
|
||||
|
||||
// free addrinfo
|
||||
freeaddrinfo(res0);
|
||||
|
||||
#else
|
||||
GlobalOutput.perror("TSocket::open() Unix Domain socket path not supported on windows", -99);
|
||||
throw TTransportException(TTransportException::NOT_OPEN, " Unix Domain socket path not supported");
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// throw an error if we failed to bind properly
|
||||
@ -368,7 +395,7 @@ shared_ptr<TTransport> TServerSocket::acceptImpl() {
|
||||
// Check for an interrupt signal
|
||||
if (intSock2_ >= 0 && (fds[1].revents & POLLIN)) {
|
||||
int8_t buf;
|
||||
if (-1 == recv(intSock2_, &buf, sizeof(int8_t), 0)) {
|
||||
if (-1 == recv(intSock2_, cast_sockopt(&buf), sizeof(int8_t), 0)) {
|
||||
GlobalOutput.perror("TServerSocket::acceptImpl() recv() interrupt ", errno);
|
||||
}
|
||||
throw TTransportException(TTransportException::INTERRUPTED);
|
||||
@ -429,7 +456,7 @@ shared_ptr<TSocket> TServerSocket::createSocket(int clientSocket) {
|
||||
void TServerSocket::interrupt() {
|
||||
if (intSock1_ >= 0) {
|
||||
int8_t byte = 0;
|
||||
if (-1 == send(intSock1_, &byte, sizeof(int8_t), 0)) {
|
||||
if (-1 == send(intSock1_, cast_sockopt(&byte), sizeof(int8_t), 0)) {
|
||||
GlobalOutput.perror("TServerSocket::interrupt() send() ", errno);
|
||||
}
|
||||
}
|
||||
@ -437,11 +464,18 @@ void TServerSocket::interrupt() {
|
||||
|
||||
void TServerSocket::close() {
|
||||
if (serverSocket_ >= 0) {
|
||||
shutdown(serverSocket_, SHUT_RDWR);
|
||||
::close(serverSocket_);
|
||||
|
||||
#ifdef _WIN32
|
||||
shutdown(serverSocket_, SD_BOTH);
|
||||
::closesocket(serverSocket_);
|
||||
#else
|
||||
shutdown(serverSocket_, SHUT_RDWR);
|
||||
::close(serverSocket_);
|
||||
#endif
|
||||
|
||||
}
|
||||
if (intSock1_ >= 0) {
|
||||
::close(intSock1_);
|
||||
::close(intSock1_);
|
||||
}
|
||||
if (intSock2_ >= 0) {
|
||||
::close(intSock2_);
|
||||
|
@ -49,6 +49,24 @@
|
||||
#include "TSocket.h"
|
||||
#include "TTransportException.h"
|
||||
|
||||
#ifndef SOCKOPT_CAST_T
|
||||
# ifndef _WIN32
|
||||
# define SOCKOPT_CAST_T void
|
||||
# else
|
||||
# define SOCKOPT_CAST_T char
|
||||
# endif // _WIN32
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline const SOCKOPT_CAST_T* const_cast_sockopt(const T* v) {
|
||||
return reinterpret_cast<const SOCKOPT_CAST_T*>(v);
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline SOCKOPT_CAST_T* cast_sockopt(T* v) {
|
||||
return reinterpret_cast<SOCKOPT_CAST_T*>(v);
|
||||
}
|
||||
|
||||
namespace apache { namespace thrift { namespace transport {
|
||||
|
||||
using namespace std;
|
||||
@ -141,7 +159,7 @@ bool TSocket::peek() {
|
||||
return false;
|
||||
}
|
||||
uint8_t buf;
|
||||
int r = recv(socket_, &buf, 1, MSG_PEEK);
|
||||
int r = recv(socket_, cast_sockopt(&buf), 1, MSG_PEEK);
|
||||
if (r == -1) {
|
||||
int errno_copy = errno;
|
||||
#if defined __FreeBSD__ || defined __MACH__
|
||||
@ -162,6 +180,11 @@ bool TSocket::peek() {
|
||||
}
|
||||
|
||||
void TSocket::openConnection(struct addrinfo *res) {
|
||||
|
||||
#ifdef _WIN32
|
||||
TWinsockSingleton::create();
|
||||
#endif // _WIN32
|
||||
|
||||
if (isOpen()) {
|
||||
return;
|
||||
}
|
||||
@ -222,6 +245,9 @@ void TSocket::openConnection(struct addrinfo *res) {
|
||||
// Connect the socket
|
||||
int ret;
|
||||
if (! path_.empty()) {
|
||||
|
||||
#ifndef _WIN32
|
||||
|
||||
struct sockaddr_un address;
|
||||
socklen_t len;
|
||||
|
||||
@ -235,6 +261,12 @@ void TSocket::openConnection(struct addrinfo *res) {
|
||||
snprintf(address.sun_path, sizeof(address.sun_path), "%s", path_.c_str());
|
||||
len = sizeof(address);
|
||||
ret = connect(socket_, (struct sockaddr *) &address, len);
|
||||
|
||||
#else
|
||||
GlobalOutput.perror("TSocket::open() Unix Domain socket path not supported on windows", -99);
|
||||
throw TTransportException(TTransportException::NOT_OPEN, " Unix Domain socket path not supported");
|
||||
#endif
|
||||
|
||||
} else {
|
||||
ret = connect(socket_, res->ai_addr, res->ai_addrlen);
|
||||
}
|
||||
@ -262,7 +294,7 @@ void TSocket::openConnection(struct addrinfo *res) {
|
||||
int val;
|
||||
socklen_t lon;
|
||||
lon = sizeof(int);
|
||||
int ret2 = getsockopt(socket_, SOL_SOCKET, SO_ERROR, (void *)&val, &lon);
|
||||
int ret2 = getsockopt(socket_, SOL_SOCKET, SO_ERROR, cast_sockopt(&val), &lon);
|
||||
if (ret2 == -1) {
|
||||
int errno_copy = errno;
|
||||
GlobalOutput.perror("TSocket::open() getsockopt() " + getSocketInfo(), errno_copy);
|
||||
@ -366,8 +398,15 @@ void TSocket::local_open(){
|
||||
|
||||
void TSocket::close() {
|
||||
if (socket_ >= 0) {
|
||||
shutdown(socket_, SHUT_RDWR);
|
||||
::close(socket_);
|
||||
|
||||
#ifdef _WIN32
|
||||
shutdown(socket_, SD_BOTH);
|
||||
::closesocket(socket_);
|
||||
#else
|
||||
shutdown(socket_, SHUT_RDWR);
|
||||
::close(socket_);
|
||||
#endif
|
||||
|
||||
}
|
||||
socket_ = -1;
|
||||
}
|
||||
@ -408,7 +447,7 @@ uint32_t TSocket::read(uint8_t* buf, uint32_t len) {
|
||||
// an EAGAIN is due to a timeout or an out-of-resource condition.
|
||||
begin.tv_sec = begin.tv_usec = 0;
|
||||
}
|
||||
int got = recv(socket_, buf, len, 0);
|
||||
int got = recv(socket_, cast_sockopt(buf), len, 0);
|
||||
int errno_copy = errno; //gettimeofday can change errno
|
||||
++g_socket_syscalls;
|
||||
|
||||
@ -518,7 +557,7 @@ uint32_t TSocket::write_partial(const uint8_t* buf, uint32_t len) {
|
||||
flags |= MSG_NOSIGNAL;
|
||||
#endif // ifdef MSG_NOSIGNAL
|
||||
|
||||
int b = send(socket_, buf + sent, len - sent, flags);
|
||||
int b = send(socket_, const_cast_sockopt(buf + sent), len - sent, flags);
|
||||
++g_socket_syscalls;
|
||||
|
||||
if (b < 0) {
|
||||
@ -568,7 +607,7 @@ void TSocket::setLinger(bool on, int linger) {
|
||||
}
|
||||
|
||||
struct linger l = {(lingerOn_ ? 1 : 0), lingerVal_};
|
||||
int ret = setsockopt(socket_, SOL_SOCKET, SO_LINGER, &l, sizeof(l));
|
||||
int ret = setsockopt(socket_, SOL_SOCKET, SO_LINGER, cast_sockopt(&l), sizeof(l));
|
||||
if (ret == -1) {
|
||||
int errno_copy = errno; // Copy errno because we're allocating memory.
|
||||
GlobalOutput.perror("TSocket::setLinger() setsockopt() " + getSocketInfo(), errno_copy);
|
||||
@ -583,7 +622,7 @@ void TSocket::setNoDelay(bool noDelay) {
|
||||
|
||||
// Set socket to NODELAY
|
||||
int v = noDelay_ ? 1 : 0;
|
||||
int ret = setsockopt(socket_, IPPROTO_TCP, TCP_NODELAY, &v, sizeof(v));
|
||||
int ret = setsockopt(socket_, IPPROTO_TCP, TCP_NODELAY, cast_sockopt(&v), sizeof(v));
|
||||
if (ret == -1) {
|
||||
int errno_copy = errno; // Copy errno because we're allocating memory.
|
||||
GlobalOutput.perror("TSocket::setNoDelay() setsockopt() " + getSocketInfo(), errno_copy);
|
||||
@ -612,7 +651,7 @@ void TSocket::setRecvTimeout(int ms) {
|
||||
|
||||
// Copy because poll may modify
|
||||
struct timeval r = recvTimeval_;
|
||||
int ret = setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, &r, sizeof(r));
|
||||
int ret = setsockopt(socket_, SOL_SOCKET, SO_RCVTIMEO, cast_sockopt(&r), sizeof(r));
|
||||
if (ret == -1) {
|
||||
int errno_copy = errno; // Copy errno because we're allocating memory.
|
||||
GlobalOutput.perror("TSocket::setRecvTimeout() setsockopt() " + getSocketInfo(), errno_copy);
|
||||
@ -634,7 +673,7 @@ void TSocket::setSendTimeout(int ms) {
|
||||
|
||||
struct timeval s = {(int)(sendTimeout_/1000),
|
||||
(int)((sendTimeout_%1000)*1000)};
|
||||
int ret = setsockopt(socket_, SOL_SOCKET, SO_SNDTIMEO, &s, sizeof(s));
|
||||
int ret = setsockopt(socket_, SOL_SOCKET, SO_SNDTIMEO, cast_sockopt(&s), sizeof(s));
|
||||
if (ret == -1) {
|
||||
int errno_copy = errno; // Copy errno because we're allocating memory.
|
||||
GlobalOutput.perror("TSocket::setSendTimeout() setsockopt() " + getSocketInfo(), errno_copy);
|
||||
|
53
lib/cpp/src/windows/Fcntl.cpp
Normal file
53
lib/cpp/src/windows/Fcntl.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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 "Fcntl.h"
|
||||
|
||||
// Win32
|
||||
#include <Winsock2.h>
|
||||
|
||||
int fcntl(int fd, int cmd, int flags)
|
||||
{
|
||||
if(cmd != F_GETFL && cmd != F_SETFL)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(flags != O_NONBLOCK && flags != 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(cmd == F_GETFL)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res;
|
||||
if(flags)
|
||||
{
|
||||
res = ioctlsocket(fd, FIONBIO, reinterpret_cast<u_long *>(&(flags = 1)));
|
||||
}
|
||||
else
|
||||
{
|
||||
res = ioctlsocket(fd, FIONBIO, reinterpret_cast<u_long *>(&(flags = 0)));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
41
lib/cpp/src/windows/Fcntl.h
Normal file
41
lib/cpp/src/windows/Fcntl.h
Normal file
@ -0,0 +1,41 @@
|
||||
/*
|
||||
* 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_WINDOWS_FCNTL_H_
|
||||
#define _THRIFT_WINDOWS_FCNTL_H_ 1
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
#define O_NONBLOCK 1
|
||||
|
||||
enum
|
||||
{
|
||||
F_GETFL,
|
||||
F_SETFL,
|
||||
};
|
||||
|
||||
int fcntl(int fd, int cmd, int flags);
|
||||
|
||||
#endif // _THRIFT_WINDOWS_FCNTL_H_
|
92
lib/cpp/src/windows/GetTimeOfDay.cpp
Normal file
92
lib/cpp/src/windows/GetTimeOfDay.cpp
Normal file
@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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 "GetTimeOfDay.h"
|
||||
#include "config.h"
|
||||
|
||||
// win32
|
||||
#include <time.h>
|
||||
|
||||
#if defined(_MSC_VER) || defined(_MSC_EXTENSIONS)
|
||||
# define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
|
||||
#else
|
||||
# define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
|
||||
#endif
|
||||
|
||||
struct timezone
|
||||
{
|
||||
int tz_minuteswest; /* minutes W of Greenwich */
|
||||
int tz_dsttime; /* type of dst correction */
|
||||
};
|
||||
|
||||
int gettimeofday(struct timeval * tv, struct timezone * tz)
|
||||
{
|
||||
FILETIME ft;
|
||||
unsigned __int64 tmpres(0);
|
||||
static int tzflag;
|
||||
|
||||
if (NULL != tv)
|
||||
{
|
||||
GetSystemTimeAsFileTime(&ft);
|
||||
|
||||
tmpres |= ft.dwHighDateTime;
|
||||
tmpres <<= 32;
|
||||
tmpres |= ft.dwLowDateTime;
|
||||
|
||||
/*converting file time to unix epoch*/
|
||||
tmpres -= DELTA_EPOCH_IN_MICROSECS;
|
||||
tmpres /= 10; /*convert into microseconds*/
|
||||
tv->tv_sec = (long)(tmpres / 1000000UL);
|
||||
tv->tv_usec = (long)(tmpres % 1000000UL);
|
||||
}
|
||||
|
||||
if (NULL != tz)
|
||||
{
|
||||
if (!tzflag)
|
||||
{
|
||||
_tzset();
|
||||
tzflag++;
|
||||
}
|
||||
|
||||
long time_zone(0);
|
||||
errno_t err(_get_timezone(&time_zone));
|
||||
if (err == NO_ERROR)
|
||||
{
|
||||
tz->tz_minuteswest = time_zone / 60;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
int day_light(0);
|
||||
err = (_get_daylight(&day_light));
|
||||
if (err == NO_ERROR)
|
||||
{
|
||||
tz->tz_dsttime = day_light;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
33
lib/cpp/src/windows/GetTimeOfDay.h
Normal file
33
lib/cpp/src/windows/GetTimeOfDay.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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_WINDOWS_GETTIMEOFDAY_H_
|
||||
#define _THRIFT_WINDOWS_GETTIMEOFDAY_H_
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
int gettimeofday(struct timeval * tv, struct timezone * tz);
|
||||
|
||||
#endif // _THRIFT_WINDOWS_GETTIMEOFDAY_H_
|
40
lib/cpp/src/windows/Operators.h
Normal file
40
lib/cpp/src/windows/Operators.h
Normal file
@ -0,0 +1,40 @@
|
||||
/*
|
||||
* 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_WINDOWS_OPERATORS_H_
|
||||
#define _THRIFT_WINDOWS_OPERATORS_H_
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
namespace apache { namespace thrift {
|
||||
|
||||
class TEnumIterator;
|
||||
|
||||
inline bool operator == (const TEnumIterator&, const TEnumIterator&)
|
||||
{
|
||||
// Not entirely sure what the test should be here. It is only to enable
|
||||
// iterator debugging and is not used in release mode.
|
||||
return true;
|
||||
}
|
||||
|
||||
}} // apache::thrift
|
||||
|
||||
#endif // _THRIFT_WINDOWS_OPERATORS_H_
|
96
lib/cpp/src/windows/SocketPair.cpp
Normal file
96
lib/cpp/src/windows/SocketPair.cpp
Normal file
@ -0,0 +1,96 @@
|
||||
/* socketpair.c
|
||||
* Copyright 2007 by Nathan C. Myers <ncm@cantrip.org>; some rights reserved.
|
||||
* This code is Free Software. It may be copied freely, in original or
|
||||
* modified form, subject only to the restrictions that (1) the author is
|
||||
* relieved from all responsibilities for any use for any purpose, and (2)
|
||||
* this copyright notice must be retained, unchanged, in its entirety. If
|
||||
* for any reason the author might be held responsible for any consequences
|
||||
* of copying or use, license is withheld.
|
||||
*/
|
||||
|
||||
/*
|
||||
* 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 "SocketPair.h"
|
||||
|
||||
// stl
|
||||
#include <string.h>
|
||||
|
||||
// Win32
|
||||
#include <Winsock2.h>
|
||||
#include <WS2tcpip.h>
|
||||
|
||||
int socketpair(int d, int type, int protocol, int sv[2])
|
||||
{
|
||||
union {
|
||||
struct sockaddr_in inaddr;
|
||||
struct sockaddr addr;
|
||||
} a;
|
||||
SOCKET listener;
|
||||
int e;
|
||||
socklen_t addrlen = sizeof(a.inaddr);
|
||||
DWORD flags = 0;
|
||||
int reuse = 1;
|
||||
|
||||
if (sv == 0) {
|
||||
WSASetLastError(WSAEINVAL);
|
||||
return SOCKET_ERROR;
|
||||
}
|
||||
|
||||
listener = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
if (listener == INVALID_SOCKET)
|
||||
return SOCKET_ERROR;
|
||||
|
||||
memset(&a, 0, sizeof(a));
|
||||
a.inaddr.sin_family = AF_INET;
|
||||
a.inaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
||||
a.inaddr.sin_port = 0;
|
||||
|
||||
sv[0] = sv[1] = INVALID_SOCKET;
|
||||
do {
|
||||
if (setsockopt(listener, SOL_SOCKET, SO_REUSEADDR,
|
||||
(char*) &reuse, (socklen_t) sizeof(reuse)) == -1)
|
||||
break;
|
||||
if (bind(listener, &a.addr, sizeof(a.inaddr)) == SOCKET_ERROR)
|
||||
break;
|
||||
if (getsockname(listener, &a.addr, &addrlen) == SOCKET_ERROR)
|
||||
break;
|
||||
if (listen(listener, 1) == SOCKET_ERROR)
|
||||
break;
|
||||
sv[0] = WSASocket(AF_INET, SOCK_STREAM, 0, NULL, 0, flags);
|
||||
if (sv[0] == INVALID_SOCKET)
|
||||
break;
|
||||
if (connect(sv[0], &a.addr, sizeof(a.inaddr)) == SOCKET_ERROR)
|
||||
break;
|
||||
sv[1] = accept(listener, NULL, NULL);
|
||||
if (sv[1] == INVALID_SOCKET)
|
||||
break;
|
||||
|
||||
closesocket(listener);
|
||||
return 0;
|
||||
|
||||
} while (0);
|
||||
|
||||
e = WSAGetLastError();
|
||||
closesocket(listener);
|
||||
closesocket(sv[0]);
|
||||
closesocket(sv[1]);
|
||||
WSASetLastError(e);
|
||||
return SOCKET_ERROR;
|
||||
}
|
33
lib/cpp/src/windows/SocketPair.h
Normal file
33
lib/cpp/src/windows/SocketPair.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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_WINDOWS_SOCKETPAIR_H_
|
||||
#define _THRIFT_WINDOWS_SOCKETPAIR_H_ 1
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
int socketpair(int d, int type, int protocol, int sv[2]);
|
||||
|
||||
#endif // _THRIFT_WINDOWS_SOCKETPAIR_H_
|
20
lib/cpp/src/windows/StdAfx.cpp
Normal file
20
lib/cpp/src/windows/StdAfx.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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 "stdafx.h"
|
38
lib/cpp/src/windows/StdAfx.h
Normal file
38
lib/cpp/src/windows/StdAfx.h
Normal file
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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_WINDOWS_STDAFX_H_
|
||||
#define _THRIFT_WINDOWS_STDAFX_H_
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
#include "TargetVersion.h"
|
||||
#include "Config.h"
|
||||
|
||||
// Exclude rarely-used stuff from Windows headers
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <Windows.h>
|
||||
|
||||
#endif // _THRIFT_WINDOWS_STDAFX_H_
|
63
lib/cpp/src/windows/TWinsockSingleton.cpp
Normal file
63
lib/cpp/src/windows/TWinsockSingleton.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* 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 "StdAfx.h"
|
||||
#include "TWinsockSingleton.h"
|
||||
|
||||
// boost
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace apache { namespace thrift { namespace transport {
|
||||
|
||||
TWinsockSingleton::instance_ptr TWinsockSingleton::instance_ptr_(NULL);
|
||||
boost::once_flag TWinsockSingleton::flags_ = BOOST_ONCE_INIT;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
TWinsockSingleton::TWinsockSingleton(void)
|
||||
{
|
||||
WORD version(MAKEWORD(2, 2));
|
||||
WSAData data = {0};
|
||||
|
||||
int error(WSAStartup(version, &data));
|
||||
if (error != 0)
|
||||
{
|
||||
BOOST_ASSERT(false);
|
||||
throw std::runtime_error("Failed to initialise Winsock.");
|
||||
}
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
TWinsockSingleton::~TWinsockSingleton(void)
|
||||
{
|
||||
WSACleanup();
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void TWinsockSingleton::create(void)
|
||||
{
|
||||
boost::call_once(init, flags_);
|
||||
}
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
void TWinsockSingleton::init(void)
|
||||
{
|
||||
instance_ptr_.reset(new TWinsockSingleton);
|
||||
}
|
||||
|
||||
}}} // apache::thrift::transport
|
77
lib/cpp/src/windows/TWinsockSingleton.h
Normal file
77
lib/cpp/src/windows/TWinsockSingleton.h
Normal file
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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_WINDOWS_TWINSOCKSINGLETON_H_
|
||||
#define _THRIFT_TRANSPORT_WINDOWS_TWINSOCKSINGLETON_H_ 1
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
// boost
|
||||
#include <boost/noncopyable.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/thread/once.hpp>
|
||||
|
||||
namespace apache { namespace thrift { namespace transport {
|
||||
|
||||
/**
|
||||
* Winsock2 must be intialised once only in order to create sockets. This class
|
||||
* performs a one time initialisation when create is called.
|
||||
*/
|
||||
class TWinsockSingleton : private boost::noncopyable
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
typedef boost::scoped_ptr<TWinsockSingleton> instance_ptr;
|
||||
|
||||
private:
|
||||
|
||||
friend void boost::call_once(void (*func)(void), boost::once_flag& flag);
|
||||
|
||||
private:
|
||||
|
||||
TWinsockSingleton(void);
|
||||
|
||||
public:
|
||||
|
||||
~TWinsockSingleton(void);
|
||||
|
||||
public:
|
||||
|
||||
static void create(void);
|
||||
|
||||
private:
|
||||
|
||||
static void init(void);
|
||||
|
||||
private:
|
||||
|
||||
static instance_ptr instance_ptr_;
|
||||
static boost::once_flag flags_;
|
||||
};
|
||||
|
||||
}}} // apache::thrift::transport
|
||||
|
||||
#endif // _THRIFT_TRANSPORT_WINDOWS_TWINSOCKSINGLETON_H_
|
33
lib/cpp/src/windows/TargetVersion.h
Normal file
33
lib/cpp/src/windows/TargetVersion.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
* 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 _THIRFT_WINDOWS_TARGETVERSION_H_
|
||||
#define _THIRFT_WINDOWS_TARGETVERSION_H_
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
#include <SDKDDKVer.h>
|
||||
|
||||
#endif //_THIRFT_WINDOWS_TARGETVERSION_H_
|
80
lib/cpp/src/windows/config.h
Normal file
80
lib/cpp/src/windows/config.h
Normal file
@ -0,0 +1,80 @@
|
||||
/*
|
||||
* 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_WINDOWS_CONFIG_H_
|
||||
#define _THRIFT_WINDOWS_CONFIG_H_ 1
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
#include "TargetVersion.h"
|
||||
#include "GetTimeOfDay.h"
|
||||
#include "Operators.h"
|
||||
#include "TWinsockSingleton.h"
|
||||
#include "Fcntl.h"
|
||||
#include "SocketPair.h"
|
||||
|
||||
// boost
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
typedef boost::int64_t int64_t;
|
||||
typedef boost::uint32_t uint32_t;
|
||||
typedef boost::uint8_t uint8_t;
|
||||
|
||||
// windows
|
||||
#include <Winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#pragma comment(lib, "Ws2_32.lib")
|
||||
|
||||
// pthreads
|
||||
#include <pthread.h>
|
||||
|
||||
//"asm/posix_types.h"
|
||||
typedef unsigned int __kernel_size_t;
|
||||
typedef int __kernel_ssize_t;
|
||||
|
||||
//"linux/types.h"
|
||||
typedef __kernel_size_t size_t;
|
||||
typedef __kernel_ssize_t ssize_t;
|
||||
|
||||
// Missing defines.
|
||||
#define __BYTE_ORDER __LITTLE_ENDIAN
|
||||
|
||||
// Missing functions.
|
||||
#define usleep(ms) Sleep(ms)
|
||||
|
||||
#if WINVER == 0x0501
|
||||
# define poll(fds, nfds, timeout) \
|
||||
select(0, NULL, fds, NULL, timeout)
|
||||
#else
|
||||
# define poll(fds, nfds, timeout) \
|
||||
WSAPoll(fds, nfds, timeout)
|
||||
#endif // WINVER
|
||||
|
||||
inline void close(SOCKET socket)
|
||||
{
|
||||
::closesocket(socket);
|
||||
}
|
||||
|
||||
#endif // _THRIFT_WINDOWS_CONFIG_H_
|
53
lib/cpp/src/windows/force_inc.h
Normal file
53
lib/cpp/src/windows/force_inc.h
Normal file
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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_WINDOWS_FORCEINC_H_
|
||||
#define _THRIFT_WINDOWS_FORCEINC_H_
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER > 1200)
|
||||
#pragma once
|
||||
#endif // _MSC_VER
|
||||
|
||||
#ifndef _WIN32
|
||||
#error This is a MSVC header only.
|
||||
#endif
|
||||
|
||||
#undef gai_strerror
|
||||
#define gai_strerror gai_strerrorA
|
||||
|
||||
#undef errno
|
||||
#undef EINTR
|
||||
#undef EINPROGRESS
|
||||
#undef ECONNRESET
|
||||
#undef ENOTCONN
|
||||
#undef ETIMEDOUT
|
||||
#undef EWOULDBLOCK
|
||||
#undef EAGAIN
|
||||
#undef EPIPE
|
||||
#define errno ::WSAGetLastError()
|
||||
#define EINPROGRESS WSAEINPROGRESS
|
||||
#define EAGAIN WSAEWOULDBLOCK
|
||||
#define EINTR WSAEINTR
|
||||
#define ECONNRESET WSAECONNRESET
|
||||
#define ENOTCONN WSAENOTCONN
|
||||
#define ETIMEDOUT WSAETIMEDOUT
|
||||
#define EWOULDBLOCK WSAEWOULDBLOCK
|
||||
#define EPIPE WSAECONNRESET
|
||||
|
||||
#endif // _THRIFT_WINDOWS_FORCEINC_H_
|
20
lib/cpp/src/windows/tr1/functional
Normal file
20
lib/cpp/src/windows/tr1/functional
Normal file
@ -0,0 +1,20 @@
|
||||
/*
|
||||
* 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 <functional>
|
31
lib/cpp/thrift.sln
Normal file
31
lib/cpp/thrift.sln
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libthriftnb", "libthriftnb.vcxproj", "{D8696CCE-7D46-4659-B432-91754A41DEB0}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libthrift", "libthrift.vcxproj", "{DD26F57E-60F2-4F37-A616-D219A9BF338F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "doc", "doc", "{006984E0-7CC1-47E2-ACD2-A40FE4D38693}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
README_WINDOWS = README_WINDOWS
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D8696CCE-7D46-4659-B432-91754A41DEB0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{D8696CCE-7D46-4659-B432-91754A41DEB0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{D8696CCE-7D46-4659-B432-91754A41DEB0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{D8696CCE-7D46-4659-B432-91754A41DEB0}.Release|Win32.Build.0 = Release|Win32
|
||||
{DD26F57E-60F2-4F37-A616-D219A9BF338F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{DD26F57E-60F2-4F37-A616-D219A9BF338F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{DD26F57E-60F2-4F37-A616-D219A9BF338F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{DD26F57E-60F2-4F37-A616-D219A9BF338F}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
Loading…
Reference in New Issue
Block a user