diff --git a/FtpStack-vs2017.sln b/FtpStack-vs2017.sln new file mode 100644 index 0000000..1ce85f5 --- /dev/null +++ b/FtpStack-vs2017.sln @@ -0,0 +1,55 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27130.2036 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SipPlatform", "SipPlatform\SipPlatform.vcxproj", "{59766094-16E8-4602-9621-6C1E5ED9AF5F}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FtpStack", "FtpStack\FtpStack.vcxproj", "{43730EBE-33BF-4B5E-A136-CCB4E4E2699D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestFtpStack", "TestFtpStack\TestFtpStack.vcxproj", "{7849B34F-8453-4F75-A1F3-0DF2CDD87987}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestFtpStack2", "TestFtpStack2\TestFtpStack2.vcxproj", "{4F894974-8E06-4756-8558-FFA1BF81F41D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Debug|Win32.ActiveCfg = Debug|Win32 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Debug|Win32.Build.0 = Debug|Win32 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Debug|x64.ActiveCfg = Debug|x64 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Debug|x64.Build.0 = Debug|x64 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Release|Win32.ActiveCfg = Release|Win32 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Release|Win32.Build.0 = Release|Win32 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Release|x64.ActiveCfg = Release|x64 + {59766094-16E8-4602-9621-6C1E5ED9AF5F}.Release|x64.Build.0 = Release|x64 + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D}.Debug|Win32.ActiveCfg = Debug|Win32 + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D}.Debug|Win32.Build.0 = Debug|Win32 + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D}.Debug|x64.ActiveCfg = Debug|Win32 + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D}.Release|Win32.ActiveCfg = Release|Win32 + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D}.Release|Win32.Build.0 = Release|Win32 + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D}.Release|x64.ActiveCfg = Release|Win32 + {7849B34F-8453-4F75-A1F3-0DF2CDD87987}.Debug|Win32.ActiveCfg = Debug|Win32 + {7849B34F-8453-4F75-A1F3-0DF2CDD87987}.Debug|Win32.Build.0 = Debug|Win32 + {7849B34F-8453-4F75-A1F3-0DF2CDD87987}.Debug|x64.ActiveCfg = Debug|Win32 + {7849B34F-8453-4F75-A1F3-0DF2CDD87987}.Release|Win32.ActiveCfg = Release|Win32 + {7849B34F-8453-4F75-A1F3-0DF2CDD87987}.Release|Win32.Build.0 = Release|Win32 + {7849B34F-8453-4F75-A1F3-0DF2CDD87987}.Release|x64.ActiveCfg = Release|Win32 + {4F894974-8E06-4756-8558-FFA1BF81F41D}.Debug|Win32.ActiveCfg = Debug|Win32 + {4F894974-8E06-4756-8558-FFA1BF81F41D}.Debug|Win32.Build.0 = Debug|Win32 + {4F894974-8E06-4756-8558-FFA1BF81F41D}.Debug|x64.ActiveCfg = Debug|Win32 + {4F894974-8E06-4756-8558-FFA1BF81F41D}.Release|Win32.ActiveCfg = Release|Win32 + {4F894974-8E06-4756-8558-FFA1BF81F41D}.Release|Win32.Build.0 = Release|Win32 + {4F894974-8E06-4756-8558-FFA1BF81F41D}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {2B797396-FFBF-4FDF-8610-5356311095D9} + EndGlobalSection +EndGlobal diff --git a/FtpStack/FtpStack.vcxproj b/FtpStack/FtpStack.vcxproj new file mode 100644 index 0000000..3241916 --- /dev/null +++ b/FtpStack/FtpStack.vcxproj @@ -0,0 +1,100 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {43730EBE-33BF-4B5E-A136-CCB4E4E2699D} + FtpStack + Win32Proj + 10.0.16299.0 + + + + StaticLibrary + v141 + MultiByte + true + + + StaticLibrary + v141 + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27130.2020 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + + + + Disabled + ../SipPlatform;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + + + + MaxSpeed + true + ../SipPlatform;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + MultiThreaded + true + + Level3 + ProgramDatabase + + + + + + + + + + + + + + + + + + {59766094-16e8-4602-9621-6c1e5ed9af5f} + false + + + + + + \ No newline at end of file diff --git a/FtpStack/FtpStack.vcxproj.filters b/FtpStack/FtpStack.vcxproj.filters new file mode 100644 index 0000000..4a56b04 --- /dev/null +++ b/FtpStack/FtpStack.vcxproj.filters @@ -0,0 +1,42 @@ + + + + + {c25d7c48-a267-426b-baad-d2ef1fa7ed69} + + + {b18bbac0-01f6-4b52-ac43-3e78cdc25532} + + + + + FTP Client + + + FTP + + + FTP + + + + + FTP Client + + + FTP Client + + + FTP Client + + + FTP Client + + + FTP + + + FTP + + + \ No newline at end of file diff --git a/SipPlatform/FileLog.cpp b/SipPlatform/FileLog.cpp index 6e82191..c72b3d3 100644 --- a/SipPlatform/FileLog.cpp +++ b/SipPlatform/FileLog.cpp @@ -221,10 +221,10 @@ bool CFileLog::Print( EnumLogLevel iLevel, const char * fmt, ... ) int iWrite; #ifdef WIN32 - iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%u] %s\r\n" + iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%X] %s\r\n" , sttTm.tm_hour, sttTm.tm_min, sttTm.tm_sec, sttTime.tv_usec, szHeader, GetCurrentThreadId(), szBuf ); #else - iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%lu] %s\n" + iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%lX] %s\n" , sttTm.tm_hour, sttTm.tm_min, sttTm.tm_sec, (unsigned int)sttTime.tv_usec, szHeader, (unsigned long)pthread_self(), szBuf ); #endif fflush( m_sttFd ); diff --git a/SipPlatform/Log.cpp b/SipPlatform/Log.cpp index e8a5289..f7d36bc 100644 --- a/SipPlatform/Log.cpp +++ b/SipPlatform/Log.cpp @@ -241,10 +241,10 @@ int CLog::Print( EnumLogLevel iLevel, const char * fmt, ... ) int iWrite; #ifdef WIN32 - iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%u] %s\r\n" + iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%X] %s\r\n" , sttTm.tm_hour, sttTm.tm_min, sttTm.tm_sec, sttTime.tv_usec, szHeader, GetCurrentThreadId(), szBuf ); #else - iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%lu] %s\n" + iWrite = fprintf( m_sttFd, "[%02d:%02d:%02d.%06u] %s[%lX] %s\n" , sttTm.tm_hour, sttTm.tm_min, sttTm.tm_sec, (unsigned int)sttTime.tv_usec, szHeader, (unsigned long)pthread_self(), szBuf ); #endif fflush( m_sttFd ); diff --git a/SipPlatform/SipPlatform.vcxproj b/SipPlatform/SipPlatform.vcxproj index 1bb1a5c..1f9a178 100644 --- a/SipPlatform/SipPlatform.vcxproj +++ b/SipPlatform/SipPlatform.vcxproj @@ -64,7 +64,7 @@ - <_ProjectFileVersion>15.0.27130.2010 + <_ProjectFileVersion>15.0.27130.2020 $(SolutionDir)$(Configuration)\ diff --git a/TestFtpStack/TestFtpStack.cpp b/TestFtpStack/TestFtpStack.cpp index 0c8ec2c..9a212a5 100644 --- a/TestFtpStack/TestFtpStack.cpp +++ b/TestFtpStack/TestFtpStack.cpp @@ -2,13 +2,13 @@ void PrintUsage( const char * pszProgram ) { - printf( "[Usage] %s {ftp IP} {user id} {password} upload {remote folder path} {local file path}\n", pszProgram ); - printf( " %s {ftp IP} {user id} {password} upload_folder {remote folder path} {local folder path}\n", pszProgram ); - printf( " %s {ftp IP} {user id} {password} download {remote folder path} {remote filename} {local file path}\n", pszProgram ); - printf( " %s {ftp IP} {user id} {password} get_folder\n", pszProgram ); - printf( " %s {ftp IP} {user id} {password} create_folder {remote folder path}\n", pszProgram ); - printf( " %s {ftp IP} {user id} {password} delete_folder {remote folder path}\n", pszProgram ); - printf( " %s {ftp IP} {user id} {password} list\n", pszProgram ); + printf( "[Usage] %s {ftp IP} {ftp port:21} {user id} {password} upload {remote folder path} {local file path}\n", pszProgram ); + printf( " %s {ftp IP} {ftp port:21} {user id} {password} upload_folder {remote folder path} {local folder path}\n", pszProgram ); + printf( " %s {ftp IP} {ftp port:21} {user id} {password} download {remote folder path} {remote filename} {local file path}\n", pszProgram ); + printf( " %s {ftp IP} {ftp port:21} {user id} {password} get_folder\n", pszProgram ); + printf( " %s {ftp IP} {ftp port:21} {user id} {password} create_folder {remote folder path}\n", pszProgram ); + printf( " %s {ftp IP} {ftp port:21} {user id} {password} delete_folder {remote folder path}\n", pszProgram ); + printf( " %s {ftp IP} {ftp port:21} {user id} {password} list\n", pszProgram ); } int main( int argc, char * argv[] ) @@ -17,16 +17,17 @@ int main( int argc, char * argv[] ) _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_CHECK_ALWAYS_DF ); #endif - if( argc < 5 ) + if( argc < 6 ) { PrintUsage( argv[0] ); return 0; } const char * pszServerIp = argv[1]; - const char * pszUserId = argv[2]; - const char * pszPassWord = argv[3]; - const char * pszCommand = argv[4]; + int iServerPort = atoi( argv[2] ); + const char * pszUserId = argv[3]; + const char * pszPassWord = argv[4]; + const char * pszCommand = argv[5]; CFtpClient clsFtp; @@ -34,7 +35,7 @@ int main( int argc, char * argv[] ) CLog::SetLevel( LOG_DEBUG | LOG_NETWORK ); // FTP α - if( clsFtp.Connect( pszServerIp, 21, true ) == false ) + if( clsFtp.Connect( pszServerIp, iServerPort, true ) == false ) { printf( "clsFtp.Connect(%s) error\n", pszServerIp ); return 0; @@ -49,14 +50,14 @@ int main( int argc, char * argv[] ) if( !strcmp( pszCommand, "upload" ) ) { // FTP ε - if( argc < 7 ) + if( argc < 8 ) { PrintUsage( argv[0] ); return 0; } - const char * pszRemoteFolder = argv[5]; - const char * pszLocalPath = argv[6]; + const char * pszRemoteFolder = argv[6]; + const char * pszLocalPath = argv[7]; if( clsFtp.ChangeFolder( pszRemoteFolder ) == false ) { @@ -73,14 +74,14 @@ int main( int argc, char * argv[] ) else if( !strcmp( pszCommand, "upload_folder" ) ) { // Ե FTP ε - if( argc < 7 ) + if( argc < 8 ) { PrintUsage( argv[0] ); return 0; } - const char * pszRemoteFolder = argv[5]; - const char * pszLocalFolder = argv[6]; + const char * pszRemoteFolder = argv[6]; + const char * pszLocalFolder = argv[7]; FILE_LIST clsFileList; FILE_LIST::iterator itFL; @@ -107,15 +108,15 @@ int main( int argc, char * argv[] ) else if( !strcmp( pszCommand, "download" ) ) { // FTP ٿε - if( argc < 8 ) + if( argc < 9 ) { PrintUsage( argv[0] ); return 0; } - const char * pszRemoteFolder = argv[5]; - const char * pszRemoteFile = argv[6]; - const char * pszLocalPath = argv[7]; + const char * pszRemoteFolder = argv[6]; + const char * pszRemoteFile = argv[7]; + const char * pszLocalPath = argv[8]; if( clsFtp.ChangeFolder( pszRemoteFolder ) == false ) { @@ -145,13 +146,13 @@ int main( int argc, char * argv[] ) else if( !strcmp( pszCommand, "create_folder" ) ) { // FTP ϱ - if( argc < 6 ) + if( argc < 7 ) { PrintUsage( argv[0] ); return 0; } - const char * pszRemoteFolder = argv[5]; + const char * pszRemoteFolder = argv[6]; if( clsFtp.CreateFolder( pszRemoteFolder ) == false ) { @@ -178,13 +179,13 @@ int main( int argc, char * argv[] ) else if( !strcmp( pszCommand, "delete_folder" ) ) { // FTP ϱ - if( argc < 6 ) + if( argc < 7 ) { PrintUsage( argv[0] ); return 0; } - const char * pszRemoteFolder = argv[5]; + const char * pszRemoteFolder = argv[6]; if( clsFtp.DeleteFolder( pszRemoteFolder ) == false ) { @@ -194,6 +195,17 @@ int main( int argc, char * argv[] ) } else if( !strcmp( pszCommand, "list" ) ) { + if( argc >= 7 ) + { + const char * pszRemoteFolder = argv[6]; + + if( clsFtp.ChangeFolder( pszRemoteFolder ) == false ) + { + printf( "clsFtp.ChangeFolder(%s) error\n", pszRemoteFolder ); + return 0; + } + } + // FTP Ե Ʈ ϱ FTP_FILE_LIST clsList; FTP_FILE_LIST::iterator itFL; diff --git a/TestFtpStack/TestFtpStack.vcxproj b/TestFtpStack/TestFtpStack.vcxproj new file mode 100644 index 0000000..69550d7 --- /dev/null +++ b/TestFtpStack/TestFtpStack.vcxproj @@ -0,0 +1,111 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {7849B34F-8453-4F75-A1F3-0DF2CDD87987} + TestFtpStack + Win32Proj + 10.0.16299.0 + + + + Application + v141 + MultiByte + true + + + Application + v141 + MultiByte + + + + + + + + + + + + + <_ProjectFileVersion>15.0.27130.2020 + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + true + + + $(SolutionDir)$(Configuration)\ + $(Configuration)\ + false + + + + Disabled + ../FtpStack;../SipPlatform;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebug + + Level3 + EditAndContinue + + + true + Console + MachineX86 + + + + + MaxSpeed + true + ../FtpStack;../SipPlatform;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + MultiThreaded + true + + Level3 + ProgramDatabase + + + true + Console + true + true + MachineX86 + + + + + + + + + + + {43730ebe-33bf-4b5e-a136-ccb4e4e2699d} + false + + + {59766094-16e8-4602-9621-6c1e5ed9af5f} + false + + + + + + \ No newline at end of file diff --git a/TestFtpStack/TestFtpStack.vcxproj.filters b/TestFtpStack/TestFtpStack.vcxproj.filters new file mode 100644 index 0000000..9163e2b --- /dev/null +++ b/TestFtpStack/TestFtpStack.vcxproj.filters @@ -0,0 +1,19 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + 소스 파일 + + + + + 소스 파일 + + + \ No newline at end of file diff --git a/TestFtpStack2/TestFtpStack2.vcproj b/TestFtpStack2/TestFtpStack2.vcproj index 4578288..333e142 100644 --- a/TestFtpStack2/TestFtpStack2.vcproj +++ b/TestFtpStack2/TestFtpStack2.vcproj @@ -21,7 +21,7 @@ OutputDirectory="$(SolutionDir)$(ConfigurationName)" IntermediateDirectory="$(ConfigurationName)" ConfigurationType="1" - CharacterSet="1" + CharacterSet="2" >