forked from larroy/libutp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge BitTorrent libutp changes from uTorrent 3.4 (alpha)
- Loading branch information
Showing
26 changed files
with
6,405 additions
and
3,585 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
*.o | ||
*.a | ||
*.so | ||
ucat | ||
ucat-static | ||
tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
SRCS = utp.cpp utp_utils.cpp | ||
OBJS = utp.o utp_utils.o | ||
CXXFLAGS = -fno-exceptions -fno-rtti -Wall -g | ||
OBJS = utp_internal.o utp_utils.o utp_hash.o utp_callbacks.o utp_api.o utp_packedsockaddr.o | ||
CFLAGS = -Wall -DPOSIX -g -fno-exceptions | ||
CXXFLAGS = $(CFLAGS) -fPIC -fno-rtti | ||
CC = gcc | ||
CXX = g++ | ||
|
||
all: libutp.a | ||
CXXFLAGS += -Wno-sign-compare | ||
CXXFLAGS += -fpermissive | ||
|
||
# Uncomment to enable utp_get_stats(), and a few extra sanity checks | ||
CFLAGS += -D_DEBUG | ||
|
||
# Uncomment to enable debug logging | ||
CFLAGS += -DUTP_DEBUG_LOGGING | ||
|
||
# Dynamically determine if librt is available. If so, assume we need to link | ||
# against it for clock_gettime(2). This is required for clean builds on OSX; | ||
# see <https://github.com/bittorrent/libutp/issues/1> for more. This should | ||
# probably be ported to CMake at some point, but is suitable for now. | ||
lrt := $(shell echo 'int main() {}' | $(CC) -xc -o /dev/null - -lrt >/dev/null 2>&1; echo $$?) | ||
ifeq ($(strip $(lrt)),0) | ||
LDFLAGS += -lrt | ||
endif | ||
|
||
all: libutp.so libutp.a ucat ucat-static | ||
|
||
libutp.so: $(OBJS) | ||
$(CXX) $(CXXFLAGS) -o libutp.so -shared $(OBJS) | ||
|
||
libutp.a: $(OBJS) | ||
-rm -f libutp.a | ||
ar q libutp.a $(OBJS) | ||
ranlib libutp.a | ||
ar rvs libutp.a $(OBJS) | ||
|
||
.cpp.o: | ||
g++ -c -DPOSIX -I . -I utp_config_lib $(CXXFLAGS) $< | ||
ucat: ucat.o libutp.so | ||
$(CC) $(CFLAGS) -o ucat ucat.o -L. -lutp $(LDFLAGS) | ||
|
||
.PHONY: clean | ||
ucat-static: ucat.o libutp.a | ||
$(CXX) $(CXXFLAGS) -o ucat-static ucat.o libutp.a $(LDFLAGS) | ||
|
||
clean: | ||
-rm -f $(OBJS) libutp.a | ||
rm -f *.o libutp.so libutp.a ucat ucat-static | ||
|
||
tags: $(shell ls *.cpp *.h) | ||
rm -f tags | ||
ctags *.cpp *.h | ||
|
||
anyway: clean all | ||
.PHONY: clean all anyway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
<?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="Debug|x64"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|x64"> | ||
<Configuration>Release</Configuration> | ||
<Platform>x64</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="utp_templates.h" /> | ||
<ClInclude Include="utp.h" /> | ||
<ClInclude Include="utp_callbacks.h" /> | ||
<ClInclude Include="utp_hash.h" /> | ||
<ClInclude Include="utp_internal.h" /> | ||
<ClInclude Include="utp_packedsockaddr.h" /> | ||
<ClInclude Include="utp_utils.h" /> | ||
<ClInclude Include="utp_types.h" /> | ||
<ClInclude Include="win32_inet_ntop.h" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="utp_api.cpp" /> | ||
<ClCompile Include="utp_callbacks.cpp" /> | ||
<ClCompile Include="utp_hash.cpp" /> | ||
<ClCompile Include="utp_internal.cpp" /> | ||
<ClCompile Include="utp_packedsockaddr.cpp" /> | ||
<ClCompile Include="utp_utils.cpp" /> | ||
<ClCompile Include="win32_inet_ntop.cpp" /> | ||
</ItemGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{5984D5CD-6ADD-4EB7-82E7-A555888FBBBD}</ProjectGuid> | ||
<RootNamespace>libutp2012</RootNamespace> | ||
<ProjectName>libutp</ProjectName> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>StaticLibrary</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v110</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration"> | ||
<ConfigurationType>StaticLibrary</ConfigurationType> | ||
<UseDebugLibraries>true</UseDebugLibraries> | ||
<PlatformToolset>v110</PlatformToolset> | ||
<CharacterSet>Unicode</CharacterSet> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>StaticLibrary</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</CharacterSet> | ||
<PlatformToolset>v110_xp</PlatformToolset> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration"> | ||
<ConfigurationType>StaticLibrary</ConfigurationType> | ||
<UseDebugLibraries>false</UseDebugLibraries> | ||
<PlatformToolset>v110</PlatformToolset> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<CharacterSet>Unicode</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" /> | ||
<Import Project="prop_sheets\win32-2012.props" /> | ||
<Import Project="prop_sheets\debug-2012.props" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="prop_sheets\x64-2012.props" /> | ||
<Import Project="prop_sheets\debug-2012.props" /> | ||
</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" /> | ||
<Import Project="prop_sheets\win32-2012.props" /> | ||
<Import Project="prop_sheets\release-2012.props" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
<Import Project="prop_sheets\x64-2012.props" /> | ||
<Import Project="prop_sheets\release-2012.props" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup /> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>Disabled</Optimization> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>_WIN32_WINNT=0x501;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<Optimization>MaxSpeed</Optimization> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="utp_templates.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp_callbacks.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp_hash.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp_internal.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp_packedsockaddr.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp_utils.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp_types.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="win32_inet_ntop.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
<ClInclude Include="utp.h"> | ||
<Filter>Header Files</Filter> | ||
</ClInclude> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="utp_api.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="utp_callbacks.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="utp_hash.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="utp_internal.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="utp_packedsockaddr.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="utp_utils.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
<ClCompile Include="win32_inet_ntop.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ImportGroup Label="PropertySheets" /> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<OutDir>$(SolutionDir)Build\$(PlatformName)\$(Configuration)\</OutDir> | ||
<IntDir>$(OutDir)$(ProjectName)\</IntDir> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<PreprocessorDefinitions>_DEBUG;WIN32;ENABLE_I18N;ENABLE_SRP=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
<ExceptionHandling>false</ExceptionHandling> | ||
<StringPooling>false</StringPooling> | ||
<EnableParallelCodeGeneration>false</EnableParallelCodeGeneration> | ||
<CompileAs>Default</CompileAs> | ||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\yajl\src;$(SolutionDir)\ut_core\src;$(SolutionDir)\verification_lib;$(SolutionDir)\libtomcrypt\src\headers</AdditionalIncludeDirectories> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<CompileAsManaged>false</CompileAsManaged> | ||
<RuntimeTypeInfo>false</RuntimeTypeInfo> | ||
<PrecompiledHeaderOutputFile>c:\temp\$(ProjectName)-$(ConfigurationName)-$(PlatformName)-master.pch</PrecompiledHeaderOutputFile> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
<MinimalRebuild>false</MinimalRebuild> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
</Link> | ||
<Link> | ||
<GenerateMapFile>true</GenerateMapFile> | ||
<RandomizedBaseAddress>false</RandomizedBaseAddress> | ||
</Link> | ||
<ProjectReference> | ||
<LinkLibraryDependencies>true</LinkLibraryDependencies> | ||
</ProjectReference> | ||
<ResourceCompile> | ||
<PreprocessorDefinitions>BRANDED_UTORRENT;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ResourceCompile> | ||
<ResourceCompile /> | ||
<ResourceCompile> | ||
<AdditionalIncludeDirectories>$(SolutionDir)\ut_core\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ResourceCompile> | ||
</ItemDefinitionGroup> | ||
<ItemGroup /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ImportGroup Label="PropertySheets" /> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<OutDir>$(SolutionDir)Build\$(PlatformName)\$(Configuration)\</OutDir> | ||
<IntDir>$(OutDir)$(ProjectName)\</IntDir> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<WarningLevel>Level3</WarningLevel> | ||
<AdditionalIncludeDirectories>$(SolutionDir);$(SolutionDir)\yajl\src;$(SolutionDir)\ut_core\src;$(SolutionDir)\verification_lib;$(SolutionDir)\libtomcrypt\src\headers</AdditionalIncludeDirectories> | ||
<Optimization>MinSpace</Optimization> | ||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed> | ||
<OmitFramePointers>true</OmitFramePointers> | ||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations> | ||
<WholeProgramOptimization>false</WholeProgramOptimization> | ||
<BufferSecurityCheck>false</BufferSecurityCheck> | ||
<FunctionLevelLinking>false</FunctionLevelLinking> | ||
<EnableParallelCodeGeneration>true</EnableParallelCodeGeneration> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
<ExceptionHandling>false</ExceptionHandling> | ||
<StringPooling>true</StringPooling> | ||
<CallingConvention>FastCall</CallingConvention> | ||
<CompileAs>Default</CompileAs> | ||
<CompileAsManaged>false</CompileAsManaged> | ||
<PreprocessorDefinitions>NDEBUG;WIN32;ENABLE_I18N;ENABLE_SRP=1;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<RuntimeTypeInfo>false</RuntimeTypeInfo> | ||
<PrecompiledHeaderOutputFile>c:\temp\$(ProjectName)-$(ConfigurationName)-$(PlatformName)-master.pch</PrecompiledHeaderOutputFile> | ||
<MultiProcessorCompilation>true</MultiProcessorCompilation> | ||
</ClCompile> | ||
<Lib /> | ||
<ProjectReference> | ||
<LinkLibraryDependencies>true</LinkLibraryDependencies> | ||
</ProjectReference> | ||
<ResourceCompile> | ||
<PreprocessorDefinitions>BRANDED_UTORRENT;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
</ResourceCompile> | ||
<ResourceCompile /> | ||
<ResourceCompile> | ||
<AdditionalIncludeDirectories>$(SolutionDir)\ut_core\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ResourceCompile> | ||
<Link> | ||
<RandomizedBaseAddress>false</RandomizedBaseAddress> | ||
</Link> | ||
</ItemDefinitionGroup> | ||
<ItemGroup /> | ||
</Project> |
Oops, something went wrong.