diff options
-rw-r--r-- | .gitignore | 15 | ||||
-rw-r--r-- | Lua51.props | 28 | ||||
-rw-r--r-- | Lua52.props | 28 | ||||
-rw-r--r-- | linux.cmd | 1 | ||||
-rw-r--r-- | macosx.cmd | 1 | ||||
-rw-r--r-- | makefile | 19 | ||||
-rwxr-xr-x | mime.vcxproj | 54 | ||||
-rw-r--r-- | mime.vcxproj.filters | 16 | ||||
-rw-r--r-- | mingw.cmd | 1 | ||||
-rwxr-xr-x | socket.vcxproj | 133 | ||||
-rw-r--r-- | socket.vcxproj.filters | 51 | ||||
-rw-r--r-- | src/inet.c | 116 | ||||
-rw-r--r-- | src/inet.h | 11 | ||||
-rw-r--r-- | src/makefile | 139 | ||||
-rw-r--r-- | src/tcp.c | 19 | ||||
-rw-r--r-- | src/udp.c | 37 | ||||
-rw-r--r-- | src/wsocket.c | 8 | ||||
-rw-r--r-- | src/wsocket.h | 4 | ||||
-rw-r--r-- | test/test_bind.lua | 6 | ||||
-rw-r--r-- | test/test_getaddrinfo.lua | 15 | ||||
-rw-r--r-- | test/testclnt.lua | 10 | ||||
-rw-r--r-- | win32.cmd | 12 |
22 files changed, 582 insertions, 142 deletions
@@ -1,7 +1,16 @@ | |||
1 | *.o | 1 | *.o |
2 | *.so | 2 | *.so |
3 | *.so.* | 3 | *.so.* |
4 | macosx.cmd | 4 | *.obj |
5 | win32.cmd | 5 | *.lib |
6 | linux.cmd | 6 | *.dll* |
7 | *.user | ||
8 | *.sdf | ||
9 | Lua.props | ||
10 | Debug | ||
11 | Release | ||
12 | *.manifest | ||
13 | *.swp | ||
14 | *.suo | ||
15 | x64 | ||
7 | 16 | ||
diff --git a/Lua51.props b/Lua51.props new file mode 100644 index 0000000..1bd6256 --- /dev/null +++ b/Lua51.props | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ImportGroup Label="PropertySheets" /> | ||
4 | <PropertyGroup Label="UserMacros"> | ||
5 | <LUABIN_PATH>..\build\vc12\bin\lua\5.1\</LUABIN_PATH> | ||
6 | <LUALIB_PATH>..\build\vc12\bin\lua\5.1\</LUALIB_PATH> | ||
7 | <LUAINC_PATH>..\build\vc12\include\lua\5.1\</LUAINC_PATH> | ||
8 | <LUALIB>lua51.lib</LUALIB> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup> | ||
11 | <_PropertySheetDisplayName>Lua51</_PropertySheetDisplayName> | ||
12 | </PropertyGroup> | ||
13 | <ItemDefinitionGroup /> | ||
14 | <ItemGroup> | ||
15 | <BuildMacro Include="LUALIB_PATH"> | ||
16 | <Value>$(LUALIB_PATH)</Value> | ||
17 | </BuildMacro> | ||
18 | <BuildMacro Include="LUABIN_PATH"> | ||
19 | <Value>$(LUABIN_PATH)</Value> | ||
20 | </BuildMacro> | ||
21 | <BuildMacro Include="LUAINC_PATH"> | ||
22 | <Value>$(LUAINC_PATH)</Value> | ||
23 | </BuildMacro> | ||
24 | <BuildMacro Include="LUALIB"> | ||
25 | <Value>$(LUALIB)</Value> | ||
26 | </BuildMacro> | ||
27 | </ItemGroup> | ||
28 | </Project> | ||
diff --git a/Lua52.props b/Lua52.props new file mode 100644 index 0000000..01afcfa --- /dev/null +++ b/Lua52.props | |||
@@ -0,0 +1,28 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ImportGroup Label="PropertySheets" /> | ||
4 | <PropertyGroup Label="UserMacros"> | ||
5 | <LUABIN_PATH>..\build\vc12\bin\lua\5.2\</LUABIN_PATH> | ||
6 | <LUALIB_PATH>..\build\vc12\bin\lua\5.2\</LUALIB_PATH> | ||
7 | <LUAINC_PATH>..\build\vc12\include\lua\5.2\</LUAINC_PATH> | ||
8 | <LUALIB>lua52.lib</LUALIB> | ||
9 | </PropertyGroup> | ||
10 | <PropertyGroup> | ||
11 | <_PropertySheetDisplayName>Lua52</_PropertySheetDisplayName> | ||
12 | </PropertyGroup> | ||
13 | <ItemDefinitionGroup /> | ||
14 | <ItemGroup> | ||
15 | <BuildMacro Include="LUALIB_PATH"> | ||
16 | <Value>$(LUALIB_PATH)</Value> | ||
17 | </BuildMacro> | ||
18 | <BuildMacro Include="LUABIN_PATH"> | ||
19 | <Value>$(LUABIN_PATH)</Value> | ||
20 | </BuildMacro> | ||
21 | <BuildMacro Include="LUAINC_PATH"> | ||
22 | <Value>$(LUAINC_PATH)</Value> | ||
23 | </BuildMacro> | ||
24 | <BuildMacro Include="LUALIB"> | ||
25 | <Value>$(LUALIB)</Value> | ||
26 | </BuildMacro> | ||
27 | </ItemGroup> | ||
28 | </Project> | ||
diff --git a/linux.cmd b/linux.cmd new file mode 100644 index 0000000..bd59adc --- /dev/null +++ b/linux.cmd | |||
@@ -0,0 +1 @@ | |||
make PLAT=linux DEBUG=DEBUG LUAINC_linux_base=/home/diego/build/linux/include LUAPREFIX_linux=/home/diego/build/linux | |||
diff --git a/macosx.cmd b/macosx.cmd new file mode 100644 index 0000000..46a0709 --- /dev/null +++ b/macosx.cmd | |||
@@ -0,0 +1 @@ | |||
make DEBUG=DEBUG PLAT=macosx LUAINC_macosx_base=/Users/diego/build/macosx/include LUAPREFIX_macosx=/Users/diego/build/macosx install-both | |||
@@ -3,13 +3,14 @@ | |||
3 | # see src/makefile for description of how to customize the build | 3 | # see src/makefile for description of how to customize the build |
4 | # | 4 | # |
5 | # Targets: | 5 | # Targets: |
6 | # install install system independent support | 6 | # install install system independent support |
7 | # install-unix also install unix-only support | 7 | # install-unix also install unix-only support |
8 | # install-both install both lua5.1 and lua5.2 socket support | 8 | # install-both install for both lua5.1 and lua5.2 |
9 | # print print the build settings | 9 | # install-both-unix also install unix-only |
10 | # print print the build settings | ||
10 | 11 | ||
11 | PLAT?= linux | 12 | PLAT?= linux |
12 | PLATS= macosx linux win32 | 13 | PLATS= macosx linux win32 mingw |
13 | 14 | ||
14 | all: $(PLAT) | 15 | all: $(PLAT) |
15 | 16 | ||
@@ -25,6 +26,14 @@ test: | |||
25 | install-both: | 26 | install-both: |
26 | $(MAKE) clean | 27 | $(MAKE) clean |
27 | @cd src; $(MAKE) $(PLAT) LUAV=5.1 | 28 | @cd src; $(MAKE) $(PLAT) LUAV=5.1 |
29 | @cd src; $(MAKE) install LUAV=5.1 | ||
30 | $(MAKE) clean | ||
31 | @cd src; $(MAKE) $(PLAT) LUAV=5.2 | ||
32 | @cd src; $(MAKE) install LUAV=5.2 | ||
33 | |||
34 | install-both-unix: | ||
35 | $(MAKE) clean | ||
36 | @cd src; $(MAKE) $(PLAT) LUAV=5.1 | ||
28 | @cd src; $(MAKE) install-unix LUAV=5.1 | 37 | @cd src; $(MAKE) install-unix LUAV=5.1 |
29 | $(MAKE) clean | 38 | $(MAKE) clean |
30 | @cd src; $(MAKE) $(PLAT) LUAV=5.2 | 39 | @cd src; $(MAKE) $(PLAT) LUAV=5.2 |
diff --git a/mime.vcxproj b/mime.vcxproj index 95781f2..63f5452 100755 --- a/mime.vcxproj +++ b/mime.vcxproj | |||
@@ -21,6 +21,19 @@ | |||
21 | <ItemGroup> | 21 | <ItemGroup> |
22 | <ClCompile Include="src\mime.c" /> | 22 | <ClCompile Include="src\mime.c" /> |
23 | </ItemGroup> | 23 | </ItemGroup> |
24 | <ItemGroup> | ||
25 | <CustomBuild Include="src\mime.lua"> | ||
26 | <FileType>Document</FileType> | ||
27 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> | ||
28 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
29 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> | ||
30 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
31 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUALIB_PATH)$(Platform)\$(Configuration)</Command> | ||
32 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUALIB_PATH)$(Platform)\$(Configuration)</Command> | ||
33 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
34 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
35 | </CustomBuild> | ||
36 | </ItemGroup> | ||
24 | <PropertyGroup Label="Globals"> | 37 | <PropertyGroup Label="Globals"> |
25 | <ProjectGuid>{128E8BD0-174A-48F0-8771-92B1E8D18713}</ProjectGuid> | 38 | <ProjectGuid>{128E8BD0-174A-48F0-8771-92B1E8D18713}</ProjectGuid> |
26 | <Keyword>Win32Proj</Keyword> | 39 | <Keyword>Win32Proj</Keyword> |
@@ -52,25 +65,29 @@ | |||
52 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | 65 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> |
53 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 66 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
54 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 67 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
68 | <Import Project="Lua.props" /> | ||
55 | </ImportGroup> | 69 | </ImportGroup> |
56 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | 70 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
57 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 71 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
58 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 72 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
73 | <Import Project="Lua.props" /> | ||
59 | </ImportGroup> | 74 | </ImportGroup> |
60 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | 75 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> |
61 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 76 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
62 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 77 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
78 | <Import Project="Lua.props" /> | ||
63 | </ImportGroup> | 79 | </ImportGroup> |
64 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | 80 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
65 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 81 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
66 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 82 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
83 | <Import Project="Lua.props" /> | ||
67 | </ImportGroup> | 84 | </ImportGroup> |
68 | <PropertyGroup Label="UserMacros" /> | 85 | <PropertyGroup Label="UserMacros" /> |
69 | <PropertyGroup> | 86 | <PropertyGroup> |
70 | <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> | 87 | <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> |
71 | </PropertyGroup> | 88 | </PropertyGroup> |
72 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 89 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
73 | <OutDir>$(SolutionDir)\$(Configuration)\mime\</OutDir> | 90 | <OutDir>$(LUABIN_PATH)$(Configuration)\mime\</OutDir> |
74 | <IntDir>$(Configuration)\</IntDir> | 91 | <IntDir>$(Configuration)\</IntDir> |
75 | <LinkIncremental>true</LinkIncremental> | 92 | <LinkIncremental>true</LinkIncremental> |
76 | <TargetName>core</TargetName> | 93 | <TargetName>core</TargetName> |
@@ -78,23 +95,23 @@ | |||
78 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 95 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
79 | <LinkIncremental>true</LinkIncremental> | 96 | <LinkIncremental>true</LinkIncremental> |
80 | <TargetName>core</TargetName> | 97 | <TargetName>core</TargetName> |
81 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\mime\</OutDir> | 98 | <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\mime\</OutDir> |
82 | </PropertyGroup> | 99 | </PropertyGroup> |
83 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 100 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
84 | <OutDir>$(SolutionDir)\$(Configuration)\mime\</OutDir> | 101 | <OutDir>$(LUABIN_PATH)$(Configuration)\mime\</OutDir> |
85 | <IntDir>$(Configuration)\</IntDir> | 102 | <IntDir>$(Configuration)\</IntDir> |
86 | <LinkIncremental>false</LinkIncremental> | 103 | <LinkIncremental>false</LinkIncremental> |
87 | <TargetName>core</TargetName> | 104 | <TargetName>core</TargetName> |
88 | </PropertyGroup> | 105 | </PropertyGroup> |
89 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | 106 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
90 | <LinkIncremental>false</LinkIncremental> | 107 | <LinkIncremental>false</LinkIncremental> |
91 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\mime\</OutDir> | 108 | <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\mime\</OutDir> |
92 | <TargetName>core</TargetName> | 109 | <TargetName>core</TargetName> |
93 | </PropertyGroup> | 110 | </PropertyGroup> |
94 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 111 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
95 | <ClCompile> | 112 | <ClCompile> |
96 | <Optimization>Disabled</Optimization> | 113 | <Optimization>Disabled</Optimization> |
97 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 114 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
98 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 115 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
99 | <MinimalRebuild>true</MinimalRebuild> | 116 | <MinimalRebuild>true</MinimalRebuild> |
100 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 117 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
@@ -102,11 +119,12 @@ | |||
102 | <PrecompiledHeader /> | 119 | <PrecompiledHeader /> |
103 | <WarningLevel>Level3</WarningLevel> | 120 | <WarningLevel>Level3</WarningLevel> |
104 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | 121 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
122 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
105 | </ClCompile> | 123 | </ClCompile> |
106 | <Link> | 124 | <Link> |
107 | <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies> | 125 | <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> |
108 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 126 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
109 | <AdditionalLibraryDirectories>..\bin\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 127 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
110 | <GenerateDebugInformation>true</GenerateDebugInformation> | 128 | <GenerateDebugInformation>true</GenerateDebugInformation> |
111 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> | 129 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> |
112 | <SubSystem>Windows</SubSystem> | 130 | <SubSystem>Windows</SubSystem> |
@@ -114,12 +132,13 @@ | |||
114 | <DataExecutionPrevention /> | 132 | <DataExecutionPrevention /> |
115 | <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> | 133 | <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> |
116 | <TargetMachine>MachineX86</TargetMachine> | 134 | <TargetMachine>MachineX86</TargetMachine> |
135 | <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> | ||
117 | </Link> | 136 | </Link> |
118 | </ItemDefinitionGroup> | 137 | </ItemDefinitionGroup> |
119 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 138 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
120 | <ClCompile> | 139 | <ClCompile> |
121 | <Optimization>Disabled</Optimization> | 140 | <Optimization>Disabled</Optimization> |
122 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 141 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
123 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 142 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
124 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 143 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
125 | <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | 144 | <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> |
@@ -127,11 +146,12 @@ | |||
127 | </PrecompiledHeader> | 146 | </PrecompiledHeader> |
128 | <WarningLevel>Level3</WarningLevel> | 147 | <WarningLevel>Level3</WarningLevel> |
129 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 148 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
149 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
130 | </ClCompile> | 150 | </ClCompile> |
131 | <Link> | 151 | <Link> |
132 | <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies> | 152 | <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> |
133 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 153 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
134 | <AdditionalLibraryDirectories>..\bin\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 154 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
135 | <GenerateDebugInformation>true</GenerateDebugInformation> | 155 | <GenerateDebugInformation>true</GenerateDebugInformation> |
136 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> | 156 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> |
137 | <SubSystem>Windows</SubSystem> | 157 | <SubSystem>Windows</SubSystem> |
@@ -143,17 +163,18 @@ | |||
143 | </ItemDefinitionGroup> | 163 | </ItemDefinitionGroup> |
144 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 164 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
145 | <ClCompile> | 165 | <ClCompile> |
146 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 166 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
147 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 167 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
148 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | 168 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
149 | <PrecompiledHeader /> | 169 | <PrecompiledHeader /> |
150 | <WarningLevel>Level4</WarningLevel> | 170 | <WarningLevel>Level4</WarningLevel> |
151 | <DebugInformationFormat /> | 171 | <DebugInformationFormat /> |
172 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
152 | </ClCompile> | 173 | </ClCompile> |
153 | <Link> | 174 | <Link> |
154 | <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies> | 175 | <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> |
155 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 176 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
156 | <AdditionalLibraryDirectories>..\bin\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 177 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
157 | <GenerateDebugInformation>true</GenerateDebugInformation> | 178 | <GenerateDebugInformation>true</GenerateDebugInformation> |
158 | <SubSystem>Windows</SubSystem> | 179 | <SubSystem>Windows</SubSystem> |
159 | <OptimizeReferences>true</OptimizeReferences> | 180 | <OptimizeReferences>true</OptimizeReferences> |
@@ -166,7 +187,7 @@ | |||
166 | </ItemDefinitionGroup> | 187 | </ItemDefinitionGroup> |
167 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | 188 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
168 | <ClCompile> | 189 | <ClCompile> |
169 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 190 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
170 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 191 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;MIME_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
171 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | 192 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
172 | <PrecompiledHeader> | 193 | <PrecompiledHeader> |
@@ -174,11 +195,12 @@ | |||
174 | <WarningLevel>Level4</WarningLevel> | 195 | <WarningLevel>Level4</WarningLevel> |
175 | <DebugInformationFormat> | 196 | <DebugInformationFormat> |
176 | </DebugInformationFormat> | 197 | </DebugInformationFormat> |
198 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
177 | </ClCompile> | 199 | </ClCompile> |
178 | <Link> | 200 | <Link> |
179 | <AdditionalDependencies>lualib.lib;%(AdditionalDependencies)</AdditionalDependencies> | 201 | <AdditionalDependencies>$(LUALIB);%(AdditionalDependencies)</AdditionalDependencies> |
180 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 202 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
181 | <AdditionalLibraryDirectories>..\bin\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 203 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
182 | <GenerateDebugInformation>true</GenerateDebugInformation> | 204 | <GenerateDebugInformation>true</GenerateDebugInformation> |
183 | <SubSystem>Windows</SubSystem> | 205 | <SubSystem>Windows</SubSystem> |
184 | <OptimizeReferences>true</OptimizeReferences> | 206 | <OptimizeReferences>true</OptimizeReferences> |
diff --git a/mime.vcxproj.filters b/mime.vcxproj.filters new file mode 100644 index 0000000..621215b --- /dev/null +++ b/mime.vcxproj.filters | |||
@@ -0,0 +1,16 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup> | ||
4 | <ClCompile Include="src\mime.c" /> | ||
5 | </ItemGroup> | ||
6 | <ItemGroup> | ||
7 | <Filter Include="cdir"> | ||
8 | <UniqueIdentifier>{fad87a86-297c-4881-a114-73b967bb3c92}</UniqueIdentifier> | ||
9 | </Filter> | ||
10 | </ItemGroup> | ||
11 | <ItemGroup> | ||
12 | <CustomBuild Include="src\mime.lua"> | ||
13 | <Filter>cdir</Filter> | ||
14 | </CustomBuild> | ||
15 | </ItemGroup> | ||
16 | </Project> \ No newline at end of file | ||
diff --git a/mingw.cmd b/mingw.cmd new file mode 100644 index 0000000..bf2b7ed --- /dev/null +++ b/mingw.cmd | |||
@@ -0,0 +1 @@ | |||
make PLAT=mingw LUAINC_mingw_base=/home/diego/build/mingw/include LUALIB_mingw_base=/home/diego/build/mingw/bin LUAPREFIX_mingw=/home/diego/build/mingw/bin DEBUG=DEBUG install-both | |||
diff --git a/socket.vcxproj b/socket.vcxproj index 0256c90..53c5539 100755 --- a/socket.vcxproj +++ b/socket.vcxproj | |||
@@ -32,6 +32,98 @@ | |||
32 | <ClCompile Include="src\udp.c" /> | 32 | <ClCompile Include="src\udp.c" /> |
33 | <ClCompile Include="src\wsocket.c" /> | 33 | <ClCompile Include="src\wsocket.c" /> |
34 | </ItemGroup> | 34 | </ItemGroup> |
35 | <ItemGroup> | ||
36 | <CustomBuild Include="src\ltn12.lua"> | ||
37 | <FileType>Document</FileType> | ||
38 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> | ||
39 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> | ||
40 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> | ||
41 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> | ||
42 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
43 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
44 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
45 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
46 | </CustomBuild> | ||
47 | <CustomBuild Include="src\socket.lua"> | ||
48 | <FileType>Document</FileType> | ||
49 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> | ||
50 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)</Command> | ||
51 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> | ||
52 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)</Command> | ||
53 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
54 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
55 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
56 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\%(Filename)%(Extension)</Outputs> | ||
57 | </CustomBuild> | ||
58 | </ItemGroup> | ||
59 | <ItemGroup> | ||
60 | <CustomBuild Include="src\ftp.lua"> | ||
61 | <FileType>Document</FileType> | ||
62 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
63 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
64 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
65 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
66 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
67 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
68 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
69 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
70 | </CustomBuild> | ||
71 | <CustomBuild Include="src\headers.lua"> | ||
72 | <FileType>Document</FileType> | ||
73 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
74 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
75 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
76 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
77 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
78 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
79 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
80 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
81 | </CustomBuild> | ||
82 | <CustomBuild Include="src\http.lua"> | ||
83 | <FileType>Document</FileType> | ||
84 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
85 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
86 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
87 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
88 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
89 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
90 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
91 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
92 | </CustomBuild> | ||
93 | <CustomBuild Include="src\smtp.lua"> | ||
94 | <FileType>Document</FileType> | ||
95 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
96 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
97 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
98 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
99 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
100 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
101 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
102 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
103 | </CustomBuild> | ||
104 | <CustomBuild Include="src\tp.lua"> | ||
105 | <FileType>Document</FileType> | ||
106 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
107 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
108 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
109 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
110 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
111 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
112 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
113 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
114 | </CustomBuild> | ||
115 | <CustomBuild Include="src\url.lua"> | ||
116 | <FileType>Document</FileType> | ||
117 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
118 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
119 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
120 | <Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(LUABIN_PATH)$(Configuration)\socket\%(Filename)%(Extension)</Outputs> | ||
121 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
122 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">copy %(FullPath) $(LUABIN_PATH)$(Platform)\$(Configuration)\socket</Command> | ||
123 | <Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
124 | <Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">copy %(FullPath) $(LUABIN_PATH)$(Configuration)\socket</Command> | ||
125 | </CustomBuild> | ||
126 | </ItemGroup> | ||
35 | <PropertyGroup Label="Globals"> | 127 | <PropertyGroup Label="Globals"> |
36 | <ProjectGuid>{66E3CE14-884D-4AEA-9F20-15A0BEAF8C5A}</ProjectGuid> | 128 | <ProjectGuid>{66E3CE14-884D-4AEA-9F20-15A0BEAF8C5A}</ProjectGuid> |
37 | <Keyword>Win32Proj</Keyword> | 129 | <Keyword>Win32Proj</Keyword> |
@@ -63,25 +155,29 @@ | |||
63 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | 155 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> |
64 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 156 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
65 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 157 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
158 | <Import Project="Lua.props" /> | ||
66 | </ImportGroup> | 159 | </ImportGroup> |
67 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> | 160 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets"> |
68 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 161 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
69 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 162 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
163 | <Import Project="Lua.props" /> | ||
70 | </ImportGroup> | 164 | </ImportGroup> |
71 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | 165 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> |
72 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 166 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
73 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 167 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
168 | <Import Project="Lua.props" /> | ||
74 | </ImportGroup> | 169 | </ImportGroup> |
75 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> | 170 | <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets"> |
76 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | 171 | <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
77 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> | 172 | <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" /> |
173 | <Import Project="Lua.props" /> | ||
78 | </ImportGroup> | 174 | </ImportGroup> |
79 | <PropertyGroup Label="UserMacros" /> | 175 | <PropertyGroup Label="UserMacros" /> |
80 | <PropertyGroup> | 176 | <PropertyGroup> |
81 | <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> | 177 | <_ProjectFileVersion>11.0.50727.1</_ProjectFileVersion> |
82 | </PropertyGroup> | 178 | </PropertyGroup> |
83 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 179 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
84 | <OutDir>$(SolutionDir)\$(Configuration)\socket\</OutDir> | 180 | <OutDir>$(LUALIB_PATH)$(Configuration)\socket\</OutDir> |
85 | <IntDir>$(Configuration)\</IntDir> | 181 | <IntDir>$(Configuration)\</IntDir> |
86 | <LinkIncremental>true</LinkIncremental> | 182 | <LinkIncremental>true</LinkIncremental> |
87 | <TargetName>core</TargetName> | 183 | <TargetName>core</TargetName> |
@@ -89,23 +185,23 @@ | |||
89 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 185 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
90 | <LinkIncremental>true</LinkIncremental> | 186 | <LinkIncremental>true</LinkIncremental> |
91 | <TargetName>core</TargetName> | 187 | <TargetName>core</TargetName> |
92 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\socket\</OutDir> | 188 | <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\</OutDir> |
93 | </PropertyGroup> | 189 | </PropertyGroup> |
94 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 190 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
95 | <OutDir>$(SolutionDir)\$(Configuration)\socket\</OutDir> | 191 | <OutDir>$(LUALIB_PATH)$(Configuration)\socket\</OutDir> |
96 | <IntDir>$(Configuration)\</IntDir> | 192 | <IntDir>$(Configuration)\</IntDir> |
97 | <LinkIncremental>false</LinkIncremental> | 193 | <LinkIncremental>false</LinkIncremental> |
98 | <TargetName>core</TargetName> | 194 | <TargetName>core</TargetName> |
99 | </PropertyGroup> | 195 | </PropertyGroup> |
100 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | 196 | <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
101 | <LinkIncremental>false</LinkIncremental> | 197 | <LinkIncremental>false</LinkIncremental> |
102 | <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\socket\</OutDir> | 198 | <OutDir>$(LUABIN_PATH)$(Platform)\$(Configuration)\socket\</OutDir> |
103 | <TargetName>core</TargetName> | 199 | <TargetName>core</TargetName> |
104 | </PropertyGroup> | 200 | </PropertyGroup> |
105 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | 201 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
106 | <ClCompile> | 202 | <ClCompile> |
107 | <Optimization>Disabled</Optimization> | 203 | <Optimization>Disabled</Optimization> |
108 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 204 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
109 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 205 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
110 | <MinimalRebuild>true</MinimalRebuild> | 206 | <MinimalRebuild>true</MinimalRebuild> |
111 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 207 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
@@ -113,11 +209,12 @@ | |||
113 | <PrecompiledHeader /> | 209 | <PrecompiledHeader /> |
114 | <WarningLevel>Level3</WarningLevel> | 210 | <WarningLevel>Level3</WarningLevel> |
115 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> | 211 | <DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
212 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
116 | </ClCompile> | 213 | </ClCompile> |
117 | <Link> | 214 | <Link> |
118 | <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | 215 | <AdditionalDependencies>$(LUALIB);wsock32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
119 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 216 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
120 | <AdditionalLibraryDirectories>..\bin\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 217 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
121 | <GenerateDebugInformation>true</GenerateDebugInformation> | 218 | <GenerateDebugInformation>true</GenerateDebugInformation> |
122 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> | 219 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> |
123 | <SubSystem>Windows</SubSystem> | 220 | <SubSystem>Windows</SubSystem> |
@@ -125,12 +222,13 @@ | |||
125 | <DataExecutionPrevention /> | 222 | <DataExecutionPrevention /> |
126 | <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> | 223 | <ImportLibrary>$(OutDir)$(TargetName).lib</ImportLibrary> |
127 | <TargetMachine>MachineX86</TargetMachine> | 224 | <TargetMachine>MachineX86</TargetMachine> |
225 | <ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers> | ||
128 | </Link> | 226 | </Link> |
129 | </ItemDefinitionGroup> | 227 | </ItemDefinitionGroup> |
130 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> | 228 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'"> |
131 | <ClCompile> | 229 | <ClCompile> |
132 | <Optimization>Disabled</Optimization> | 230 | <Optimization>Disabled</Optimization> |
133 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 231 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
134 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 232 | <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;LUASOCKET_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
135 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | 233 | <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
136 | <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> | 234 | <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> |
@@ -138,11 +236,12 @@ | |||
138 | </PrecompiledHeader> | 236 | </PrecompiledHeader> |
139 | <WarningLevel>Level3</WarningLevel> | 237 | <WarningLevel>Level3</WarningLevel> |
140 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | 238 | <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
239 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
141 | </ClCompile> | 240 | </ClCompile> |
142 | <Link> | 241 | <Link> |
143 | <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | 242 | <AdditionalDependencies>$(LUALIB);wsock32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
144 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 243 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
145 | <AdditionalLibraryDirectories>..\bin\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 244 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
146 | <GenerateDebugInformation>true</GenerateDebugInformation> | 245 | <GenerateDebugInformation>true</GenerateDebugInformation> |
147 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> | 246 | <ProgramDatabaseFile>$(OutDir)mime.pdb</ProgramDatabaseFile> |
148 | <SubSystem>Windows</SubSystem> | 247 | <SubSystem>Windows</SubSystem> |
@@ -154,17 +253,18 @@ | |||
154 | </ItemDefinitionGroup> | 253 | </ItemDefinitionGroup> |
155 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | 254 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> |
156 | <ClCompile> | 255 | <ClCompile> |
157 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 256 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
158 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 257 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
159 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | 258 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
160 | <PrecompiledHeader /> | 259 | <PrecompiledHeader /> |
161 | <WarningLevel>Level4</WarningLevel> | 260 | <WarningLevel>Level4</WarningLevel> |
162 | <DebugInformationFormat /> | 261 | <DebugInformationFormat /> |
262 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
163 | </ClCompile> | 263 | </ClCompile> |
164 | <Link> | 264 | <Link> |
165 | <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | 265 | <AdditionalDependencies>$(LUALIB);wsock32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
166 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 266 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
167 | <AdditionalLibraryDirectories>..\bin\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 267 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
168 | <GenerateDebugInformation>true</GenerateDebugInformation> | 268 | <GenerateDebugInformation>true</GenerateDebugInformation> |
169 | <SubSystem>Windows</SubSystem> | 269 | <SubSystem>Windows</SubSystem> |
170 | <OptimizeReferences>true</OptimizeReferences> | 270 | <OptimizeReferences>true</OptimizeReferences> |
@@ -177,7 +277,7 @@ | |||
177 | </ItemDefinitionGroup> | 277 | </ItemDefinitionGroup> |
178 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> | 278 | <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'"> |
179 | <ClCompile> | 279 | <ClCompile> |
180 | <AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | 280 | <AdditionalIncludeDirectories>$(LUAINC_PATH);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
181 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | 281 | <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;LUASOCKET_API=__declspec(dllexport);_CRT_SECURE_NO_WARNINGS;LUA_COMPAT_MODULE;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
182 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> | 282 | <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
183 | <PrecompiledHeader> | 283 | <PrecompiledHeader> |
@@ -185,11 +285,12 @@ | |||
185 | <WarningLevel>Level4</WarningLevel> | 285 | <WarningLevel>Level4</WarningLevel> |
186 | <DebugInformationFormat> | 286 | <DebugInformationFormat> |
187 | </DebugInformationFormat> | 287 | </DebugInformationFormat> |
288 | <ProgramDataBaseFileName>$(IntDir)$(TargetName)$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName> | ||
188 | </ClCompile> | 289 | </ClCompile> |
189 | <Link> | 290 | <Link> |
190 | <AdditionalDependencies>lualib.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> | 291 | <AdditionalDependencies>$(LUALIB);wsock32.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies> |
191 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> | 292 | <OutputFile>$(OutDir)$(TargetName).dll</OutputFile> |
192 | <AdditionalLibraryDirectories>..\bin\$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> | 293 | <AdditionalLibraryDirectories>$(LUALIB_PATH)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories> |
193 | <GenerateDebugInformation>true</GenerateDebugInformation> | 294 | <GenerateDebugInformation>true</GenerateDebugInformation> |
194 | <SubSystem>Windows</SubSystem> | 295 | <SubSystem>Windows</SubSystem> |
195 | <OptimizeReferences>true</OptimizeReferences> | 296 | <OptimizeReferences>true</OptimizeReferences> |
diff --git a/socket.vcxproj.filters b/socket.vcxproj.filters new file mode 100644 index 0000000..38f2f07 --- /dev/null +++ b/socket.vcxproj.filters | |||
@@ -0,0 +1,51 @@ | |||
1 | <?xml version="1.0" encoding="utf-8"?> | ||
2 | <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
3 | <ItemGroup> | ||
4 | <ClCompile Include="src\auxiliar.c" /> | ||
5 | <ClCompile Include="src\buffer.c" /> | ||
6 | <ClCompile Include="src\except.c" /> | ||
7 | <ClCompile Include="src\inet.c" /> | ||
8 | <ClCompile Include="src\io.c" /> | ||
9 | <ClCompile Include="src\luasocket.c" /> | ||
10 | <ClCompile Include="src\options.c" /> | ||
11 | <ClCompile Include="src\select.c" /> | ||
12 | <ClCompile Include="src\tcp.c" /> | ||
13 | <ClCompile Include="src\timeout.c" /> | ||
14 | <ClCompile Include="src\udp.c" /> | ||
15 | <ClCompile Include="src\wsocket.c" /> | ||
16 | </ItemGroup> | ||
17 | <ItemGroup> | ||
18 | <CustomBuild Include="src\ltn12.lua"> | ||
19 | <Filter>cdir</Filter> | ||
20 | </CustomBuild> | ||
21 | <CustomBuild Include="src\socket.lua"> | ||
22 | <Filter>cdir</Filter> | ||
23 | </CustomBuild> | ||
24 | <CustomBuild Include="src\ftp.lua"> | ||
25 | <Filter>ldir</Filter> | ||
26 | </CustomBuild> | ||
27 | <CustomBuild Include="src\headers.lua"> | ||
28 | <Filter>ldir</Filter> | ||
29 | </CustomBuild> | ||
30 | <CustomBuild Include="src\http.lua"> | ||
31 | <Filter>ldir</Filter> | ||
32 | </CustomBuild> | ||
33 | <CustomBuild Include="src\smtp.lua"> | ||
34 | <Filter>ldir</Filter> | ||
35 | </CustomBuild> | ||
36 | <CustomBuild Include="src\tp.lua"> | ||
37 | <Filter>ldir</Filter> | ||
38 | </CustomBuild> | ||
39 | <CustomBuild Include="src\url.lua"> | ||
40 | <Filter>ldir</Filter> | ||
41 | </CustomBuild> | ||
42 | </ItemGroup> | ||
43 | <ItemGroup> | ||
44 | <Filter Include="cdir"> | ||
45 | <UniqueIdentifier>{b053460d-5439-4e3a-a2eb-c31a95b5691f}</UniqueIdentifier> | ||
46 | </Filter> | ||
47 | <Filter Include="ldir"> | ||
48 | <UniqueIdentifier>{b301b82c-37cb-4e05-9333-194e92ed7a62}</UniqueIdentifier> | ||
49 | </Filter> | ||
50 | </ItemGroup> | ||
51 | </Project> \ No newline at end of file | ||
@@ -79,24 +79,22 @@ static int inet_global_tohostname(lua_State *L) { | |||
79 | } | 79 | } |
80 | 80 | ||
81 | static int inet_global_getnameinfo(lua_State *L) { | 81 | static int inet_global_getnameinfo(lua_State *L) { |
82 | char hbuf[NI_MAXHOST]; | ||
83 | char sbuf[NI_MAXSERV]; | ||
82 | int i, ret; | 84 | int i, ret; |
83 | char host[1024]; | ||
84 | char serv[32]; | ||
85 | struct addrinfo hints; | 85 | struct addrinfo hints; |
86 | struct addrinfo *resolved, *iter; | 86 | struct addrinfo *resolved, *iter; |
87 | const char *node = luaL_optstring(L, 1, NULL); | 87 | const char *host = luaL_optstring(L, 1, NULL); |
88 | const char *service = luaL_optstring(L, 2, NULL); | 88 | const char *serv = luaL_optstring(L, 2, NULL); |
89 | 89 | ||
90 | if (!(node || service)) | 90 | if (!(host || serv)) |
91 | luaL_error(L, "You have to specify a hostname, a service, or both"); | 91 | luaL_error(L, "host and serv cannot be both nil"); |
92 | 92 | ||
93 | memset(&hints, 0, sizeof(hints)); | 93 | memset(&hints, 0, sizeof(hints)); |
94 | hints.ai_socktype = SOCK_STREAM; | 94 | hints.ai_socktype = SOCK_STREAM; |
95 | hints.ai_family = PF_UNSPEC; | 95 | hints.ai_family = PF_UNSPEC; |
96 | 96 | ||
97 | /* getaddrinfo must get a node and a service argument */ | 97 | ret = getaddrinfo(host, serv, &hints, &resolved); |
98 | ret = getaddrinfo(node ? node : "127.0.0.1", service ? service : "7", | ||
99 | &hints, &resolved); | ||
100 | if (ret != 0) { | 98 | if (ret != 0) { |
101 | lua_pushnil(L); | 99 | lua_pushnil(L); |
102 | lua_pushstring(L, socket_gaistrerror(ret)); | 100 | lua_pushstring(L, socket_gaistrerror(ret)); |
@@ -105,19 +103,19 @@ static int inet_global_getnameinfo(lua_State *L) { | |||
105 | 103 | ||
106 | lua_newtable(L); | 104 | lua_newtable(L); |
107 | for (i = 1, iter = resolved; iter; i++, iter = iter->ai_next) { | 105 | for (i = 1, iter = resolved; iter; i++, iter = iter->ai_next) { |
108 | getnameinfo(iter->ai_addr, (socklen_t) iter->ai_addrlen, host, | 106 | getnameinfo(iter->ai_addr, (socklen_t) iter->ai_addrlen, |
109 | node ? (socklen_t) sizeof(host) : 0, serv, service ? (socklen_t) sizeof(serv) : 0, 0); | 107 | hbuf, host? (socklen_t) sizeof(hbuf): 0, |
110 | 108 | sbuf, serv? (socklen_t) sizeof(sbuf): 0, 0); | |
111 | if (node) { | 109 | if (host) { |
112 | lua_pushnumber(L, i); | 110 | lua_pushnumber(L, i); |
113 | lua_pushstring(L, host); | 111 | lua_pushstring(L, hbuf); |
114 | lua_settable(L, -3); | 112 | lua_settable(L, -3); |
115 | } | 113 | } |
116 | } | 114 | } |
117 | freeaddrinfo(resolved); | 115 | freeaddrinfo(resolved); |
118 | 116 | ||
119 | if (service) { | 117 | if (serv) { |
120 | lua_pushstring(L, serv); | 118 | lua_pushstring(L, sbuf); |
121 | return 2; | 119 | return 2; |
122 | } else { | 120 | } else { |
123 | return 1; | 121 | return 1; |
@@ -176,9 +174,14 @@ static int inet_global_getaddrinfo(lua_State *L) | |||
176 | } | 174 | } |
177 | lua_newtable(L); | 175 | lua_newtable(L); |
178 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { | 176 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { |
179 | char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV]; | 177 | char hbuf[NI_MAXHOST]; |
180 | getnameinfo(iterator->ai_addr, (socklen_t) iterator->ai_addrlen, hbuf, | 178 | ret = getnameinfo(iterator->ai_addr, (socklen_t) iterator->ai_addrlen, |
181 | (socklen_t) sizeof(hbuf), sbuf, 0, NI_NUMERICHOST); | 179 | hbuf, (socklen_t) sizeof(hbuf), NULL, 0, NI_NUMERICHOST); |
180 | if (ret){ | ||
181 | lua_pushnil(L); | ||
182 | lua_pushstring(L, socket_gaistrerror(ret)); | ||
183 | return 2; | ||
184 | } | ||
182 | lua_pushnumber(L, i); | 185 | lua_pushnumber(L, i); |
183 | lua_newtable(L); | 186 | lua_newtable(L); |
184 | switch (iterator->ai_family) { | 187 | switch (iterator->ai_family) { |
@@ -203,7 +206,6 @@ static int inet_global_getaddrinfo(lua_State *L) | |||
203 | return 1; | 206 | return 1; |
204 | } | 207 | } |
205 | 208 | ||
206 | |||
207 | /*-------------------------------------------------------------------------*\ | 209 | /*-------------------------------------------------------------------------*\ |
208 | * Gets the host name | 210 | * Gets the host name |
209 | \*-------------------------------------------------------------------------*/ | 211 | \*-------------------------------------------------------------------------*/ |
@@ -222,7 +224,6 @@ static int inet_global_gethostname(lua_State *L) | |||
222 | } | 224 | } |
223 | 225 | ||
224 | 226 | ||
225 | |||
226 | /*=========================================================================*\ | 227 | /*=========================================================================*\ |
227 | * Lua methods | 228 | * Lua methods |
228 | \*=========================================================================*/ | 229 | \*=========================================================================*/ |
@@ -385,7 +386,6 @@ const char *inet_trydisconnect(p_socket ps, int family, p_timeout tm) | |||
385 | struct in6_addr addrany = IN6ADDR_ANY_INIT; | 386 | struct in6_addr addrany = IN6ADDR_ANY_INIT; |
386 | memset((char *) &sin6, 0, sizeof(sin6)); | 387 | memset((char *) &sin6, 0, sizeof(sin6)); |
387 | sin6.sin6_family = AF_UNSPEC; | 388 | sin6.sin6_family = AF_UNSPEC; |
388 | fprintf(stderr, "disconnecting\n"); | ||
389 | sin6.sin6_addr = addrany; | 389 | sin6.sin6_addr = addrany; |
390 | return socket_strerror(socket_connect(ps, (SA *) &sin6, | 390 | return socket_strerror(socket_connect(ps, (SA *) &sin6, |
391 | sizeof(sin6), tm)); | 391 | sizeof(sin6), tm)); |
@@ -397,7 +397,7 @@ fprintf(stderr, "disconnecting\n"); | |||
397 | /*-------------------------------------------------------------------------*\ | 397 | /*-------------------------------------------------------------------------*\ |
398 | * Tries to connect to remote address (address, port) | 398 | * Tries to connect to remote address (address, port) |
399 | \*-------------------------------------------------------------------------*/ | 399 | \*-------------------------------------------------------------------------*/ |
400 | const char *inet_tryconnect(p_socket ps, const char *address, | 400 | const char *inet_tryconnect(p_socket ps, int *family, const char *address, |
401 | const char *serv, p_timeout tm, struct addrinfo *connecthints) | 401 | const char *serv, p_timeout tm, struct addrinfo *connecthints) |
402 | { | 402 | { |
403 | struct addrinfo *iterator = NULL, *resolved = NULL; | 403 | struct addrinfo *iterator = NULL, *resolved = NULL; |
@@ -411,6 +411,23 @@ const char *inet_tryconnect(p_socket ps, const char *address, | |||
411 | } | 411 | } |
412 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { | 412 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { |
413 | timeout_markstart(tm); | 413 | timeout_markstart(tm); |
414 | /* create new socket if necessary. if there was no | ||
415 | * bind, we need to create one for every new family | ||
416 | * that shows up while iterating. if there was a | ||
417 | * bind, all families will be the same and we will | ||
418 | * not enter this branch. */ | ||
419 | if (*family != iterator->ai_family) { | ||
420 | socket_destroy(ps); | ||
421 | err = socket_strerror(socket_create(ps, iterator->ai_family, | ||
422 | iterator->ai_socktype, iterator->ai_protocol)); | ||
423 | if (err != NULL) { | ||
424 | freeaddrinfo(resolved); | ||
425 | return err; | ||
426 | } | ||
427 | *family = iterator->ai_family; | ||
428 | /* all sockets initially non-blocking */ | ||
429 | socket_setnonblocking(ps); | ||
430 | } | ||
414 | /* try connecting to remote address */ | 431 | /* try connecting to remote address */ |
415 | err = socket_strerror(socket_connect(ps, (SA *) iterator->ai_addr, | 432 | err = socket_strerror(socket_connect(ps, (SA *) iterator->ai_addr, |
416 | (socklen_t) iterator->ai_addrlen, tm)); | 433 | (socklen_t) iterator->ai_addrlen, tm)); |
@@ -425,7 +442,8 @@ const char *inet_tryconnect(p_socket ps, const char *address, | |||
425 | /*-------------------------------------------------------------------------*\ | 442 | /*-------------------------------------------------------------------------*\ |
426 | * Tries to accept a socket | 443 | * Tries to accept a socket |
427 | \*-------------------------------------------------------------------------*/ | 444 | \*-------------------------------------------------------------------------*/ |
428 | const char *inet_tryaccept(p_socket server, int family, p_socket client, p_timeout tm) | 445 | const char *inet_tryaccept(p_socket server, int family, p_socket client, |
446 | p_timeout tm) | ||
429 | { | 447 | { |
430 | socklen_t len; | 448 | socklen_t len; |
431 | t_sockaddr_storage addr; | 449 | t_sockaddr_storage addr; |
@@ -446,6 +464,9 @@ const char *inet_trybind(p_socket ps, const char *address, const char *serv, | |||
446 | struct addrinfo *iterator = NULL, *resolved = NULL; | 464 | struct addrinfo *iterator = NULL, *resolved = NULL; |
447 | const char *err = NULL; | 465 | const char *err = NULL; |
448 | t_socket sock = *ps; | 466 | t_socket sock = *ps; |
467 | /* translate luasocket special values to C */ | ||
468 | if (strcmp(address, "*") == 0) address = NULL; | ||
469 | if (!serv) serv = "0"; | ||
449 | /* try resolving */ | 470 | /* try resolving */ |
450 | err = socket_gaistrerror(getaddrinfo(address, serv, bindhints, &resolved)); | 471 | err = socket_gaistrerror(getaddrinfo(address, serv, bindhints, &resolved)); |
451 | if (err) { | 472 | if (err) { |
@@ -485,7 +506,7 @@ const char *inet_trybind(p_socket ps, const char *address, const char *serv, | |||
485 | * Some systems do not provide this so that we provide our own. It's not | 506 | * Some systems do not provide this so that we provide our own. It's not |
486 | * marvelously fast, but it works just fine. | 507 | * marvelously fast, but it works just fine. |
487 | \*-------------------------------------------------------------------------*/ | 508 | \*-------------------------------------------------------------------------*/ |
488 | #ifdef INET_ATON | 509 | #ifdef LUASOCKET_INET_ATON |
489 | int inet_aton(const char *cp, struct in_addr *inp) | 510 | int inet_aton(const char *cp, struct in_addr *inp) |
490 | { | 511 | { |
491 | unsigned int a = 0, b = 0, c = 0, d = 0; | 512 | unsigned int a = 0, b = 0, c = 0, d = 0; |
@@ -507,4 +528,49 @@ int inet_aton(const char *cp, struct in_addr *inp) | |||
507 | } | 528 | } |
508 | #endif | 529 | #endif |
509 | 530 | ||
531 | /*-------------------------------------------------------------------------*\ | ||
532 | * inet_ntop/inet_pton for MinGW from | ||
533 | * http://mingw-users.1079350.n2.nabble.com/IPv6-getaddrinfo-amp-inet-ntop-td5891996.html | ||
534 | \*-------------------------------------------------------------------------*/ | ||
535 | |||
536 | #ifdef LUASOCKET_INET_PTON | ||
537 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt) | ||
538 | { | ||
539 | if (af == AF_INET) { | ||
540 | struct sockaddr_in in; | ||
541 | memset(&in, 0, sizeof(in)); | ||
542 | in.sin_family = AF_INET; | ||
543 | memcpy(&in.sin_addr, src, sizeof(struct in_addr)); | ||
544 | getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), | ||
545 | dst, cnt, NULL, 0, NI_NUMERICHOST); | ||
546 | return dst; | ||
547 | } else if (af == AF_INET6) { | ||
548 | struct sockaddr_in6 in; | ||
549 | memset(&in, 0, sizeof(in)); | ||
550 | in.sin6_family = AF_INET6; | ||
551 | memcpy(&in.sin6_addr, src, sizeof(struct in_addr6)); | ||
552 | getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), | ||
553 | dst, cnt, NULL, 0, NI_NUMERICHOST); | ||
554 | return dst; | ||
555 | } | ||
556 | return NULL; | ||
557 | } | ||
558 | |||
559 | int inet_pton(int af, const char *src, void *dst) | ||
560 | { | ||
561 | struct addrinfo hints, *res, *ressave; | ||
562 | memset(&hints, 0, sizeof(struct addrinfo)); | ||
563 | hints.ai_family = af; | ||
564 | if (getaddrinfo(src, NULL, &hints, &res) != 0) { | ||
565 | return -1; | ||
566 | } | ||
567 | ressave = res; | ||
568 | while (res) { | ||
569 | memcpy(dst, res->ai_addr, res->ai_addrlen); | ||
570 | res = res->ai_next; | ||
571 | } | ||
572 | freeaddrinfo(ressave); | ||
573 | return 0; | ||
574 | } | ||
510 | 575 | ||
576 | #endif | ||
@@ -19,13 +19,13 @@ | |||
19 | #include "timeout.h" | 19 | #include "timeout.h" |
20 | 20 | ||
21 | #ifdef _WIN32 | 21 | #ifdef _WIN32 |
22 | #define INET_ATON | 22 | #define LUASOCKET_INET_ATON |
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | int inet_open(lua_State *L); | 25 | int inet_open(lua_State *L); |
26 | 26 | ||
27 | const char *inet_trycreate(p_socket ps, int family, int type); | 27 | const char *inet_trycreate(p_socket ps, int family, int type); |
28 | const char *inet_tryconnect(p_socket ps, const char *address, | 28 | const char *inet_tryconnect(p_socket ps, int *family, const char *address, |
29 | const char *serv, p_timeout tm, struct addrinfo *connecthints); | 29 | const char *serv, p_timeout tm, struct addrinfo *connecthints); |
30 | const char *inet_trybind(p_socket ps, const char *address, const char *serv, | 30 | const char *inet_trybind(p_socket ps, const char *address, const char *serv, |
31 | struct addrinfo *bindhints); | 31 | struct addrinfo *bindhints); |
@@ -38,8 +38,13 @@ int inet_meth_getsockname(lua_State *L, p_socket ps, int family); | |||
38 | int inet_optfamily(lua_State* L, int narg, const char* def); | 38 | int inet_optfamily(lua_State* L, int narg, const char* def); |
39 | int inet_optsocktype(lua_State* L, int narg, const char* def); | 39 | int inet_optsocktype(lua_State* L, int narg, const char* def); |
40 | 40 | ||
41 | #ifdef INET_ATON | 41 | #ifdef LUASOCKET_INET_ATON |
42 | int inet_aton(const char *cp, struct in_addr *inp); | 42 | int inet_aton(const char *cp, struct in_addr *inp); |
43 | #endif | 43 | #endif |
44 | 44 | ||
45 | #ifdef LUASOCKET_INET_PTON | ||
46 | const char *inet_ntop(int af, const void *src, char *dst, socklen_t cnt); | ||
47 | int inet_pton(int af, const char *src, void *dst); | ||
48 | #endif | ||
49 | |||
45 | #endif /* INET_H */ | 50 | #endif /* INET_H */ |
diff --git a/src/makefile b/src/makefile index faf50fa..c44f4ef 100644 --- a/src/makefile +++ b/src/makefile | |||
@@ -12,7 +12,7 @@ | |||
12 | # | 12 | # |
13 | # make PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw | 13 | # make PLAT=linux DEBUG=DEBUG LUAV=5.2 prefix=/sw |
14 | 14 | ||
15 | # PLAT: linux macosx win32 | 15 | # PLAT: linux macosx win32 mingw |
16 | # platform to build for | 16 | # platform to build for |
17 | PLAT?=linux | 17 | PLAT?=linux |
18 | 18 | ||
@@ -33,6 +33,9 @@ LUAINC_macosx?=$(LUAINC_macosx_base)/lua/$(LUAV) | |||
33 | # FIXME default should this default to fink or to macports? | 33 | # FIXME default should this default to fink or to macports? |
34 | # What happens when more than one Lua version is installed? | 34 | # What happens when more than one Lua version is installed? |
35 | LUAPREFIX_macosx?=/opt/local | 35 | LUAPREFIX_macosx?=/opt/local |
36 | CDIR_macosx?=lib/lua/$(LUAV) | ||
37 | LDIR_macosx?=share/lua/$(LUAV) | ||
38 | |||
36 | 39 | ||
37 | # LUAINC_linux: | 40 | # LUAINC_linux: |
38 | # /usr/include/lua$(LUAV) | 41 | # /usr/include/lua$(LUAV) |
@@ -40,21 +43,41 @@ LUAPREFIX_macosx?=/opt/local | |||
40 | # /usr/local/include/lua$(LUAV) | 43 | # /usr/local/include/lua$(LUAV) |
41 | # where lua headers are found for linux builds | 44 | # where lua headers are found for linux builds |
42 | LUAINC_linux_base?=/usr/include | 45 | LUAINC_linux_base?=/usr/include |
43 | LUAINC_linux?=$(LUAINC_linux_base)/lua$(LUAV) | 46 | LUAINC_linux?=$(LUAINC_linux_base)/lua/$(LUAV) |
44 | LUAPREFIX_linux?=/usr/local | 47 | LUAPREFIX_linux?=/usr/local |
48 | CDIR_linux?=lib/lua/$(LUAV) | ||
49 | LDIR_linux?=share/lua/$(LUAV) | ||
50 | |||
51 | # where lua headers are found for mingw builds | ||
52 | # LUAINC_mingw: | ||
53 | # /opt/local/include | ||
54 | LUAINC_mingw_base?=/usr/include | ||
55 | LUAINC_mingw?=$(LUAINC_mingw_base)/lua/$(LUAV) | ||
56 | LUALIB_mingw_base?=/usr/bin | ||
57 | LUALIB_mingw?=$(LUALIB_mingw_base)/lua/$(LUAV)/lua$(subst .,,$(LUAV)).dll | ||
58 | LUAPREFIX_mingw?=/usr | ||
59 | CDIR_mingw?=lua/$(LUAV) | ||
60 | LDIR_mingw?=lua/$(LUAV)/lua | ||
61 | |||
45 | 62 | ||
46 | # LUAINC_win32: | 63 | # LUAINC_win32: |
47 | # LUALIB_win32: | 64 | # LUALIB_win32: |
48 | # where lua headers and libraries are found for win32 builds | 65 | # where lua headers and libraries are found for win32 builds |
49 | LUAINC_win32?="../../lua-5.1.3/src" | 66 | LUAINC_win32_base?= |
50 | LUALIB_win32?="../../lua-5.1.3" | 67 | LUAINC_win32?=$(LUAINC_win32_base)/lua/$(LUAV) |
68 | PLATFORM_win32?=Release | ||
51 | LUAPREFIX_win32?= | 69 | LUAPREFIX_win32?= |
52 | # FIXME default should be where lua-for-windows puts lua | 70 | CDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32) |
71 | LDIR_win32?=lua/$(LUAV)/$(PLATFORM_win32)/lua | ||
72 | LUALIB_win32?=$(LUAPREFIX_win32)/lua/$(LUAV)/$(PLATFORM_win32) | ||
53 | 73 | ||
54 | # prefix: /usr/local /usr /opt/local /sw | 74 | # prefix: /usr/local /usr /opt/local /sw |
55 | # the top of the default install tree | 75 | # the top of the default install tree |
56 | prefix?=$(LUAPREFIX_$(PLAT)) | 76 | prefix?=$(LUAPREFIX_$(PLAT)) |
57 | 77 | ||
78 | CDIR?=$(CDIR_$(PLAT)) | ||
79 | LDIR?=$(LDIR_$(PLAT)) | ||
80 | |||
58 | # DESTDIR: (no default) | 81 | # DESTDIR: (no default) |
59 | # used by package managers to install into a temporary destination | 82 | # used by package managers to install into a temporary destination |
60 | DESTDIR= | 83 | DESTDIR= |
@@ -63,13 +86,6 @@ DESTDIR= | |||
63 | # Definitions below can be overridden on the make command line, but | 86 | # Definitions below can be overridden on the make command line, but |
64 | # shouldn't have to be. | 87 | # shouldn't have to be. |
65 | 88 | ||
66 | print: | ||
67 | @echo PLAT=$(PLAT) | ||
68 | @echo LUAV=$(LUAV) | ||
69 | @echo DEBUG=$(DEBUG) | ||
70 | @echo prefix=$(prefix) | ||
71 | @echo LUAINC_$(PLAT)=$(LUAINC_$(PLAT)) | ||
72 | @echo LUALIB_$(PLAT)=$(LUALIB_$(PLAT)) | ||
73 | 89 | ||
74 | #------ | 90 | #------ |
75 | # Install directories | 91 | # Install directories |
@@ -80,18 +96,28 @@ INSTALL_DATA=install -m644 | |||
80 | INSTALL_EXEC=install | 96 | INSTALL_EXEC=install |
81 | INSTALL_TOP=$(DESTDIR)$(prefix) | 97 | INSTALL_TOP=$(DESTDIR)$(prefix) |
82 | 98 | ||
83 | INSTALL_TOP_SHARE=$(INSTALL_TOP)/share/lua/$(LUAV) | 99 | INSTALL_TOP_LDIR=$(INSTALL_TOP)/$(LDIR) |
84 | INSTALL_TOP_LIB=$(INSTALL_TOP)/lib/lua/$(LUAV) | 100 | INSTALL_TOP_CDIR=$(INSTALL_TOP)/$(CDIR) |
85 | 101 | ||
86 | INSTALL_SOCKET_SHARE=$(INSTALL_TOP_SHARE)/socket | 102 | INSTALL_SOCKET_LDIR=$(INSTALL_TOP_LDIR)/socket |
87 | INSTALL_SOCKET_LIB=$(INSTALL_TOP_LIB)/socket | 103 | INSTALL_SOCKET_CDIR=$(INSTALL_TOP_CDIR)/socket |
88 | INSTALL_MIME_SHARE=$(INSTALL_TOP_SHARE)/mime | 104 | INSTALL_MIME_LDIR=$(INSTALL_TOP_LDIR)/mime |
89 | INSTALL_MIME_LIB=$(INSTALL_TOP_LIB)/mime | 105 | INSTALL_MIME_CDIR=$(INSTALL_TOP_CDIR)/mime |
106 | |||
107 | print: | ||
108 | @echo PLAT=$(PLAT) | ||
109 | @echo LUAV=$(LUAV) | ||
110 | @echo DEBUG=$(DEBUG) | ||
111 | @echo prefix=$(prefix) | ||
112 | @echo LUAINC_$(PLAT)=$(LUAINC_$(PLAT)) | ||
113 | @echo LUALIB_$(PLAT)=$(LUALIB_$(PLAT)) | ||
114 | @echo INSTALL_TOP_CDIR=$(INSTALL_TOP_CDIR) | ||
115 | @echo INSTALL_TOP_LDIR=$(INSTALL_TOP_LDIR) | ||
90 | 116 | ||
91 | #------ | 117 | #------ |
92 | # Supported platforms | 118 | # Supported platforms |
93 | # | 119 | # |
94 | PLATS= macosx linux win32 | 120 | PLATS= macosx linux win32 mingw |
95 | 121 | ||
96 | #------ | 122 | #------ |
97 | # Compiler and linker settings | 123 | # Compiler and linker settings |
@@ -117,37 +143,53 @@ CC_linux=gcc | |||
117 | DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_COMPAT_MODULE \ | 143 | DEF_linux=-DLUASOCKET_$(DEBUG) -DLUA_COMPAT_MODULE \ |
118 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ | 144 | -DLUASOCKET_API='__attribute__((visibility("default")))' \ |
119 | -DMIME_API='__attribute__((visibility("default")))' | 145 | -DMIME_API='__attribute__((visibility("default")))' |
120 | CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra -Wimplicit -O2 -ggdb3 -fpic \ | 146 | CFLAGS_linux= -I$(LUAINC) $(DEF) -pedantic -Wall -Wshadow -Wextra \ |
121 | -fvisibility=hidden | 147 | -Wimplicit -O2 -ggdb3 -fpic -fvisibility=hidden |
122 | LDFLAGS_linux=-O -shared -fpic -o | 148 | LDFLAGS_linux=-O -shared -fpic -o |
123 | LD_linux=gcc | 149 | LD_linux=gcc |
124 | SOCKET_linux=usocket.o | 150 | SOCKET_linux=usocket.o |
125 | 151 | ||
126 | #------ | 152 | #------ |
127 | # Compiler and linker settings | 153 | # Compiler and linker settings |
154 | # for MingW | ||
155 | SO_mingw=dll | ||
156 | O_mingw=o | ||
157 | CC_mingw=gcc | ||
158 | DEF_mingw= -DLUASOCKET_INET_PTON -DLUASOCKET_$(DEBUG) -DLUA_COMPAT_MODULE \ | ||
159 | -DWINVER=0x0501 -DLUASOCKET_API='__declspec(dllexport)' \ | ||
160 | -DMIME_API='__declspec(dllexport)' | ||
161 | CFLAGS_mingw= -I$(LUAINC) $(DEF) -pedantic -Wall -O2 -fno-common \ | ||
162 | -fvisibility=hidden | ||
163 | LDFLAGS_mingw= $(LUALIB) -shared -Wl,-s -lwsock32 -lws2_32 -o | ||
164 | LD_mingw=gcc | ||
165 | SOCKET_mingw=wsocket.o | ||
166 | |||
167 | |||
168 | #------ | ||
169 | # Compiler and linker settings | ||
128 | # for Win32 | 170 | # for Win32 |
129 | SO_win32=dll | 171 | SO_win32=dll |
130 | O_win32=obj | 172 | O_win32=obj |
131 | CC_win32=cl | 173 | CC_win32=cl |
132 | DEF_win32= /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_USRDLL" \ | 174 | DEF_win32= //D "WIN32" //D "NDEBUG" //D "_WINDOWS" //D "_USRDLL" \ |
133 | /D "LUASOCKET_API=__declspec(dllexport)" /D "_CRT_SECURE_NO_WARNINGS" \ | 175 | //D "LUASOCKET_API=__declspec(dllexport)" //D "_CRT_SECURE_NO_WARNINGS" \ |
134 | /D "_WINDLL" /D "LUA_COMPAT_MODULE" /D "MIME_API=__declspec(dllexport)" \ | 176 | //D "_WINDLL" //D "LUA_COMPAT_MODULE" \ |
135 | /D "LUASOCKET_$(DEBUG)" | 177 | //D "MIME_API=__declspec(dllexport)" \ |
136 | CFLAGS_win32=/I "$(LUAINC)" $(DEF) /O2 /Ot /MD /W3 /nologo | 178 | //D "LUASOCKET_$(DEBUG)" |
137 | LDFLAGS_win32= /nologo /link /NOLOGO /DLL /INCREMENTAL:NO \ | 179 | CFLAGS_win32=//I "$(LUAINC)" $(DEF) //O2 //Ot //MD //W3 //nologo |
138 | /LIBPATH:"$(LUALIB)" \ | 180 | LDFLAGS_win32= //nologo //link //NOLOGO //DLL //INCREMENTAL:NO \ |
139 | /MANIFEST \ | 181 | //MANIFEST //MANIFESTFILE:"intermediate.manifest" \ |
140 | /MANIFESTFILE:"intermediate.manifest" \ | 182 | //MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ |
141 | /MANIFESTUAC:"level='asInvoker' uiAccess='false'" \ | 183 | //SUBSYSTEM:WINDOWS //OPT:REF //OPT:ICF //DYNAMICBASE:NO \ |
142 | /SUBSYSTEM:WINDOWS /OPT:REF /OPT:ICF /DYNAMICBASE:NO \ | 184 | //MACHINE:X86 /LIBPATH:"$(shell cmd //c echo $(LUALIB))" lua$(subst .,,$(LUAV)).lib \ |
143 | /MACHINE:X86 ws2_32.lib lua$(LUAV).lib /OUT: | 185 | wsock32.lib ws2_32.lib //OUT: |
144 | LD_win32=cl | 186 | LD_win32=cl |
145 | SOCKET_win32=wsocket.obj | 187 | SOCKET_win32=wsocket.obj |
146 | 188 | ||
147 | .SUFFIXES: .obj | 189 | .SUFFIXES: .obj |
148 | 190 | ||
149 | .c.obj: | 191 | .c.obj: |
150 | $(CC) $(CFLAGS) /Fo"$@" /c $< | 192 | $(CC) $(CFLAGS) //Fo"$@" //c $< |
151 | 193 | ||
152 | #------ | 194 | #------ |
153 | # Output file names | 195 | # Output file names |
@@ -223,7 +265,7 @@ SERIAL_OBJS:=\ | |||
223 | #------ | 265 | #------ |
224 | # Files to install | 266 | # Files to install |
225 | # | 267 | # |
226 | TO_SOCKET_SHARE= \ | 268 | TO_SOCKET_LDIR= \ |
227 | http.lua \ | 269 | http.lua \ |
228 | url.lua \ | 270 | url.lua \ |
229 | tp.lua \ | 271 | tp.lua \ |
@@ -231,7 +273,7 @@ TO_SOCKET_SHARE= \ | |||
231 | headers.lua \ | 273 | headers.lua \ |
232 | smtp.lua | 274 | smtp.lua |
233 | 275 | ||
234 | TO_TOP_SHARE= \ | 276 | TO_TOP_LDIR= \ |
235 | ltn12.lua \ | 277 | ltn12.lua \ |
236 | socket.lua \ | 278 | socket.lua \ |
237 | mime.lua | 279 | mime.lua |
@@ -250,6 +292,9 @@ win32: | |||
250 | linux: | 292 | linux: |
251 | $(MAKE) all-unix PLAT=linux | 293 | $(MAKE) all-unix PLAT=linux |
252 | 294 | ||
295 | mingw: | ||
296 | $(MAKE) all PLAT=mingw | ||
297 | |||
253 | none: | 298 | none: |
254 | @echo "Please run" | 299 | @echo "Please run" |
255 | @echo " make PLATFORM" | 300 | @echo " make PLATFORM" |
@@ -273,21 +318,21 @@ $(SERIAL_SO): $(SERIAL_OBJS) | |||
273 | $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@ | 318 | $(LD) $(SERIAL_OBJS) $(LDFLAGS)$@ |
274 | 319 | ||
275 | install: | 320 | install: |
276 | $(INSTALL_DIR) $(INSTALL_TOP_SHARE) | 321 | $(INSTALL_DIR) $(INSTALL_TOP_LDIR) |
277 | $(INSTALL_DATA) $(TO_TOP_SHARE) $(INSTALL_TOP_SHARE) | 322 | $(INSTALL_DATA) $(TO_TOP_LDIR) $(INSTALL_TOP_LDIR) |
278 | $(INSTALL_DIR) $(INSTALL_SOCKET_SHARE) | 323 | $(INSTALL_DIR) $(INSTALL_SOCKET_LDIR) |
279 | $(INSTALL_DATA) $(TO_SOCKET_SHARE) $(INSTALL_SOCKET_SHARE) | 324 | $(INSTALL_DATA) $(TO_SOCKET_LDIR) $(INSTALL_SOCKET_LDIR) |
280 | $(INSTALL_DIR) $(INSTALL_SOCKET_LIB) | 325 | $(INSTALL_DIR) $(INSTALL_SOCKET_CDIR) |
281 | $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_LIB)/core.$(SO) | 326 | $(INSTALL_EXEC) $(SOCKET_SO) $(INSTALL_SOCKET_CDIR)/core.$(SO) |
282 | $(INSTALL_DIR) $(INSTALL_MIME_LIB) | 327 | $(INSTALL_DIR) $(INSTALL_MIME_CDIR) |
283 | $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_LIB)/core.$(SO) | 328 | $(INSTALL_EXEC) $(MIME_SO) $(INSTALL_MIME_CDIR)/core.$(SO) |
284 | 329 | ||
285 | install-unix: install | 330 | install-unix: install |
286 | $(INSTALL_EXEC) $(UNIX_SO) $(INSTALL_SOCKET_LIB)/$(UNIX_SO) | 331 | $(INSTALL_EXEC) $(UNIX_SO) $(INSTALL_SOCKET_CDIR)/$(UNIX_SO) |
287 | $(INSTALL_EXEC) $(SERIAL_SO) $(INSTALL_SOCKET_LIB)/$(SERIAL_SO) | 332 | $(INSTALL_EXEC) $(SERIAL_SO) $(INSTALL_SOCKET_CDIR)/$(SERIAL_SO) |
288 | 333 | ||
289 | local: | 334 | local: |
290 | $(MAKE) install INSTALL_TOP_LIB=.. INSTALL_TOP_SHARE=.. | 335 | $(MAKE) install INSTALL_TOP_CDIR=.. INSTALL_TOP_LDIR=.. |
291 | 336 | ||
292 | clean: | 337 | clean: |
293 | rm -f $(SOCKET_SO) $(SOCKET_OBJS) $(SERIAL_OBJS) | 338 | rm -f $(SOCKET_SO) $(SOCKET_OBJS) $(SERIAL_OBJS) |
@@ -222,7 +222,6 @@ static int meth_bind(lua_State *L) | |||
222 | bindhints.ai_socktype = SOCK_STREAM; | 222 | bindhints.ai_socktype = SOCK_STREAM; |
223 | bindhints.ai_family = tcp->family; | 223 | bindhints.ai_family = tcp->family; |
224 | bindhints.ai_flags = AI_PASSIVE; | 224 | bindhints.ai_flags = AI_PASSIVE; |
225 | address = strcmp(address, "*")? address: NULL; | ||
226 | err = inet_trybind(&tcp->sock, address, port, &bindhints); | 225 | err = inet_trybind(&tcp->sock, address, port, &bindhints); |
227 | if (err) { | 226 | if (err) { |
228 | lua_pushnil(L); | 227 | lua_pushnil(L); |
@@ -248,7 +247,8 @@ static int meth_connect(lua_State *L) | |||
248 | /* make sure we try to connect only to the same family */ | 247 | /* make sure we try to connect only to the same family */ |
249 | connecthints.ai_family = tcp->family; | 248 | connecthints.ai_family = tcp->family; |
250 | timeout_markstart(&tcp->tm); | 249 | timeout_markstart(&tcp->tm); |
251 | err = inet_tryconnect(&tcp->sock, address, port, &tcp->tm, &connecthints); | 250 | err = inet_tryconnect(&tcp->sock, &tcp->family, address, port, |
251 | &tcp->tm, &connecthints); | ||
252 | /* have to set the class even if it failed due to non-blocking connects */ | 252 | /* have to set the class even if it failed due to non-blocking connects */ |
253 | auxiliar_setclass(L, "tcp{client}", 1); | 253 | auxiliar_setclass(L, "tcp{client}", 1); |
254 | if (err) { | 254 | if (err) { |
@@ -388,6 +388,7 @@ static int global_create6(lua_State *L) { | |||
388 | return tcp_create(L, AF_INET6); | 388 | return tcp_create(L, AF_INET6); |
389 | } | 389 | } |
390 | 390 | ||
391 | #if 0 | ||
391 | static const char *tryconnect6(const char *remoteaddr, const char *remoteserv, | 392 | static const char *tryconnect6(const char *remoteaddr, const char *remoteserv, |
392 | struct addrinfo *connecthints, p_tcp tcp) { | 393 | struct addrinfo *connecthints, p_tcp tcp) { |
393 | struct addrinfo *iterator = NULL, *resolved = NULL; | 394 | struct addrinfo *iterator = NULL, *resolved = NULL; |
@@ -402,8 +403,13 @@ static const char *tryconnect6(const char *remoteaddr, const char *remoteserv, | |||
402 | /* iterate over all returned addresses trying to connect */ | 403 | /* iterate over all returned addresses trying to connect */ |
403 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { | 404 | for (iterator = resolved; iterator; iterator = iterator->ai_next) { |
404 | p_timeout tm = timeout_markstart(&tcp->tm); | 405 | p_timeout tm = timeout_markstart(&tcp->tm); |
405 | /* create new socket if one wasn't created by the bind stage */ | 406 | /* create new socket if necessary. if there was no |
406 | if (tcp->sock == SOCKET_INVALID) { | 407 | * bind, we need to create one for every new family |
408 | * that shows up while iterating. if there was a | ||
409 | * bind, all families will be the same and we will | ||
410 | * not enter this branch. */ | ||
411 | if (tcp->family != iterator->ai_family) { | ||
412 | socket_destroy(&tcp->sock); | ||
407 | err = socket_strerror(socket_create(&tcp->sock, | 413 | err = socket_strerror(socket_create(&tcp->sock, |
408 | iterator->ai_family, iterator->ai_socktype, | 414 | iterator->ai_family, iterator->ai_socktype, |
409 | iterator->ai_protocol)); | 415 | iterator->ai_protocol)); |
@@ -427,6 +433,7 @@ static const char *tryconnect6(const char *remoteaddr, const char *remoteserv, | |||
427 | /* here, if err is set, we failed */ | 433 | /* here, if err is set, we failed */ |
428 | return err; | 434 | return err; |
429 | } | 435 | } |
436 | #endif | ||
430 | 437 | ||
431 | static int global_connect(lua_State *L) { | 438 | static int global_connect(lua_State *L) { |
432 | const char *remoteaddr = luaL_checkstring(L, 1); | 439 | const char *remoteaddr = luaL_checkstring(L, 1); |
@@ -444,6 +451,7 @@ static int global_connect(lua_State *L) { | |||
444 | timeout_init(&tcp->tm, -1, -1); | 451 | timeout_init(&tcp->tm, -1, -1); |
445 | buffer_init(&tcp->buf, &tcp->io, &tcp->tm); | 452 | buffer_init(&tcp->buf, &tcp->io, &tcp->tm); |
446 | tcp->sock = SOCKET_INVALID; | 453 | tcp->sock = SOCKET_INVALID; |
454 | tcp->family = PF_UNSPEC; | ||
447 | /* allow user to pick local address and port */ | 455 | /* allow user to pick local address and port */ |
448 | memset(&bindhints, 0, sizeof(bindhints)); | 456 | memset(&bindhints, 0, sizeof(bindhints)); |
449 | bindhints.ai_socktype = SOCK_STREAM; | 457 | bindhints.ai_socktype = SOCK_STREAM; |
@@ -463,7 +471,8 @@ static int global_connect(lua_State *L) { | |||
463 | connecthints.ai_socktype = SOCK_STREAM; | 471 | connecthints.ai_socktype = SOCK_STREAM; |
464 | /* make sure we try to connect only to the same family */ | 472 | /* make sure we try to connect only to the same family */ |
465 | connecthints.ai_family = bindhints.ai_family; | 473 | connecthints.ai_family = bindhints.ai_family; |
466 | err = tryconnect6(remoteaddr, remoteserv, &connecthints, tcp); | 474 | err = inet_tryconnect(&tcp->sock, &tcp->family, remoteaddr, remoteserv, |
475 | &tcp->tm, &connecthints); | ||
467 | if (err) { | 476 | if (err) { |
468 | socket_destroy(&tcp->sock); | 477 | socket_destroy(&tcp->sock); |
469 | lua_pushnil(L); | 478 | lua_pushnil(L); |
@@ -159,7 +159,7 @@ static int meth_sendto(lua_State *L) { | |||
159 | struct sockaddr_in addr; | 159 | struct sockaddr_in addr; |
160 | memset(&addr, 0, sizeof(addr)); | 160 | memset(&addr, 0, sizeof(addr)); |
161 | if (!inet_pton(AF_INET, ip, &addr.sin_addr)) | 161 | if (!inet_pton(AF_INET, ip, &addr.sin_addr)) |
162 | luaL_argerror(L, 3, "invalid ip address"); | 162 | luaL_argerror(L, 3, "invalid ip address"); |
163 | addr.sin_family = AF_INET; | 163 | addr.sin_family = AF_INET; |
164 | addr.sin_port = htons(port); | 164 | addr.sin_port = htons(port); |
165 | timeout_markstart(tm); | 165 | timeout_markstart(tm); |
@@ -171,7 +171,7 @@ static int meth_sendto(lua_State *L) { | |||
171 | struct sockaddr_in6 addr; | 171 | struct sockaddr_in6 addr; |
172 | memset(&addr, 0, sizeof(addr)); | 172 | memset(&addr, 0, sizeof(addr)); |
173 | if (!inet_pton(AF_INET6, ip, &addr.sin6_addr)) | 173 | if (!inet_pton(AF_INET6, ip, &addr.sin6_addr)) |
174 | luaL_argerror(L, 3, "invalid ip address"); | 174 | luaL_argerror(L, 3, "invalid ip address"); |
175 | addr.sin6_family = AF_INET6; | 175 | addr.sin6_family = AF_INET6; |
176 | addr.sin6_port = htons(port); | 176 | addr.sin6_port = htons(port); |
177 | timeout_markstart(tm); | 177 | timeout_markstart(tm); |
@@ -180,9 +180,9 @@ static int meth_sendto(lua_State *L) { | |||
180 | break; | 180 | break; |
181 | } | 181 | } |
182 | default: | 182 | default: |
183 | lua_pushnil(L); | 183 | lua_pushnil(L); |
184 | lua_pushfstring(L, "unknown family %d", udp->family); | 184 | lua_pushfstring(L, "unknown family %d", udp->family); |
185 | return 2; | 185 | return 2; |
186 | } | 186 | } |
187 | if (err != IO_DONE) { | 187 | if (err != IO_DONE) { |
188 | lua_pushnil(L); | 188 | lua_pushnil(L); |
@@ -259,19 +259,19 @@ static int meth_receivefrom(lua_State *L) { | |||
259 | (SA *) &addr, &addr_len, tm); | 259 | (SA *) &addr, &addr_len, tm); |
260 | /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ | 260 | /* Unlike TCP, recv() of zero is not closed, but a zero-length packet. */ |
261 | if (err == IO_CLOSED) | 261 | if (err == IO_CLOSED) |
262 | err = IO_DONE; | 262 | err = IO_DONE; |
263 | if (err == IO_DONE) { | 263 | if (err == IO_DONE) { |
264 | char addrstr[INET6_ADDRSTRLEN]; | 264 | char addrstr[INET6_ADDRSTRLEN]; |
265 | lua_pushlstring(L, buffer, got); | 265 | lua_pushlstring(L, buffer, got); |
266 | if (!inet_ntop(AF_INET6, &addr.sin6_addr, | 266 | if (!inet_ntop(AF_INET6, &addr.sin6_addr, |
267 | addrstr, sizeof(addrstr))) { | 267 | addrstr, sizeof(addrstr))) { |
268 | lua_pushnil(L); | 268 | lua_pushnil(L); |
269 | lua_pushstring(L, "invalid source address"); | 269 | lua_pushstring(L, "invalid source address"); |
270 | return 2; | 270 | return 2; |
271 | } | 271 | } |
272 | lua_pushstring(L, addrstr); | 272 | lua_pushstring(L, addrstr); |
273 | lua_pushnumber(L, ntohs(addr.sin6_port)); | 273 | lua_pushnumber(L, ntohs(addr.sin6_port)); |
274 | return 3; | 274 | return 3; |
275 | } | 275 | } |
276 | break; | 276 | break; |
277 | } | 277 | } |
@@ -376,7 +376,8 @@ static int meth_setpeername(lua_State *L) { | |||
376 | /* make sure we try to connect only to the same family */ | 376 | /* make sure we try to connect only to the same family */ |
377 | connecthints.ai_family = udp->family; | 377 | connecthints.ai_family = udp->family; |
378 | if (connecting) { | 378 | if (connecting) { |
379 | err = inet_tryconnect(&udp->sock, address, port, tm, &connecthints); | 379 | err = inet_tryconnect(&udp->sock, &udp->family, address, |
380 | port, tm, &connecthints); | ||
380 | if (err) { | 381 | if (err) { |
381 | lua_pushnil(L); | 382 | lua_pushnil(L); |
382 | lua_pushstring(L, err); | 383 | lua_pushstring(L, err); |
diff --git a/src/wsocket.c b/src/wsocket.c index d6dd004..65f76bc 100644 --- a/src/wsocket.c +++ b/src/wsocket.c | |||
@@ -400,13 +400,17 @@ const char *socket_gaistrerror(int err) { | |||
400 | case EAI_MEMORY: return "memory allocation failure"; | 400 | case EAI_MEMORY: return "memory allocation failure"; |
401 | case EAI_NONAME: | 401 | case EAI_NONAME: |
402 | return "host or service not provided, or not known"; | 402 | return "host or service not provided, or not known"; |
403 | // case EAI_OVERFLOW: return "argument buffer overflow"; | 403 | #ifdef EAI_OVERFLOW |
404 | case EAI_OVERFLOW: return "argument buffer overflow"; | ||
405 | #endif | ||
404 | #ifdef EAI_PROTOCOL | 406 | #ifdef EAI_PROTOCOL |
405 | case EAI_PROTOCOL: return "resolved protocol is unknown"; | 407 | case EAI_PROTOCOL: return "resolved protocol is unknown"; |
406 | #endif | 408 | #endif |
407 | case EAI_SERVICE: return "service not supported for socket type"; | 409 | case EAI_SERVICE: return "service not supported for socket type"; |
408 | case EAI_SOCKTYPE: return "ai_socktype not supported"; | 410 | case EAI_SOCKTYPE: return "ai_socktype not supported"; |
409 | // case EAI_SYSTEM: return strerror(errno); | 411 | #ifdef EAI_SYSTEM |
412 | case EAI_SYSTEM: return strerror(errno); | ||
413 | #endif | ||
410 | default: return gai_strerror(err); | 414 | default: return gai_strerror(err); |
411 | } | 415 | } |
412 | } | 416 | } |
diff --git a/src/wsocket.h b/src/wsocket.h index 0783b00..8fbc54d 100644 --- a/src/wsocket.h +++ b/src/wsocket.h | |||
@@ -16,6 +16,10 @@ typedef SOCKADDR_STORAGE t_sockaddr_storage; | |||
16 | typedef SOCKET t_socket; | 16 | typedef SOCKET t_socket; |
17 | typedef t_socket *p_socket; | 17 | typedef t_socket *p_socket; |
18 | 18 | ||
19 | #ifndef IPV6_V6ONLY | ||
20 | #define IPV6_V6ONLY 27 | ||
21 | #endif | ||
22 | |||
19 | #define SOCKET_INVALID (INVALID_SOCKET) | 23 | #define SOCKET_INVALID (INVALID_SOCKET) |
20 | 24 | ||
21 | #ifndef SO_REUSEPORT | 25 | #ifndef SO_REUSEPORT |
diff --git a/test/test_bind.lua b/test/test_bind.lua new file mode 100644 index 0000000..93c42d7 --- /dev/null +++ b/test/test_bind.lua | |||
@@ -0,0 +1,6 @@ | |||
1 | local socket = require "socket" | ||
2 | local u = socket.udp() assert(u:setsockname("*", 5088)) u:close() | ||
3 | local u = socket.udp() assert(u:setsockname("*", 0)) u:close() | ||
4 | local t = socket.tcp() assert(t:bind("*", 5088)) t:close() | ||
5 | local t = socket.tcp() assert(t:bind("*", 0)) t:close() | ||
6 | print("done!") \ No newline at end of file | ||
diff --git a/test/test_getaddrinfo.lua b/test/test_getaddrinfo.lua new file mode 100644 index 0000000..4b52ff9 --- /dev/null +++ b/test/test_getaddrinfo.lua | |||
@@ -0,0 +1,15 @@ | |||
1 | local socket = require "socket" | ||
2 | local addresses = assert(socket.dns.getaddrinfo("localhost")) | ||
3 | assert(type(addresses) == 'table') | ||
4 | |||
5 | local ipv4mask = "^%d%d?%d?%.%d%d?%d?%.%d%d?%d?%.%d%d?%d?$" | ||
6 | |||
7 | for i, alt in ipairs(addresses) do | ||
8 | if alt.family == 'inet' then | ||
9 | assert(type(alt.addr) == 'string') | ||
10 | assert(alt.addr:find(ipv4mask)) | ||
11 | assert(alt.addr == '127.0.0.1') | ||
12 | end | ||
13 | end | ||
14 | |||
15 | print("done!") | ||
diff --git a/test/testclnt.lua b/test/testclnt.lua index 8acb3d0..315783b 100644 --- a/test/testclnt.lua +++ b/test/testclnt.lua | |||
@@ -642,7 +642,10 @@ local tcp_methods = { | |||
642 | "shutdown", | 642 | "shutdown", |
643 | } | 643 | } |
644 | test_methods(socket.tcp(), tcp_methods) | 644 | test_methods(socket.tcp(), tcp_methods) |
645 | test_methods(socket.tcp6(), tcp_methods) | 645 | do local sock = socket.tcp6() |
646 | if sock then test_methods(socket.tcp6(), tcp_methods) | ||
647 | else io.stderr:write("Warning! IPv6 does not support!\n") end | ||
648 | end | ||
646 | 649 | ||
647 | local udp_methods = { | 650 | local udp_methods = { |
648 | "close", | 651 | "close", |
@@ -666,7 +669,10 @@ local udp_methods = { | |||
666 | 669 | ||
667 | ------------------------------------------------------------------------ | 670 | ------------------------------------------------------------------------ |
668 | test_methods(socket.udp(), udp_methods) | 671 | test_methods(socket.udp(), udp_methods) |
669 | test_methods(socket.udp6(), udp_methods) | 672 | do local sock = socket.tcp6() |
673 | if sock then test_methods(socket.udp6(), udp_methods) | ||
674 | else io.stderr:write("Warning! IPv6 does not support!\n") end | ||
675 | end | ||
670 | 676 | ||
671 | test("partial receive") | 677 | test("partial receive") |
672 | test_partialrecv() | 678 | test_partialrecv() |
diff --git a/win32.cmd b/win32.cmd new file mode 100644 index 0000000..48522f0 --- /dev/null +++ b/win32.cmd | |||
@@ -0,0 +1,12 @@ | |||
1 | make PLAT=win32 LUAV=5.2 LUAINC_win32='c:\cygwin\home\diego\build\include' LUALIB_win32='c:\cygwin\home\diego\build\bin\release' | ||
2 | |||
3 | #!/bin/sh | ||
4 | for p in Release Debug x64/Release x64/Debug; do | ||
5 | for el in mime socket; do | ||
6 | for e in dll lib; do | ||
7 | cp $p/$el/core.$e ../bin/$p/$el/ | ||
8 | done; | ||
9 | done; | ||
10 | cp src/ltn12.lua src/socket.lua src/mime.lua ../bin/$p/ | ||
11 | cp src/http.lua src/url.lua src/tp.lua src/ftp.lua src/headers.lua src/smtp.lua ../bin/$p/socket/ | ||
12 | done; | ||