├── Changelog
├── FTPKit Tests
├── FTPKit Tests-Info.plist
├── FTPKit Tests-Prefix.pch
├── FTPKit_Tests.m
└── en.lproj
│ └── InfoPlist.strings
├── FTPKit.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ ├── xcshareddata
│ │ └── FTPKit.xccheckout
│ └── xcuserdata
│ │ └── eric.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ └── eric.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints_v2.xcbkptlist
│ └── xcschemes
│ ├── FTPKit.xcscheme
│ └── xcschememanagement.plist
├── FTPKit
├── Categories
│ ├── NSError+Additions.h
│ ├── NSError+Additions.m
│ ├── NSString+Additions.h
│ └── NSString+Additions.m
├── FTPClient.h
├── FTPClient.m
├── FTPCredentials.h
├── FTPCredentials.m
├── FTPHandle.h
├── FTPHandle.m
├── FTPKit-Prefix.pch
├── FTPKit.h
└── Protected
│ └── FTPKit+Protected.h
├── LICENSE
├── Libraries
└── include
│ └── ftplib
│ ├── CHANGES
│ ├── LICENSE
│ ├── README.ftplib-4.0
│ ├── README.qftp
│ ├── RFC959.txt
│ ├── additional_rfcs
│ ├── html
│ ├── FtpAccess.html
│ ├── FtpCDUp.html
│ ├── FtpChdir.html
│ ├── FtpClearCallback.html
│ ├── FtpClose.html
│ ├── FtpConnect.html
│ ├── FtpDelete.html
│ ├── FtpDir.html
│ ├── FtpGet.html
│ ├── FtpInit.html
│ ├── FtpLastResponse.html
│ ├── FtpLogin.html
│ ├── FtpMkdir.html
│ ├── FtpModDate.html
│ ├── FtpNlst.html
│ ├── FtpOptions.html
│ ├── FtpPut.html
│ ├── FtpPwd.html
│ ├── FtpQuit.html
│ ├── FtpRead.html
│ ├── FtpRename.html
│ ├── FtpRmdir.html
│ ├── FtpSetCallback.html
│ ├── FtpSite.html
│ ├── FtpSize.html
│ ├── FtpSizeLong.html
│ ├── FtpSysType.html
│ ├── FtpWrite.html
│ ├── doc.css
│ ├── ftplib.html
│ ├── index.html
│ └── qftp.html
│ └── src
│ ├── Makefile
│ ├── README
│ ├── descrip.mms
│ ├── ftplib.c
│ ├── ftplib.h
│ ├── ftplib.opt
│ ├── ftplib_alpha.opt
│ ├── ftplib_ia64.opt
│ ├── ftplib_vector.mar
│ ├── qftp.c
│ ├── qftp.opt
│ ├── qftp_alpha.opt
│ └── qftp_ia64.opt
├── README.md
└── Sample
└── FTPKitSample
├── FTPKitSample.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── eric.xcuserdatad
│ │ └── UserInterfaceState.xcuserstate
└── xcuserdata
│ └── eric.xcuserdatad
│ └── xcschemes
│ ├── FTPKitSample.xcscheme
│ └── xcschememanagement.plist
├── FTPKitSample
├── AppDelegate.h
├── AppDelegate.m
├── FTPKitSample-Info.plist
├── FTPKitSample-Prefix.pch
├── Images.xcassets
│ ├── AppIcon.appiconset
│ │ └── Contents.json
│ └── LaunchImage.launchimage
│ │ └── Contents.json
├── MainViewController.h
├── MainViewController.m
├── Tests
│ ├── GeneralTest.h
│ ├── GeneralTest.m
│ ├── HandleTest.h
│ ├── HandleTest.m
│ ├── PerformanceTest.h
│ ├── PerformanceTest.m
│ ├── TestCase.h
│ └── TestCase.m
├── en.lproj
│ └── InfoPlist.strings
└── main.m
└── FTPKitSampleTests
├── FTPKitSampleTests-Info.plist
├── FTPKitSampleTests.m
└── en.lproj
└── InfoPlist.strings
/Changelog:
--------------------------------------------------------------------------------
1 | Weid, Nov 12 2014 -- v1.3.1
2 | ========================================
3 | Fixed
4 | + Server error messages are now being captured and returned, rather than
5 | guessing what the error is.
6 |
7 | Sun, May 25 2014 -- v1.3.0
8 | ========================================
9 | New
10 | + It is no longer necessary to URL encode paths before making calls to library;
11 | as all paths are now URL encoded internally.
12 |
--------------------------------------------------------------------------------
/FTPKit Tests/FTPKit Tests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.upstart-illustration-llc.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/FTPKit Tests/FTPKit Tests-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #ifdef __OBJC__
8 | #import
9 | #import
10 | #endif
11 |
--------------------------------------------------------------------------------
/FTPKit Tests/FTPKit_Tests.m:
--------------------------------------------------------------------------------
1 | //
2 | // FTPKit_Tests.m
3 | // FTPKit Tests
4 | //
5 | // Created by Eric Chamberlain on 3/7/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "FTPKit.h"
11 | #import "FTPKit+Protected.h"
12 |
13 | @interface FTPKit_Tests : XCTestCase
14 |
15 | @end
16 |
17 | @implementation FTPKit_Tests
18 |
19 | - (void)setUp
20 | {
21 | [super setUp];
22 | // Put setup code here. This method is called before the invocation of each test method in the class.
23 | }
24 |
25 | - (void)tearDown
26 | {
27 | // Put teardown code here. This method is called after the invocation of each test method in the class.
28 | [super tearDown];
29 | }
30 |
31 | - (void)testNSError
32 | {
33 |
34 | }
35 |
36 | - (void)testNSURL
37 | {
38 |
39 | }
40 |
41 | - (void)testFtp
42 | {
43 | FTPClient * ftp = [[FTPClient alloc] initWithHost:@"localhost" port:21 username:@"unittest" password:@"unitpass"];
44 |
45 | // Sanity. Make sure the root path exists. This should always be true.
46 | BOOL success = [ftp directoryExistsAtPath:@"/"];
47 | XCTAssertTrue(success, @"");
48 |
49 | NSArray *contents = [ftp listContentsAtPath:@"/test" showHiddenFiles:YES];
50 | //XCTAssertNil(contents, @"Directory should not exist");
51 | XCTAssertEqual(0, contents.count, @"");
52 |
53 | long long int bytes = [ftp fileSizeAtPath:@"/ftplib.tgz"];
54 | XCTAssertTrue((bytes > 0), @"");
55 |
56 | bytes = [ftp fileSizeAtPath:@"/copy.tgz"];
57 | XCTAssertEqual(-1, -1, @"");
58 |
59 | // Create 'test1.txt' file to upload. Contents are 'testing 1'.
60 | NSURL *localUrl = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:@"ftplib.tgz"];
61 |
62 | // Download 'ftplib.tgz'
63 | success = [ftp downloadFile:@"/ftplib.tgz" to:localUrl.path progress:NULL];
64 | XCTAssertTrue(success, @"");
65 |
66 | // Upload 'ftplib.tgz' as 'copy.tgz'
67 | success = [ftp uploadFile:localUrl.path to:@"/copy.tgz" progress:NULL];
68 | XCTAssertTrue(success, @"");
69 |
70 | // chmod 'copy.tgz' to 777
71 | success = [ftp chmodPath:@"/copy.tgz" toMode:777];
72 | XCTAssertTrue(success, @"");
73 |
74 | // Create directory 'test'
75 | success = [ftp createDirectoryAtPath:@"/test"];
76 | XCTAssertTrue(success, @"");
77 |
78 | NSDate *date = [ftp lastModifiedAtPath:@"/ftplib.tgz"];
79 | NSLog(@"date %@", date);
80 | XCTAssertNotNil(date, @"");
81 | // @todo
82 |
83 | BOOL exists = [ftp directoryExistsAtPath:@"/test"];
84 | XCTAssertTrue(exists, @"");
85 |
86 | exists = [ftp directoryExistsAtPath:@"/badpath"];
87 | XCTAssertFalse(exists, @"");
88 |
89 | bytes = [ftp fileSizeAtPath:@"/badpath.txt"];
90 | XCTAssertEqual(-1, bytes, @"");
91 |
92 | // chmod 'test' to 777
93 | success = [ftp chmodPath:@"/test" toMode:777];
94 | XCTAssertTrue(success, @"");
95 |
96 | // List contents of 'test'
97 | contents = [ftp listContentsAtPath:@"/test" showHiddenFiles:YES];
98 |
99 | // - Make sure there are no contents.
100 | XCTAssertEqual(0, contents.count, @"There should be no contents");
101 |
102 | // Move 'copy.tgz' to 'test' directory
103 | success = [ftp renamePath:@"/copy.tgz" to:@"/test/copy.tgz"];
104 | XCTAssertTrue(success, @"");
105 |
106 | // Copy 'copy.tgz' to 'copy2.tgz'
107 | success = [ftp copyPath:@"/test/copy.tgz" to:@"/test/copy2.tgz"];
108 | XCTAssertTrue(success, @"");
109 |
110 | // Create '/test/test2' directory
111 | success = [ftp createDirectoryAtPath:@"/test/test2"];
112 | XCTAssertTrue(success, @"");
113 |
114 | NSString *cwd = [ftp printWorkingDirectory];
115 | XCTAssertTrue([cwd isEqualToString:@"/"], @"");
116 |
117 | // Change directory to /test
118 | success = [ftp changeDirectoryToPath:@"/test"];
119 | XCTAssertTrue(success, @"");
120 |
121 | /**
122 | Currently the connection is not left open between calls and therefore we
123 | will always be put back to the root directory when each command is sent.
124 |
125 | Uncomment this when the same connection is used between commands.
126 |
127 | // Make sure we are still in /test.
128 | cwd = [ftp printWorkingDirectory];
129 | NSLog(@"cwd is %@", cwd);
130 | XCTAssertTrue([cwd isEqualToString:@"/test"], @"");
131 | */
132 |
133 | // List contents of 'test'
134 | contents = [ftp listContentsAtPath:@"/test" showHiddenFiles:YES];
135 |
136 | // - Should have 'copy.tgz' (a file) and 'test2' (a directory)
137 | // @todo make sure they are the files we requested, including the correct
138 | // file type.
139 | XCTAssertEqual(3, contents.count, @"");
140 |
141 | // Delete 'test'. It should fail as there are contents in the directory.
142 | success = [ftp deleteDirectoryAtPath:@"/test"];
143 | XCTAssertFalse(success, @"Directory has contents");
144 |
145 | // Delete 'test2', 'copy.tgz' and then 'test'. All operations should succeed.
146 | success = [ftp deleteFileAtPath:@"/test/copy.tgz"];
147 | XCTAssertTrue(success, @"");
148 | success = [ftp deleteFileAtPath:@"/test/copy2.tgz"];
149 | XCTAssertTrue(success, @"");
150 | success = [ftp deleteDirectoryAtPath:@"/test/test2"];
151 | XCTAssertTrue(success, @"");
152 | success = [ftp deleteDirectoryAtPath:@"/test"];
153 | XCTAssertTrue(success, @"");
154 |
155 | //XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
156 | }
157 |
158 | @end
159 |
--------------------------------------------------------------------------------
/FTPKit Tests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 072A829B18CC2450001E640B /* NSError+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 072A829818CC2450001E640B /* NSError+Additions.m */; };
11 | 072A829C18CC2450001E640B /* NSString+Additions.m in Sources */ = {isa = PBXBuildFile; fileRef = 072A829A18CC2450001E640B /* NSString+Additions.m */; };
12 | 074A7B5218CAC98F00A03068 /* libFTPKit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = F27BA1CE1802FE7E00584A9E /* libFTPKit.a */; };
13 | 076BD40018CD18CC00517DEE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F27BA1D11802FE7E00584A9E /* Foundation.framework */; };
14 | 076BD40518CD198D00517DEE /* FTPCredentials.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F27BA2051802FF1800584A9E /* FTPCredentials.h */; };
15 | 076BD40618CD199100517DEE /* FTPHandle.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F27BA1FB1802FF1800584A9E /* FTPHandle.h */; };
16 | 076BD46318CFB76E00517DEE /* ftplib.c in Sources */ = {isa = PBXBuildFile; fileRef = 076BD46118CFB76E00517DEE /* ftplib.c */; };
17 | 07942E2618D014E5006BA28E /* ftplib.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = 076BD46218CFB76E00517DEE /* ftplib.h */; };
18 | 07B145B318CD1489006AD84A /* FTPKit.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F27BA1D61802FE7E00584A9E /* FTPKit.h */; };
19 | 07B145B418CD148D006AD84A /* FTPClient.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = F27BA1F71802FF1800584A9E /* FTPClient.h */; };
20 | 07F23C4A18CA4C43002BDF93 /* XCTest.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07F23C4918CA4C43002BDF93 /* XCTest.framework */; };
21 | 07F23C4B18CA4C43002BDF93 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F27BA1D11802FE7E00584A9E /* Foundation.framework */; };
22 | 07F23C4D18CA4C43002BDF93 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07F23C4C18CA4C43002BDF93 /* UIKit.framework */; };
23 | 07F23C5318CA4C43002BDF93 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 07F23C5118CA4C43002BDF93 /* InfoPlist.strings */; };
24 | 07F23C5518CA4C43002BDF93 /* FTPKit_Tests.m in Sources */ = {isa = PBXBuildFile; fileRef = 07F23C5418CA4C43002BDF93 /* FTPKit_Tests.m */; };
25 | F27BA20B1802FF1800584A9E /* FTPClient.m in Sources */ = {isa = PBXBuildFile; fileRef = F27BA1F81802FF1800584A9E /* FTPClient.m */; };
26 | F27BA20D1802FF1800584A9E /* FTPHandle.m in Sources */ = {isa = PBXBuildFile; fileRef = F27BA1FC1802FF1800584A9E /* FTPHandle.m */; };
27 | F27BA2121802FF1800584A9E /* FTPCredentials.m in Sources */ = {isa = PBXBuildFile; fileRef = F27BA2061802FF1800584A9E /* FTPCredentials.m */; };
28 | /* End PBXBuildFile section */
29 |
30 | /* Begin PBXContainerItemProxy section */
31 | 07F23C5718CA4C43002BDF93 /* PBXContainerItemProxy */ = {
32 | isa = PBXContainerItemProxy;
33 | containerPortal = F27BA1C61802FE7E00584A9E /* Project object */;
34 | proxyType = 1;
35 | remoteGlobalIDString = F27BA1CD1802FE7E00584A9E;
36 | remoteInfo = FTPKit;
37 | };
38 | /* End PBXContainerItemProxy section */
39 |
40 | /* Begin PBXCopyFilesBuildPhase section */
41 | 07B145B218CD1480006AD84A /* CopyFiles */ = {
42 | isa = PBXCopyFilesBuildPhase;
43 | buildActionMask = 2147483647;
44 | dstPath = "include/${PRODUCT_NAME}";
45 | dstSubfolderSpec = 16;
46 | files = (
47 | 07942E2618D014E5006BA28E /* ftplib.h in CopyFiles */,
48 | 07B145B318CD1489006AD84A /* FTPKit.h in CopyFiles */,
49 | 07B145B418CD148D006AD84A /* FTPClient.h in CopyFiles */,
50 | 076BD40518CD198D00517DEE /* FTPCredentials.h in CopyFiles */,
51 | 076BD40618CD199100517DEE /* FTPHandle.h in CopyFiles */,
52 | );
53 | runOnlyForDeploymentPostprocessing = 0;
54 | };
55 | /* End PBXCopyFilesBuildPhase section */
56 |
57 | /* Begin PBXFileReference section */
58 | 072A829718CC2450001E640B /* NSError+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSError+Additions.h"; path = "Categories/NSError+Additions.h"; sourceTree = ""; };
59 | 072A829818CC2450001E640B /* NSError+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSError+Additions.m"; path = "Categories/NSError+Additions.m"; sourceTree = ""; };
60 | 072A829918CC2450001E640B /* NSString+Additions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSString+Additions.h"; path = "Categories/NSString+Additions.h"; sourceTree = ""; };
61 | 072A829A18CC2450001E640B /* NSString+Additions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSString+Additions.m"; path = "Categories/NSString+Additions.m"; sourceTree = ""; };
62 | 076BD46118CFB76E00517DEE /* ftplib.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = ftplib.c; path = Libraries/include/ftplib/src/ftplib.c; sourceTree = SOURCE_ROOT; };
63 | 076BD46218CFB76E00517DEE /* ftplib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ftplib.h; path = Libraries/include/ftplib/src/ftplib.h; sourceTree = SOURCE_ROOT; };
64 | 07F23C4318CA33FC002BDF93 /* FTPKit+Protected.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "FTPKit+Protected.h"; path = "Protected/FTPKit+Protected.h"; sourceTree = ""; };
65 | 07F23C4818CA4C43002BDF93 /* FTPKit Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "FTPKit Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
66 | 07F23C4918CA4C43002BDF93 /* XCTest.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = XCTest.framework; path = Library/Frameworks/XCTest.framework; sourceTree = DEVELOPER_DIR; };
67 | 07F23C4C18CA4C43002BDF93 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; };
68 | 07F23C5018CA4C43002BDF93 /* FTPKit Tests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "FTPKit Tests-Info.plist"; sourceTree = ""; };
69 | 07F23C5218CA4C43002BDF93 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; };
70 | 07F23C5418CA4C43002BDF93 /* FTPKit_Tests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FTPKit_Tests.m; sourceTree = ""; };
71 | 07F23C5618CA4C43002BDF93 /* FTPKit Tests-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FTPKit Tests-Prefix.pch"; sourceTree = ""; };
72 | F27BA1CE1802FE7E00584A9E /* libFTPKit.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFTPKit.a; sourceTree = BUILT_PRODUCTS_DIR; };
73 | F27BA1D11802FE7E00584A9E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
74 | F27BA1D51802FE7E00584A9E /* FTPKit-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "FTPKit-Prefix.pch"; sourceTree = ""; };
75 | F27BA1D61802FE7E00584A9E /* FTPKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FTPKit.h; sourceTree = ""; };
76 | F27BA1F71802FF1800584A9E /* FTPClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPClient.h; sourceTree = ""; };
77 | F27BA1F81802FF1800584A9E /* FTPClient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTPClient.m; sourceTree = ""; };
78 | F27BA1FB1802FF1800584A9E /* FTPHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPHandle.h; sourceTree = ""; };
79 | F27BA1FC1802FF1800584A9E /* FTPHandle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTPHandle.m; sourceTree = ""; };
80 | F27BA2051802FF1800584A9E /* FTPCredentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FTPCredentials.h; sourceTree = ""; };
81 | F27BA2061802FF1800584A9E /* FTPCredentials.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = FTPCredentials.m; sourceTree = ""; };
82 | /* End PBXFileReference section */
83 |
84 | /* Begin PBXFrameworksBuildPhase section */
85 | 07F23C4518CA4C43002BDF93 /* Frameworks */ = {
86 | isa = PBXFrameworksBuildPhase;
87 | buildActionMask = 2147483647;
88 | files = (
89 | 074A7B5218CAC98F00A03068 /* libFTPKit.a in Frameworks */,
90 | 07F23C4A18CA4C43002BDF93 /* XCTest.framework in Frameworks */,
91 | 07F23C4D18CA4C43002BDF93 /* UIKit.framework in Frameworks */,
92 | 07F23C4B18CA4C43002BDF93 /* Foundation.framework in Frameworks */,
93 | );
94 | runOnlyForDeploymentPostprocessing = 0;
95 | };
96 | F27BA1CB1802FE7E00584A9E /* Frameworks */ = {
97 | isa = PBXFrameworksBuildPhase;
98 | buildActionMask = 2147483647;
99 | files = (
100 | 076BD40018CD18CC00517DEE /* Foundation.framework in Frameworks */,
101 | );
102 | runOnlyForDeploymentPostprocessing = 0;
103 | };
104 | /* End PBXFrameworksBuildPhase section */
105 |
106 | /* Begin PBXGroup section */
107 | 072A829618CC2442001E640B /* Categories */ = {
108 | isa = PBXGroup;
109 | children = (
110 | 072A829718CC2450001E640B /* NSError+Additions.h */,
111 | 072A829818CC2450001E640B /* NSError+Additions.m */,
112 | 072A829918CC2450001E640B /* NSString+Additions.h */,
113 | 072A829A18CC2450001E640B /* NSString+Additions.m */,
114 | );
115 | name = Categories;
116 | sourceTree = "";
117 | };
118 | 072A82BA18CC48DE001E640B /* Libraries */ = {
119 | isa = PBXGroup;
120 | children = (
121 | 072A82BC18CC4909001E640B /* ftplib */,
122 | 072A82BB18CC48FB001E640B /* libs */,
123 | );
124 | name = Libraries;
125 | sourceTree = "";
126 | };
127 | 072A82BB18CC48FB001E640B /* libs */ = {
128 | isa = PBXGroup;
129 | children = (
130 | );
131 | name = libs;
132 | sourceTree = "";
133 | };
134 | 072A82BC18CC4909001E640B /* ftplib */ = {
135 | isa = PBXGroup;
136 | children = (
137 | 076BD46218CFB76E00517DEE /* ftplib.h */,
138 | 076BD46118CFB76E00517DEE /* ftplib.c */,
139 | );
140 | name = ftplib;
141 | sourceTree = "";
142 | };
143 | 07F23C4E18CA4C43002BDF93 /* FTPKit Tests */ = {
144 | isa = PBXGroup;
145 | children = (
146 | 07F23C5418CA4C43002BDF93 /* FTPKit_Tests.m */,
147 | 07F23C4F18CA4C43002BDF93 /* Supporting Files */,
148 | );
149 | path = "FTPKit Tests";
150 | sourceTree = "";
151 | };
152 | 07F23C4F18CA4C43002BDF93 /* Supporting Files */ = {
153 | isa = PBXGroup;
154 | children = (
155 | 07F23C5018CA4C43002BDF93 /* FTPKit Tests-Info.plist */,
156 | 07F23C5118CA4C43002BDF93 /* InfoPlist.strings */,
157 | 07F23C5618CA4C43002BDF93 /* FTPKit Tests-Prefix.pch */,
158 | );
159 | name = "Supporting Files";
160 | sourceTree = "";
161 | };
162 | F27BA1C51802FE7E00584A9E = {
163 | isa = PBXGroup;
164 | children = (
165 | F27BA1D31802FE7E00584A9E /* FTPKit */,
166 | 07F23C4E18CA4C43002BDF93 /* FTPKit Tests */,
167 | F27BA1D01802FE7E00584A9E /* Frameworks */,
168 | F27BA1CF1802FE7E00584A9E /* Products */,
169 | );
170 | sourceTree = "";
171 | };
172 | F27BA1CF1802FE7E00584A9E /* Products */ = {
173 | isa = PBXGroup;
174 | children = (
175 | F27BA1CE1802FE7E00584A9E /* libFTPKit.a */,
176 | 07F23C4818CA4C43002BDF93 /* FTPKit Tests.xctest */,
177 | );
178 | name = Products;
179 | sourceTree = "";
180 | };
181 | F27BA1D01802FE7E00584A9E /* Frameworks */ = {
182 | isa = PBXGroup;
183 | children = (
184 | F27BA1D11802FE7E00584A9E /* Foundation.framework */,
185 | 07F23C4918CA4C43002BDF93 /* XCTest.framework */,
186 | 07F23C4C18CA4C43002BDF93 /* UIKit.framework */,
187 | );
188 | name = Frameworks;
189 | sourceTree = "";
190 | };
191 | F27BA1D31802FE7E00584A9E /* FTPKit */ = {
192 | isa = PBXGroup;
193 | children = (
194 | F27BA1D61802FE7E00584A9E /* FTPKit.h */,
195 | F27BA1F71802FF1800584A9E /* FTPClient.h */,
196 | F27BA1F81802FF1800584A9E /* FTPClient.m */,
197 | F27BA2051802FF1800584A9E /* FTPCredentials.h */,
198 | F27BA2061802FF1800584A9E /* FTPCredentials.m */,
199 | F27BA1FB1802FF1800584A9E /* FTPHandle.h */,
200 | F27BA1FC1802FF1800584A9E /* FTPHandle.m */,
201 | 072A829618CC2442001E640B /* Categories */,
202 | 072A82BA18CC48DE001E640B /* Libraries */,
203 | F27BA1D41802FE7E00584A9E /* Supporting Files */,
204 | );
205 | path = FTPKit;
206 | sourceTree = "";
207 | };
208 | F27BA1D41802FE7E00584A9E /* Supporting Files */ = {
209 | isa = PBXGroup;
210 | children = (
211 | F27BA1D51802FE7E00584A9E /* FTPKit-Prefix.pch */,
212 | 07F23C4318CA33FC002BDF93 /* FTPKit+Protected.h */,
213 | );
214 | name = "Supporting Files";
215 | sourceTree = "";
216 | };
217 | /* End PBXGroup section */
218 |
219 | /* Begin PBXNativeTarget section */
220 | 07F23C4718CA4C43002BDF93 /* FTPKit Tests */ = {
221 | isa = PBXNativeTarget;
222 | buildConfigurationList = 07F23C5B18CA4C43002BDF93 /* Build configuration list for PBXNativeTarget "FTPKit Tests" */;
223 | buildPhases = (
224 | 07F23C4418CA4C43002BDF93 /* Sources */,
225 | 07F23C4518CA4C43002BDF93 /* Frameworks */,
226 | 07F23C4618CA4C43002BDF93 /* Resources */,
227 | );
228 | buildRules = (
229 | );
230 | dependencies = (
231 | 07F23C5818CA4C43002BDF93 /* PBXTargetDependency */,
232 | );
233 | name = "FTPKit Tests";
234 | productName = "FTPKit Tests";
235 | productReference = 07F23C4818CA4C43002BDF93 /* FTPKit Tests.xctest */;
236 | productType = "com.apple.product-type.bundle.unit-test";
237 | };
238 | F27BA1CD1802FE7E00584A9E /* FTPKit */ = {
239 | isa = PBXNativeTarget;
240 | buildConfigurationList = F27BA1F11802FE7E00584A9E /* Build configuration list for PBXNativeTarget "FTPKit" */;
241 | buildPhases = (
242 | F27BA1CA1802FE7E00584A9E /* Sources */,
243 | F27BA1CB1802FE7E00584A9E /* Frameworks */,
244 | 07B145B218CD1480006AD84A /* CopyFiles */,
245 | );
246 | buildRules = (
247 | );
248 | dependencies = (
249 | );
250 | name = FTPKit;
251 | productName = FTPKit;
252 | productReference = F27BA1CE1802FE7E00584A9E /* libFTPKit.a */;
253 | productType = "com.apple.product-type.library.static";
254 | };
255 | /* End PBXNativeTarget section */
256 |
257 | /* Begin PBXProject section */
258 | F27BA1C61802FE7E00584A9E /* Project object */ = {
259 | isa = PBXProject;
260 | attributes = {
261 | LastUpgradeCheck = 0510;
262 | ORGANIZATIONNAME = "Upstart Illustration LLC";
263 | TargetAttributes = {
264 | 07F23C4718CA4C43002BDF93 = {
265 | TestTargetID = F27BA1CD1802FE7E00584A9E;
266 | };
267 | };
268 | };
269 | buildConfigurationList = F27BA1C91802FE7E00584A9E /* Build configuration list for PBXProject "FTPKit" */;
270 | compatibilityVersion = "Xcode 3.2";
271 | developmentRegion = English;
272 | hasScannedForEncodings = 0;
273 | knownRegions = (
274 | en,
275 | );
276 | mainGroup = F27BA1C51802FE7E00584A9E;
277 | productRefGroup = F27BA1CF1802FE7E00584A9E /* Products */;
278 | projectDirPath = "";
279 | projectRoot = "";
280 | targets = (
281 | F27BA1CD1802FE7E00584A9E /* FTPKit */,
282 | 07F23C4718CA4C43002BDF93 /* FTPKit Tests */,
283 | );
284 | };
285 | /* End PBXProject section */
286 |
287 | /* Begin PBXResourcesBuildPhase section */
288 | 07F23C4618CA4C43002BDF93 /* Resources */ = {
289 | isa = PBXResourcesBuildPhase;
290 | buildActionMask = 2147483647;
291 | files = (
292 | 07F23C5318CA4C43002BDF93 /* InfoPlist.strings in Resources */,
293 | );
294 | runOnlyForDeploymentPostprocessing = 0;
295 | };
296 | /* End PBXResourcesBuildPhase section */
297 |
298 | /* Begin PBXSourcesBuildPhase section */
299 | 07F23C4418CA4C43002BDF93 /* Sources */ = {
300 | isa = PBXSourcesBuildPhase;
301 | buildActionMask = 2147483647;
302 | files = (
303 | 07F23C5518CA4C43002BDF93 /* FTPKit_Tests.m in Sources */,
304 | );
305 | runOnlyForDeploymentPostprocessing = 0;
306 | };
307 | F27BA1CA1802FE7E00584A9E /* Sources */ = {
308 | isa = PBXSourcesBuildPhase;
309 | buildActionMask = 2147483647;
310 | files = (
311 | 076BD46318CFB76E00517DEE /* ftplib.c in Sources */,
312 | F27BA2121802FF1800584A9E /* FTPCredentials.m in Sources */,
313 | F27BA20D1802FF1800584A9E /* FTPHandle.m in Sources */,
314 | F27BA20B1802FF1800584A9E /* FTPClient.m in Sources */,
315 | 072A829C18CC2450001E640B /* NSString+Additions.m in Sources */,
316 | 072A829B18CC2450001E640B /* NSError+Additions.m in Sources */,
317 | );
318 | runOnlyForDeploymentPostprocessing = 0;
319 | };
320 | /* End PBXSourcesBuildPhase section */
321 |
322 | /* Begin PBXTargetDependency section */
323 | 07F23C5818CA4C43002BDF93 /* PBXTargetDependency */ = {
324 | isa = PBXTargetDependency;
325 | target = F27BA1CD1802FE7E00584A9E /* FTPKit */;
326 | targetProxy = 07F23C5718CA4C43002BDF93 /* PBXContainerItemProxy */;
327 | };
328 | /* End PBXTargetDependency section */
329 |
330 | /* Begin PBXVariantGroup section */
331 | 07F23C5118CA4C43002BDF93 /* InfoPlist.strings */ = {
332 | isa = PBXVariantGroup;
333 | children = (
334 | 07F23C5218CA4C43002BDF93 /* en */,
335 | );
336 | name = InfoPlist.strings;
337 | sourceTree = "";
338 | };
339 | /* End PBXVariantGroup section */
340 |
341 | /* Begin XCBuildConfiguration section */
342 | 07F23C5918CA4C43002BDF93 /* Debug */ = {
343 | isa = XCBuildConfiguration;
344 | buildSettings = {
345 | CLANG_ENABLE_OBJC_ARC = YES;
346 | FRAMEWORK_SEARCH_PATHS = (
347 | "$(SDKROOT)/Developer/Library/Frameworks",
348 | "$(inherited)",
349 | "$(DEVELOPER_FRAMEWORKS_DIR)",
350 | );
351 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
352 | GCC_PREFIX_HEADER = "FTPKit Tests/FTPKit Tests-Prefix.pch";
353 | GCC_PREPROCESSOR_DEFINITIONS = (
354 | "DEBUG=1",
355 | "$(inherited)",
356 | );
357 | INFOPLIST_FILE = "FTPKit Tests/FTPKit Tests-Info.plist";
358 | PRODUCT_NAME = "$(TARGET_NAME)";
359 | WRAPPER_EXTENSION = xctest;
360 | };
361 | name = Debug;
362 | };
363 | 07F23C5A18CA4C43002BDF93 /* Release */ = {
364 | isa = XCBuildConfiguration;
365 | buildSettings = {
366 | CLANG_ENABLE_OBJC_ARC = YES;
367 | FRAMEWORK_SEARCH_PATHS = (
368 | "$(SDKROOT)/Developer/Library/Frameworks",
369 | "$(inherited)",
370 | "$(DEVELOPER_FRAMEWORKS_DIR)",
371 | );
372 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
373 | GCC_PREFIX_HEADER = "FTPKit Tests/FTPKit Tests-Prefix.pch";
374 | INFOPLIST_FILE = "FTPKit Tests/FTPKit Tests-Info.plist";
375 | PRODUCT_NAME = "$(TARGET_NAME)";
376 | WRAPPER_EXTENSION = xctest;
377 | };
378 | name = Release;
379 | };
380 | F27BA1EF1802FE7E00584A9E /* Debug */ = {
381 | isa = XCBuildConfiguration;
382 | buildSettings = {
383 | ALWAYS_SEARCH_USER_PATHS = NO;
384 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
385 | CLANG_CXX_LIBRARY = "libc++";
386 | CLANG_ENABLE_MODULES = YES;
387 | CLANG_ENABLE_OBJC_ARC = NO;
388 | CLANG_WARN_BOOL_CONVERSION = YES;
389 | CLANG_WARN_CONSTANT_CONVERSION = YES;
390 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
391 | CLANG_WARN_EMPTY_BODY = YES;
392 | CLANG_WARN_ENUM_CONVERSION = YES;
393 | CLANG_WARN_INT_CONVERSION = YES;
394 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
395 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
396 | COPY_PHASE_STRIP = NO;
397 | GCC_C_LANGUAGE_STANDARD = gnu99;
398 | GCC_DYNAMIC_NO_PIC = NO;
399 | GCC_OPTIMIZATION_LEVEL = 0;
400 | GCC_PREPROCESSOR_DEFINITIONS = (
401 | "DEBUG=1",
402 | "$(inherited)",
403 | );
404 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
405 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
406 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
407 | GCC_WARN_UNDECLARED_SELECTOR = YES;
408 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
409 | GCC_WARN_UNUSED_FUNCTION = YES;
410 | GCC_WARN_UNUSED_VARIABLE = YES;
411 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
412 | ONLY_ACTIVE_ARCH = YES;
413 | OTHER_LDFLAGS = (
414 | "-ObjC",
415 | "-all_load",
416 | );
417 | SDKROOT = iphoneos;
418 | };
419 | name = Debug;
420 | };
421 | F27BA1F01802FE7E00584A9E /* Release */ = {
422 | isa = XCBuildConfiguration;
423 | buildSettings = {
424 | ALWAYS_SEARCH_USER_PATHS = NO;
425 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
426 | CLANG_CXX_LIBRARY = "libc++";
427 | CLANG_ENABLE_MODULES = YES;
428 | CLANG_ENABLE_OBJC_ARC = NO;
429 | CLANG_WARN_BOOL_CONVERSION = YES;
430 | CLANG_WARN_CONSTANT_CONVERSION = YES;
431 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
432 | CLANG_WARN_EMPTY_BODY = YES;
433 | CLANG_WARN_ENUM_CONVERSION = YES;
434 | CLANG_WARN_INT_CONVERSION = YES;
435 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
436 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
437 | COPY_PHASE_STRIP = YES;
438 | ENABLE_NS_ASSERTIONS = NO;
439 | GCC_C_LANGUAGE_STANDARD = gnu99;
440 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
441 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
442 | GCC_WARN_UNDECLARED_SELECTOR = YES;
443 | GCC_WARN_UNINITIALIZED_AUTOS = YES;
444 | GCC_WARN_UNUSED_FUNCTION = YES;
445 | GCC_WARN_UNUSED_VARIABLE = YES;
446 | IPHONEOS_DEPLOYMENT_TARGET = 7.0;
447 | OTHER_LDFLAGS = (
448 | "-ObjC",
449 | "-all_load",
450 | );
451 | SDKROOT = iphoneos;
452 | VALIDATE_PRODUCT = YES;
453 | };
454 | name = Release;
455 | };
456 | F27BA1F21802FE7E00584A9E /* Debug */ = {
457 | isa = XCBuildConfiguration;
458 | buildSettings = {
459 | CLANG_ENABLE_MODULES = NO;
460 | CLANG_ENABLE_OBJC_ARC = YES;
461 | CURRENT_PROJECT_VERSION = 1.0.0;
462 | DEAD_CODE_STRIPPING = YES;
463 | DSTROOT = /tmp/FTPKit.dst;
464 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
465 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
466 | GCC_PREFIX_HEADER = "FTPKit/FTPKit-Prefix.pch";
467 | INSTALL_PATH = /usr/local/lib;
468 | LIBRARY_SEARCH_PATHS = "$(inherited)";
469 | LINK_WITH_STANDARD_LIBRARIES = YES;
470 | MACH_O_TYPE = staticlib;
471 | ONLY_ACTIVE_ARCH = YES;
472 | OTHER_LDFLAGS = "-ObjC";
473 | PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include;
474 | PRODUCT_NAME = FTPKit;
475 | PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
476 | SEPARATE_STRIP = YES;
477 | SKIP_INSTALL = YES;
478 | STRIP_STYLE = debugging;
479 | TARGETED_DEVICE_FAMILY = "1,2";
480 | WRAPPER_EXTENSION = "";
481 | };
482 | name = Debug;
483 | };
484 | F27BA1F31802FE7E00584A9E /* Release */ = {
485 | isa = XCBuildConfiguration;
486 | buildSettings = {
487 | CLANG_ENABLE_MODULES = NO;
488 | CLANG_ENABLE_OBJC_ARC = YES;
489 | CURRENT_PROJECT_VERSION = 1.0.0;
490 | DEAD_CODE_STRIPPING = YES;
491 | DSTROOT = /tmp/FTPKit.dst;
492 | GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
493 | GCC_PRECOMPILE_PREFIX_HEADER = YES;
494 | GCC_PREFIX_HEADER = "FTPKit/FTPKit-Prefix.pch";
495 | GCC_PREPROCESSOR_DEFINITIONS = NDEBUG;
496 | INSTALL_PATH = /usr/local/lib;
497 | LIBRARY_SEARCH_PATHS = "$(inherited)";
498 | LINK_WITH_STANDARD_LIBRARIES = YES;
499 | MACH_O_TYPE = staticlib;
500 | ONLY_ACTIVE_ARCH = NO;
501 | OTHER_LDFLAGS = "-ObjC";
502 | PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include;
503 | PRODUCT_NAME = FTPKit;
504 | PUBLIC_HEADERS_FOLDER_PATH = /usr/local/include;
505 | SEPARATE_STRIP = YES;
506 | SKIP_INSTALL = YES;
507 | STRIP_STYLE = debugging;
508 | TARGETED_DEVICE_FAMILY = "1,2";
509 | WRAPPER_EXTENSION = "";
510 | };
511 | name = Release;
512 | };
513 | /* End XCBuildConfiguration section */
514 |
515 | /* Begin XCConfigurationList section */
516 | 07F23C5B18CA4C43002BDF93 /* Build configuration list for PBXNativeTarget "FTPKit Tests" */ = {
517 | isa = XCConfigurationList;
518 | buildConfigurations = (
519 | 07F23C5918CA4C43002BDF93 /* Debug */,
520 | 07F23C5A18CA4C43002BDF93 /* Release */,
521 | );
522 | defaultConfigurationIsVisible = 0;
523 | defaultConfigurationName = Release;
524 | };
525 | F27BA1C91802FE7E00584A9E /* Build configuration list for PBXProject "FTPKit" */ = {
526 | isa = XCConfigurationList;
527 | buildConfigurations = (
528 | F27BA1EF1802FE7E00584A9E /* Debug */,
529 | F27BA1F01802FE7E00584A9E /* Release */,
530 | );
531 | defaultConfigurationIsVisible = 0;
532 | defaultConfigurationName = Release;
533 | };
534 | F27BA1F11802FE7E00584A9E /* Build configuration list for PBXNativeTarget "FTPKit" */ = {
535 | isa = XCConfigurationList;
536 | buildConfigurations = (
537 | F27BA1F21802FE7E00584A9E /* Debug */,
538 | F27BA1F31802FE7E00584A9E /* Release */,
539 | );
540 | defaultConfigurationIsVisible = 0;
541 | defaultConfigurationName = Release;
542 | };
543 | /* End XCConfigurationList section */
544 | };
545 | rootObject = F27BA1C61802FE7E00584A9E /* Project object */;
546 | }
547 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/project.xcworkspace/xcshareddata/FTPKit.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | DC6B3E88-0BDA-4EFA-BC17-D3C7C081565B
9 | IDESourceControlProjectName
10 | FTPKit
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | E60CA41811954B4B65A8C3425AEDF2C90AD3886E
14 | ssh://github.com/PeqNP/FTPKit.git
15 |
16 | IDESourceControlProjectPath
17 | FTPKit.xcodeproj/project.xcworkspace
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | E60CA41811954B4B65A8C3425AEDF2C90AD3886E
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | ssh://github.com/PeqNP/FTPKit.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | E60CA41811954B4B65A8C3425AEDF2C90AD3886E
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | E60CA41811954B4B65A8C3425AEDF2C90AD3886E
36 | IDESourceControlWCCName
37 | FTPKit
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/project.xcworkspace/xcuserdata/eric.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeqNP/FTPKit/0db6817d7161f35a8b9b4a483784d180e3f6fc09/FTPKit.xcodeproj/project.xcworkspace/xcuserdata/eric.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/project.xcworkspace/xcuserdata/eric.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/xcuserdata/eric.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/xcuserdata/eric.xcuserdatad/xcschemes/FTPKit.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
43 |
44 |
45 |
46 |
47 |
48 |
57 |
58 |
64 |
65 |
66 |
67 |
68 |
69 |
75 |
76 |
78 |
79 |
82 |
83 |
84 |
--------------------------------------------------------------------------------
/FTPKit.xcodeproj/xcuserdata/eric.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | FTPKit.xcscheme
8 |
9 | orderHint
10 | 4
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 07F23C4718CA4C43002BDF93
16 |
17 | primary
18 |
19 |
20 | F27BA1CD1802FE7E00584A9E
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/FTPKit/Categories/NSError+Additions.h:
--------------------------------------------------------------------------------
1 |
2 | extern NSString *const FTPErrorDomain;
3 |
4 | @interface NSError (NSError_FTPKitAdditions)
5 |
6 | /**
7 | Returns an error for the respective FTP error code.
8 |
9 | @param errorCode FTP error code
10 | @return NSError Respective message for error code.
11 | */
12 | + (NSError *)FTPKitErrorWithCode:(int)errorCode;
13 |
14 | + (NSError *)FTPKitErrorWithResponse:(NSString *)response;
15 |
16 | @end
17 |
--------------------------------------------------------------------------------
/FTPKit/Categories/NSError+Additions.m:
--------------------------------------------------------------------------------
1 | #import "NSError+Additions.h"
2 | #import "NSString+Additions.h"
3 |
4 | NSString *const FTPErrorDomain = @"FTPKit";
5 |
6 | @implementation NSError (NSError_FTPKitAdditions)
7 |
8 | + (NSString *)FTPKitErrorMessageFromCode:(int)errorCode
9 | {
10 | // http://en.wikipedia.org/wiki/List_of_FTP_server_return_codes
11 | NSString *message = NSLocalizedString(@"Undefined error has occurred.", @"");
12 | switch (errorCode) {
13 | case 331:
14 | message = NSLocalizedString(@"User name okay, need password.", @"");
15 | break;
16 | case 332:
17 | message = NSLocalizedString(@"Need account for login.", @"");
18 | break;
19 | case 350:
20 | message = NSLocalizedString(@"Requested file action pending further information.", @"");
21 | break;
22 | case 421:
23 | message = NSLocalizedString(@"Service not available, closing control connection.", @"");
24 | break;
25 | case 425:
26 | message = NSLocalizedString(@"Can't open data connection.", @"");
27 | break;
28 | case 426:
29 | message = NSLocalizedString(@"Connection closed, transfer aborted.", @"");
30 | break;
31 | case 430:
32 | message = NSLocalizedString(@"Invalid username or password.", @"");
33 | break;
34 | case 450:
35 | message = NSLocalizedString(@"Requested file action not taken. File unavailable (e.g., file busy).", @"");
36 | break;
37 | case 451:
38 | message = NSLocalizedString(@"Requested action aborted, local error in processing.", @"");
39 | break;
40 | case 452:
41 | message = NSLocalizedString(@"Requested action not taken. Insufficient storage space in system.", @"");
42 | break;
43 | case 500:
44 | message = NSLocalizedString(@"Syntax error, command unrecognized. This may include errors such as command line too long.", @"");
45 | break;
46 | case 501:
47 | message = NSLocalizedString(@"Syntax error in parameters or arguments.", @"");
48 | break;
49 | case 502:
50 | message = NSLocalizedString(@"Command not implemented.", @"");
51 | break;
52 | case 503:
53 | message = NSLocalizedString(@"Bad sequence of commands.", @"");
54 | break;
55 | case 504:
56 | message = NSLocalizedString(@"Command not implemented for that parameter.", @"");
57 | break;
58 | case 530:
59 | message = NSLocalizedString(@"User not logged in.", @"");
60 | break;
61 | case 532:
62 | message = NSLocalizedString(@"Need account for storing files.", @"");
63 | break;
64 | case 550:
65 | message = NSLocalizedString(@"Requested action not taken. File unavailable (e.g., file not found, no access).", @"");
66 | break;
67 | case 551:
68 | message = NSLocalizedString(@"Requested action aborted. Page type unknown.", @"");
69 | break;
70 | case 552:
71 | message = NSLocalizedString(@"Requested file action aborted, storage allocation exceeded.", @"");
72 | break;
73 | case 553:
74 | message = NSLocalizedString(@"Requested action not taken. File name not allowed.", @"");
75 | break;
76 | case 600:
77 | message = NSLocalizedString(@"Replies regarding confidentiality and integrity.", @"");
78 | break;
79 | case 631:
80 | message = NSLocalizedString(@"Integrity protected reply.", @"");
81 | break;
82 | case 632:
83 | message = NSLocalizedString(@"Confidentiality and integrity protected reply.", @"");
84 | break;
85 | case 633:
86 | message = NSLocalizedString(@"Confidentiality protected reply.", @"");
87 | break;
88 | // 1000 Series Common Winsock Error Codes
89 | case 10054:
90 | message = NSLocalizedString(@"Connection reset by peer. The connection was forcibly closed by the remote host.", @"");
91 | break;
92 | case 10060:
93 | message = NSLocalizedString(@"Cannot connect to remote server.", @"");
94 | break;
95 | case 10061:
96 | message = NSLocalizedString(@"Cannot connect to remote server. The connection is actively refused by the server.", @"");
97 | break;
98 | case 10066:
99 | message = NSLocalizedString(@"Directory not empty.", @"");
100 | break;
101 | case 10068:
102 | message = NSLocalizedString(@"Too many users, server is full.", @"");
103 | break;
104 | default:
105 | break;
106 | }
107 | return message;
108 | }
109 |
110 | + (NSError *)FTPKitErrorWithCode:(int)errorCode
111 | {
112 | NSDictionary *userInfo = [NSDictionary dictionaryWithObject:[NSError FTPKitErrorMessageFromCode:errorCode]
113 | forKey:NSLocalizedDescriptionKey];
114 | return [[NSError alloc] initWithDomain:FTPErrorDomain code:errorCode userInfo:userInfo];
115 | }
116 |
117 | + (NSError *)FTPKitErrorWithResponse:(NSString *)response
118 | {
119 | // Extract the code and message from the reponse message.
120 | // Ex: '500 Server error'
121 | NSMutableArray *components = [[response componentsSeparatedByString:@" "] mutableCopy];
122 | NSInteger code = 500;
123 | if ([components[0] isIntegerValue]) {
124 | code = [components[0] integerValue];
125 | [components removeObjectAtIndex:0];
126 | }
127 | NSString *message = [components componentsJoinedByString:@" "];
128 | NSDictionary *userInfo = [NSDictionary dictionaryWithObject:message
129 | forKey:NSLocalizedDescriptionKey];
130 | return [[NSError alloc] initWithDomain:FTPErrorDomain code:code userInfo:userInfo];
131 | }
132 |
133 | @end
134 |
--------------------------------------------------------------------------------
/FTPKit/Categories/NSString+Additions.h:
--------------------------------------------------------------------------------
1 |
2 | @interface NSString (NSString_FTPKitAdditions)
3 |
4 | /**
5 | URL encode a string.
6 |
7 | @param string String to URL encode
8 | @return NSString Encoded URL string
9 | */
10 | + (NSString *)FTPKitURLEncodeString:(NSString *)string;
11 |
12 | /**
13 | URL decode a string.
14 |
15 | @param string String to URL decode
16 | @return NSString Decoded URL string.
17 | */
18 | + (NSString *)FTPKitURLDecodeString:(NSString *)string;
19 |
20 | - (NSString *)FTPKitURLEncodedString;
21 | - (NSString *)FTPKitURLDecodedString;
22 |
23 | - (BOOL)isIntegerValue;
24 |
25 | @end
--------------------------------------------------------------------------------
/FTPKit/Categories/NSString+Additions.m:
--------------------------------------------------------------------------------
1 | #import "NSString+Additions.h"
2 |
3 | @implementation NSString (NSString_FTPKitAdditions)
4 |
5 | + (NSString *)FTPKitURLEncodeString:(NSString *)unescaped
6 | {
7 | NSString *result = (__bridge_transfer NSString *)CFURLCreateStringByAddingPercentEscapes(NULL, (__bridge CFStringRef)unescaped, NULL, CFSTR("!*'();:@&=+$,?%#[]\" ") /* Removed '/' */, kCFStringEncodingUTF8);
8 | return result;
9 | }
10 |
11 | + (NSString *)FTPKitURLDecodeString:(NSString *)string
12 | {
13 | NSString *result = (__bridge_transfer NSString *)CFURLCreateStringByReplacingPercentEscapesUsingEncoding(NULL, (__bridge CFStringRef)string, CFSTR(""), kCFStringEncodingUTF8);
14 | return result;
15 | }
16 |
17 | - (NSString *)FTPKitURLEncodedString
18 | {
19 | return [NSString FTPKitURLEncodeString:self];
20 | }
21 |
22 | - (NSString *)FTPKitURLDecodedString
23 | {
24 | return [NSString FTPKitURLDecodeString:self];
25 | }
26 |
27 | - (BOOL)isIntegerValue
28 | {
29 | NSScanner *scanner = [NSScanner scannerWithString:self];
30 | if ([scanner scanInteger:NULL]) {
31 | return [scanner isAtEnd];
32 | }
33 | return NO;
34 | }
35 |
36 | @end
37 |
--------------------------------------------------------------------------------
/FTPKit/FTPClient.h:
--------------------------------------------------------------------------------
1 | /**
2 | Provides FTP client.
3 |
4 | Consider implementing more of the commands specified at:
5 | http://en.wikipedia.org/wiki/List_of_FTP_commands
6 |
7 | Currently this creates a new connection to the FTP server for every command
8 | issued. This means the state of the current working directory is NOT kept and.
9 | therefore, some commands are not of use.
10 |
11 | */
12 |
13 | #import "FTPHandle.h"
14 | #import "FTPCredentials.h"
15 |
16 | @class FTPClient;
17 |
18 | @protocol FTPRequestDelegate;
19 |
20 | @interface FTPClient : NSObject
21 |
22 | /** Credentials used to login to the server. */
23 | @property (nonatomic, readonly) FTPCredentials* credentials;
24 |
25 | /**
26 | The last encountered error. Please note that this value does not get nil'ed
27 | when a new operation takes place. Therefore, do not use 'lastError' as a way
28 | to determine if the last operation succeeded or not. Check the return value
29 | first _then_ get the lastError.
30 | */
31 | @property (nonatomic, readonly) NSError *lastError;
32 |
33 | /**
34 | Factory method to create FTPClient instance.
35 |
36 | @param FTPLocation The location's credentials
37 | @return FTPClient
38 | */
39 | + (instancetype)clientWithCredentials:(FTPCredentials *)credentials;
40 |
41 | /**
42 | Factory method to create FTPClient instance.
43 |
44 | @param host Server host to connect to
45 | @param port Server port.
46 | @param username Username to login as.
47 | @param password Password of user.
48 | @return FTPClient
49 | */
50 | + (instancetype)clientWithHost:(NSString *)host port:(int)port username:(NSString *)username password:(NSString* )password;
51 |
52 | /**
53 | Create an instance of FTPClient.
54 |
55 | @param FTPLocation The location's credentials
56 | @return FTPClient
57 | */
58 | - (instancetype)initWithCredentials:(FTPCredentials *)credentials;
59 |
60 | /**
61 | Create an instance of FTPClient.
62 |
63 | @param host Server host to connect to.
64 | @param port Server port.
65 | @param username Username to login as.
66 | @param password Password of user.
67 | @return FTPClient
68 | */
69 | - (instancetype)initWithHost:(NSString *)host port:(int)port username:(NSString *)username password:(NSString* )password;
70 |
71 | /**
72 | Get the size, in bytes, for remote file at 'path'. This can not be used
73 | for directories.
74 |
75 | @param path Path to get size in bytes for.
76 | @return The size of the file in bytes. -1 if file doesn't exist.
77 | */
78 | - (long long int)fileSizeAtPath:(NSString *)path;
79 |
80 | /**
81 | List directory contents at path.
82 |
83 | @param path Path to remote directory to list.
84 | @param showHiddenItems Show hidden items in directory.
85 | @return List of contents as FTPHandle objects.
86 | */
87 | - (NSArray *)listContentsAtPath:(NSString *)path showHiddenFiles:(BOOL)showHiddenFiles;
88 |
89 | /**
90 | Refer to listContentsAtPath:showHiddenFiles:
91 |
92 | This adds the ability to perform the operation asynchronously.
93 |
94 | @param path Path to remote directory to list.
95 | @param showHiddenItems Show hidden items in directory.
96 | @param success Method called when process succeeds. Provides list of contents
97 | as FTPHandle objects.
98 | @param failure Method called when process fails.
99 | */
100 | - (void)listContentsAtPath:(NSString *)path showHiddenFiles:(BOOL)showHiddenFiles
101 | success:(void (^)(NSArray *contents))success
102 | failure:(void (^)(NSError *error))failure;
103 |
104 | /**
105 | List directory contents at handle's location.
106 |
107 | @param handle Remote directory handle to list.
108 | @param showHiddenItems Show hidden items in directory.
109 | @return List of contents as FTPHandle objects.
110 | */
111 | - (NSArray *)listContentsAtHandle:(FTPHandle *)handle showHiddenFiles:(BOOL)showHiddenFiles;
112 |
113 | /**
114 | Refer to listContentsAtHandle:showHiddenFiles:
115 |
116 | This adds the ability to perform the operation asynchronously.
117 |
118 | @param showHiddenItems Show hidden items in directory.
119 | @param success Method called when process succeeds. Provides list of contents
120 | as FTPHandle objects.
121 | @param failure Method called when process fails.
122 | */
123 | - (void)listContentsAtHandle:(FTPHandle *)handle showHiddenFiles:(BOOL)showHiddenFiles
124 | success:(void (^)(NSArray *contents))success
125 | failure:(void (^)(NSError *error))failure;
126 |
127 | /**
128 | Download remote file path to local path.
129 |
130 | @param fileName Full path of remote file to download.
131 | @param localPath Local path to download file to.
132 | @param progress Calls after data has been received to remote server.
133 | Return NO to cancel the operation.
134 | @return YES on success. NO on failure.
135 | */
136 | - (BOOL)downloadFile:(NSString *)remotePath to:(NSString *)localPath
137 | progress:(BOOL (^)(NSUInteger received, NSUInteger totalBytes))progress;
138 |
139 | /**
140 | Refer to downloadFile:to:progress:
141 |
142 | This adds the ability to perform the operation asynchronously.
143 |
144 | @param fileName Full path of remote file to download.
145 | @param localPath Local path to download file to.
146 | @param progress Calls after data has been received to remote server.
147 | Return NO to cancel the operation.
148 | @param success Method called when process succeeds.
149 | @param failure Method called when process fails.
150 | */
151 | - (void)downloadFile:(NSString *)remotePath to:(NSString *)localPath
152 | progress:(BOOL (^)(NSUInteger received, NSUInteger totalBytes))progress
153 | success:(void (^)(void))success
154 | failure:(void (^)(NSError *error))failure;
155 |
156 | /**
157 | Download handle at specific location.
158 |
159 | @param handle Handle to download. Handles are produced by listDirectory* and friends.
160 | @param localPath Local path to download file to.
161 | @param progress Calls after data has been received to remote server.
162 | Return NO to cancel the operation.
163 | @return YES on success. NO on failure.
164 | */
165 | - (BOOL)downloadHandle:(FTPHandle *)handle to:(NSString *)localPath
166 | progress:(BOOL (^)(NSUInteger received, NSUInteger totalBytes))progress;
167 |
168 | /**
169 | Refer to downloadHandle:to:progress:
170 |
171 | This adds the ability to perform the operation asynchronously.
172 |
173 | @param handle Handle to download. Handles are produced by listDirectory* and friends.
174 | @param localPath Local path to download file to.
175 | @param progress Calls after data has been received to remote server.
176 | Return NO to cancel the operation.
177 | @param success Method called when process succeeds.
178 | @param failure Method called when process fails.
179 | */
180 | - (void)downloadHandle:(FTPHandle *)handle to:(NSString *)localPath
181 | progress:(BOOL (^)(NSUInteger received, NSUInteger totalBytes))progress
182 | success:(void (^)(void))success
183 | failure:(void (^)(NSError *error))failure;
184 |
185 | /**
186 | Upload file to specific directory on remote server.
187 |
188 | @param localPath Path of local file to upload.
189 | @param toPath Remote path where file will be uploaded to.
190 | @param progress Calls after data has been sent to remote server.
191 | Return NO to cancel the operation.
192 | @return YES on success. NO on failure.
193 | */
194 | - (BOOL)uploadFile:(NSString *)localPath to:(NSString *)remotePath
195 | progress:(BOOL (^)(NSUInteger sent, NSUInteger totalBytes))progress;
196 |
197 | /**
198 | Refer to uploadFile:to:progress:
199 |
200 | This adds the ability to perform the operation asynchronously.
201 |
202 | @param localPath Path of local file to upload.
203 | @param toPath Remote path where file will be uploaded to.
204 | @param progress Calls after data has been sent to remote server.
205 | Return NO to cancel the operation.
206 | @param success Method called when process succeeds.
207 | @param failure Method called when process fails.
208 | */
209 | - (void)uploadFile:(NSString *)localPath to:(NSString *)remotePath
210 | progress:(BOOL (^)(NSUInteger sent, NSUInteger totalBytes))progress
211 | success:(void (^)(void))success
212 | failure:(void (^)(NSError *error))failure;
213 |
214 | /**
215 | Create directory at the specified path on the remote server.
216 |
217 | @param remotePath Path to create remote directory.
218 | @return YES on success. NO on failure.
219 | */
220 | - (BOOL)createDirectoryAtPath:(NSString *)remotePath;
221 |
222 | /**
223 | Refer to createDirectoryAtPath:
224 |
225 | @param remotePath Path to create remote directory.
226 | @param success Method called when process succeeds.
227 | @param failure Method called when process fails.
228 | */
229 | - (void)createDirectoryAtPath:(NSString *)remotePath
230 | success:(void (^)(void))success
231 | failure:(void (^)(NSError *error))failure;
232 |
233 | /**
234 | Create remote directory within the handle's location.
235 |
236 | @param directoryName Name of directory to create on remote server.
237 | @param remotePath Path to remote directory where file should be created.
238 | @return YES on success. NO on failure.
239 | */
240 | - (BOOL)createDirectoryAtHandle:(FTPHandle *)handle;
241 |
242 | /**
243 | Refer to createDirectoryAtHandle:
244 |
245 | This adds the ability to perform the operation asynchronously.
246 |
247 | @param directoryName Name of directory to create on remote server.
248 | @param remotePath Path to remote directory where file should be created.
249 | @param success Method called when process succeeds.
250 | @param failure Method called when process fails.
251 | */
252 | - (void)createDirectoryAtHandle:(FTPHandle *)handle
253 | success:(void (^)(void))success
254 | failure:(void (^)(NSError *error))failure;
255 |
256 | /**
257 | Delete directory at specified remote path.
258 |
259 | @param remotePath The path of the remote directory to delete.
260 | @return YES on success. NO on failure.
261 | */
262 | - (BOOL)deleteDirectoryAtPath:(NSString *)remotePath;
263 |
264 | /**
265 | Refer to deleteDirectoryAtPath:
266 |
267 | This adds the ability to perform the operation asynchronously.
268 |
269 | @param remotePath The path of the remote directory to delete.
270 | @param success Method called when process succeeds.
271 | @param failure Method called when process fails.
272 | */
273 | - (void)deleteDirectoryAtPath:(NSString *)remotePath
274 | success:(void (^)(void))success
275 | failure:(void (^)(NSError *error))failure;
276 |
277 | /**
278 | Delete a file at a specified remote path.
279 |
280 | @param remotePath The path to the remote resource to delete.
281 | @return YES on success. NO on failure.
282 | */
283 | - (BOOL)deleteFileAtPath:(NSString *)remotePath;
284 |
285 | /**
286 | Refer to deleteFileAtPath:
287 |
288 | This adds the ability to perform the operation asynchronously.
289 |
290 | @param remotePath The path to the remote resource to delete.
291 | @param success Method called when process succeeds.
292 | @param failure Method called when process fails.
293 | @return FTPRequest The request instance.
294 | */
295 | - (void)deleteFileAtPath:(NSString *)remotePath
296 | success:(void (^)(void))success
297 | failure:(void (^)(NSError *error))failure;
298 |
299 | /**
300 | Delete a remote handle from the server.
301 |
302 | @param handle The remote handle to delete.
303 | @return YES on success. NO on failure.
304 | */
305 | - (BOOL)deleteHandle:(FTPHandle *)handle;
306 |
307 | /**
308 | Refer to deleteHandle:
309 |
310 | This adds the ability to perform the operation asynchronously.
311 |
312 | @param handle The remote handle to delete.
313 | @param success Method called when process succeeds.
314 | @param failure Method called when process fails.
315 | @return FTPRequest The request instance.
316 | */
317 | - (void)deleteHandle:(FTPHandle *)handle
318 | success:(void (^)(void))success
319 | failure:(void (^)(NSError *error))failure;
320 |
321 | /**
322 | Change file mode of a remote file or directory.
323 |
324 | @param remotePath Full path to remote resource.
325 | @param mode File mode to change to.
326 | @return YES on success. NO on failure.
327 | */
328 | - (BOOL)chmodPath:(NSString *)remotePath toMode:(int)mode;
329 |
330 | /**
331 | Refer to chmodPath:toMode:
332 |
333 | This adds the ability to perform the operation asynchronously.
334 |
335 | @param remotePath Full path to remote resource.
336 | @param mode File mode to change to.
337 | @param success Method called when process succeeds.
338 | @param failure Method called when process fails.
339 | */
340 | - (void)chmodPath:(NSString *)remotePath toMode:(int)mode
341 | success:(void (^)(void))success
342 | failure:(void (^)(NSError *error))failure;
343 |
344 | /**
345 | Change file mode of a remote file or directory.
346 |
347 | @param handle The remote handle.
348 | @param mode File mode to change to.
349 | @return YES on success. NO on failure.
350 | */
351 | - (BOOL)chmodHandle:(FTPHandle *)handle toMode:(int)mode;
352 |
353 | /**
354 | Refer to chmodHandle:toMode:
355 |
356 | This adds the ability to perform the operation asynchronously.
357 |
358 | @param handle The remote handle to change mode on.
359 | @param mode File mode to change to.
360 | @param success Method called when process succeeds.
361 | @param failure Method called when process fails.
362 | */
363 | - (void)chmodHandle:(FTPHandle *)handle toMode:(int)mode
364 | success:(void (^)(void))success
365 | failure:(void (^)(NSError *error))failure;
366 |
367 | /**
368 | Rename a remote path to something else. This method can be used to move a
369 | file to a different directory.
370 |
371 | @param sourcePath Source path to rename.
372 | @param destPath Destination of renamed file.
373 | */
374 | - (BOOL)renamePath:(NSString *)sourcePath to:(NSString *)destPath;
375 |
376 | /**
377 | Refer to renamePath:to:
378 |
379 | This adds the ability to perform the operation asynchronously.
380 |
381 | @param sourcePath Source path to rename.
382 | @param destPath Destination of renamed file.
383 | @param success Method called when process succeeds.
384 | @param failure Method called when process fails.
385 | */
386 | - (void)renamePath:(NSString *)sourcePath to:(NSString *)destPath
387 | success:(void (^)(void))success
388 | failure:(void (^)(NSError *error))failure;
389 |
390 | /**
391 | Copy a remote path to another location.
392 |
393 | @param sourcePath Source path to copy.
394 | @param destPath Destination of copied file.
395 | */
396 | - (BOOL)copyPath:(NSString *)sourcePath to:(NSString *)destPath;
397 |
398 | /**
399 | Refer to copyPath:to:
400 |
401 | This adds the ability to perform the operation asynchronously.
402 |
403 | @param sourcePath Source path to copy.
404 | @param destPath Destination of copied file.
405 | @param success Method called when process succeeds.
406 | @param failure Method called when process fails.
407 | */
408 | - (void)copyPath:(NSString *)sourcePath to:(NSString *)destPath
409 | success:(void (^)(void))success
410 | failure:(void (^)(NSError *error))failure;
411 |
412 | /**
413 | Returns the last modification date of remotePath. This will NOT work with
414 | directories, as the RFC spec does not require it.
415 |
416 | @param remotePath Path to get modified date for
417 | @return Date the remote path was last modified
418 | */
419 | - (NSDate *)lastModifiedAtPath:(NSString *)remotePath;
420 |
421 | /**
422 | Refer to lastModifiedAtPath:
423 |
424 | This adds the ability to perform the operation asynchronously.
425 |
426 | @param remotePath Remote path to check
427 | @param success Method called when process succeeds. 'lastModified' is the
428 | last modified time.
429 | @param failure Method called when process fails.
430 | */
431 | - (void)lastModifiedAtPath:(NSString *)remotePath
432 | success:(void (^)(NSDate *lastModified))success
433 | failure:(void (^)(NSError *error))failure;
434 |
435 | /**
436 | Check if a remote directory exists.
437 |
438 | Please note that this internally calls [self changeDirectoryToPath:] and does
439 | _not_ change back to the previous directory!
440 |
441 | @param remotePath Directory to check
442 | @return YES if the directory exists. NO, otherwise
443 | */
444 | - (BOOL)directoryExistsAtPath:(NSString *)remotePath;
445 |
446 | /**
447 | Refer to directoryExistsAtPath:
448 |
449 | This adds the ability to perform the operation asynchronously.
450 |
451 | @param remotePath Remote path to check
452 | @param success Method called when process succeeds. 'exists' will be YES if the
453 | directory exists. NO otherwise.
454 | @param failure Method called when process fails.
455 | */
456 | - (void)directoryExistsAtPath:(NSString *)remotePath
457 | success:(void (^)(BOOL exists))success
458 | failure:(void (^)(NSError *error))failure;
459 |
460 | /**
461 | Change the working directory to remotePath.
462 |
463 | @note This is currently used ONLY to determine if a directory exists on the
464 | server. The state of the cwd is not saved between commands being issued. This
465 | is because a new connection is created for every command issued.
466 |
467 | Therefore, in its current state, it is used in a very limited scope. Eventually
468 | you will be able to issue commands in the cwd. Not right now.
469 |
470 | @param remotePath Remote directory path to make current directory.
471 | @return YES if the directory was successfully changed.
472 | */
473 | - (BOOL)changeDirectoryToPath:(NSString *)remotePath;
474 |
475 | /**
476 | Returns the current working directory.
477 |
478 | @note Currently this will always return the root path. This is because the
479 | lib creates a new connection for every command issued to the server -- and
480 | therefore the command will always being in the root path when issuing the
481 | command.
482 |
483 | @return The current working directory.
484 | */
485 | - (NSString *)printWorkingDirectory;
486 |
487 | @end
--------------------------------------------------------------------------------
/FTPKit/FTPCredentials.h:
--------------------------------------------------------------------------------
1 |
2 | @interface FTPCredentials : NSObject
3 |
4 | @property (nonatomic, readonly) NSString *host;
5 | @property (nonatomic, readonly) int port;
6 | @property (nonatomic, readonly) NSString *username;
7 | @property (nonatomic, readonly) NSString *password;
8 |
9 | /**
10 | Factory: Create credentials used for login.
11 |
12 | @param host Host of server.
13 | @param port Server port.
14 | @param username Username used to connect to server.
15 | @param password User's password.
16 | @return FTPCredentials
17 | */
18 | + (instancetype)credentialsWithHost:(NSString *)host port:(int)port username:(NSString *)username password:(NSString *)password;
19 |
20 | /**
21 | Create credentials used for login.
22 |
23 | @param host Host of server.
24 | @param port Server port.
25 | @param username Username used to connect to server.
26 | @param password User's password.
27 | @return FTPCredentials
28 | */
29 | - (id)initWithHost:(NSString *)host port:(int)port username:(NSString *)username password:(NSString *)password;
30 |
31 | /**
32 | Creates fully qualified FTP URL including schema, credentials and the absolute
33 | path to the resource.
34 |
35 | @param path Path to remote resource. The path should never contain schema, etc.
36 | @return NSURL URL for path.
37 | */
38 | - (NSURL *)urlForPath:(NSString *)path;
39 |
40 | @end
--------------------------------------------------------------------------------
/FTPKit/FTPCredentials.m:
--------------------------------------------------------------------------------
1 | #import "FTPCredentials.h"
2 | #import "NSString+Additions.h"
3 |
4 | @interface FTPCredentials()
5 | @property (nonatomic, strong) NSString *host;
6 | @property (nonatomic, assign) int port;
7 | @property (nonatomic, strong) NSString *username;
8 | @property (nonatomic, strong) NSString *password;
9 | @end
10 |
11 | @implementation FTPCredentials
12 |
13 | + (instancetype)credentialsWithHost:(NSString *)aHost port:(int)aPort username:(NSString *)aUsername password:(NSString *)aPassword
14 | {
15 | return [[self alloc] initWithHost:aHost port:aPort username:aUsername password:aPassword];
16 | }
17 |
18 | - (id)initWithHost:(NSString *)aHost port:(int)aPort username:(NSString *)aUsername password:(NSString *)aPassword
19 | {
20 | self = [super init];
21 | if (self) {
22 | self.host = aHost;
23 | self.port = aPort < 1 ? 21 : aPort;
24 | self.username = aUsername;
25 | self.password = aPassword;
26 | }
27 | return self;
28 | }
29 |
30 | - (NSURL *)urlForPath:(NSString *)path
31 | {
32 | // @todo encode username and password?
33 | NSString *scheme = [NSString stringWithFormat:@"ftp://%@:%@@%@:%d", _username, _password, _host, _port];
34 | NSString *decoded = [path FTPKitURLDecodedString];
35 | NSString *encoded = [decoded isEqualToString:path] ? [path FTPKitURLEncodedString] : path;
36 | NSURL *url = [NSURL URLWithString:[scheme stringByAppendingString:encoded]];
37 | return url;
38 | }
39 |
40 | @end
41 |
--------------------------------------------------------------------------------
/FTPKit/FTPHandle.h:
--------------------------------------------------------------------------------
1 | typedef enum {
2 | FTPHandleTypeUnknown = 0,
3 | FTPHandleTypeFIFO = 1,
4 | FTPHandleTypeCharacterDevice = 2,
5 | FTPHandleTypeDirectory = 4,
6 | FTPHandleTypeBLL = 6,
7 | FTPHandleTypeFile = 8,
8 | FTPHandleTypeLink = 10,
9 | FTPHandleTypeSocket = 12,
10 | FTPHandleTypeWHT = 14
11 | } FTPHandleType;
12 |
13 | @interface FTPHandle : NSObject
14 |
15 | @property (nonatomic, readonly) NSString *path;
16 | @property (nonatomic, readonly) NSDate *modified;
17 | @property (nonatomic, readonly) NSString *group;
18 | @property (nonatomic, readonly) NSString *owner;
19 | @property (nonatomic, readonly) NSString *link;
20 | @property (nonatomic, readonly) NSString *name;
21 | @property (nonatomic, readonly) unsigned long long size;
22 | @property (nonatomic, readonly) FTPHandleType type;
23 | @property (nonatomic, readonly) int mode;
24 |
25 | /**
26 | Factory: Create handle from CFFTPResource* dictionary attributes.
27 |
28 | @param path Parent directory of remote resource.
29 | @param attributes A dictionary containing CFFTPResource* attributes.
30 | @return instancetype
31 | */
32 | + (instancetype)handleAtPath:(NSString *)path attributes:(NSDictionary *)attributes;
33 |
34 | /**
35 | Factory: Create a handle with the full path of a resource w/ no attributes.
36 |
37 | @param path Full path of remote resource.
38 | @return instancetype
39 | */
40 | + (instancetype)handleAtPath:(NSString *)path type:(FTPHandleType)type;
41 |
42 | /**
43 | Create handle from CFFTPResource* dictionary attributes.
44 |
45 | @param path Parent directory to remote resource.
46 | @param attributes A dictionary containing CFFTPResource* attributes.
47 | @return instancetype
48 | */
49 | - (instancetype)initWithPath:(NSString *)path attributes:(NSDictionary *)attributes;
50 |
51 | /**
52 | Create a handle with the full path of a resource w/ no attributes.
53 |
54 | @param path Full path of remote resource.
55 | @return instancetype
56 | */
57 | - (instancetype)initWithPath:(NSString *)path type:(FTPHandleType)type;
58 |
59 | /**
60 | If mode set, returns string representation of file permissions.
61 |
62 | @param localPath Local path to handle
63 | @return string representation of permissions.
64 | */
65 | - (NSString *)permissions;
66 |
67 | @end
68 |
--------------------------------------------------------------------------------
/FTPKit/FTPHandle.m:
--------------------------------------------------------------------------------
1 | #import "FTPHandle.h"
2 | #import "FTPCredentials.h"
3 | #import "NSString+Additions.h"
4 |
5 | #include
6 | #include
7 |
8 | @interface FTPHandle()
9 | @property (nonatomic, strong) NSString *path;
10 | @property (nonatomic, strong) NSDate *modified;
11 | @property (nonatomic, strong) NSString *group;
12 | @property (nonatomic, strong) NSString *owner;
13 | @property (nonatomic, strong) NSString *link;
14 | @property (nonatomic, strong) NSString *name;
15 | @property (nonatomic, assign) unsigned long long size;
16 | @property (nonatomic, assign) FTPHandleType type;
17 | @property (nonatomic, assign) int mode;
18 | @property (nonatomic, strong) FTPCredentials *credentials;
19 | @end
20 |
21 | @implementation FTPHandle
22 |
23 | @synthesize path;
24 | @synthesize modified;
25 | @synthesize group;
26 | @synthesize owner;
27 | @synthesize link;
28 | @synthesize name;
29 | @synthesize size;
30 | @synthesize type;
31 | @synthesize mode;
32 |
33 | + (instancetype)handleAtPath:(NSString *)path attributes:(NSDictionary *)attributes
34 | {
35 | return [[self alloc] initWithPath:path attributes:attributes];
36 | }
37 |
38 | + (instancetype)handleAtPath:(NSString *)path type:(FTPHandleType)type
39 | {
40 | return [[self alloc] initWithPath:path type:type];
41 | }
42 |
43 | - (instancetype)initWithPath:(NSString *)aPath attributes:(NSDictionary *)aAttributes
44 | {
45 | self = [super init];
46 | if (self) {
47 | self.modified = [aAttributes objectForKey:(id)kCFFTPResourceModDate];
48 | self.group = [aAttributes objectForKey:(id)kCFFTPResourceGroup];
49 | self.link = [aAttributes objectForKey:(id)kCFFTPResourceLink];
50 | self.mode = [[aAttributes objectForKey:(id)kCFFTPResourceSize] intValue];
51 | self.name = [aAttributes objectForKey:(id)kCFFTPResourceName];
52 | self.owner = [aAttributes objectForKey:(id)kCFFTPResourceOwner];
53 | self.size = [[aAttributes objectForKey:(id)kCFFTPResourceSize] unsignedLongLongValue];
54 | self.type = [[aAttributes objectForKey:(id)kCFFTPResourceType] intValue];
55 |
56 | if ([aPath hasPrefix:@"/"]) {
57 | self.path = [aPath stringByAppendingPathComponent:name];
58 | } else {
59 | self.path = [NSString stringWithFormat:@"%@/%@", aPath, name];
60 | }
61 | }
62 | return self;
63 | }
64 |
65 | - (instancetype)initWithPath:(NSString *)aPath type:(FTPHandleType)aType
66 | {
67 | self = [super init];
68 | if (self) {
69 | self.modified = [NSDate date];
70 | self.group = nil;
71 | self.link = nil;
72 | self.mode = 0;
73 | self.name = [aPath lastPathComponent];
74 | self.owner = nil;
75 | self.size = 0;
76 | self.type = aType;
77 | self.path = aPath;
78 | }
79 | return self;
80 | }
81 |
82 | - (NSString *)permissions
83 | {
84 | char modeCStr[12];
85 | strmode(self.mode + DTTOIF(type), modeCStr);
86 | return [NSString stringWithUTF8String:modeCStr];
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/FTPKit/FTPKit-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #ifdef __OBJC__
8 | #import
9 | #endif
10 |
--------------------------------------------------------------------------------
/FTPKit/FTPKit.h:
--------------------------------------------------------------------------------
1 |
2 | #import "FTPCredentials.h"
3 | #import "FTPHandle.h"
4 | #import "FTPClient.h"
--------------------------------------------------------------------------------
/FTPKit/Protected/FTPKit+Protected.h:
--------------------------------------------------------------------------------
1 | #ifndef FTPKit_FTPKit_Protected_h
2 | #define FTPKit_FTPKit_Protected_h
3 |
4 | #define kFTPKitRequestBufferSize 32768
5 | #define kFTPKitTempBufferSize 1024
6 |
7 | //#define FKLog(level, msg) NSLog(@"FTPKit: (%@) %@", level, msg)
8 | #define FKLogDebug(frmt, ...) NSLog(@"FTPKit: (Debug) %@", [NSString stringWithFormat:frmt, ##__VA_ARGS__])
9 | #define FKLogInfo(frmt, ...) NSLog(@"FTPKit: (Info) %@", [NSString stringWithFormat:frmt, ##__VA_ARGS__])
10 | #define FKLogWarn(frmt, ...) NSLog(@"FTPKit: (Warn) %@", [NSString stringWithFormat:frmt, ##__VA_ARGS__])
11 | #define FKLogError(frmt, ...) NSLog(@"FTPKit: (Error) %@", [NSString stringWithFormat:frmt, ##__VA_ARGS__])
12 |
13 | #endif
14 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2014 Upstart Illustration LLC
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/CHANGES:
--------------------------------------------------------------------------------
1 | The obligatory revision history...
2 |
3 | Changes from V3.1-1 to V4.0
4 |
5 | 1) License changed from GPL/LGPL to Artistic License 2.0.
6 |
7 | 2) Many bugs reported over the years have been addressed.
8 |
9 | 3) The reentrant versions of gethostbyname and getservbyname are used
10 | if available.
11 |
12 | 4) Internal buffers are larger which should allow for longer
13 | filenames.
14 |
15 | 5) The library will not output anything to stdout or stderr unless
16 | ftplib_debug is defined.
17 |
18 | 6) Some additional arguments are declared const.
19 |
20 | 7) The second argument to FtpSize is the address of an integer to
21 | receive the size of the remote file. The type of this argument has
22 | been changed from int to unsigned int. A new function, FtpSizeLong,
23 | returns the remote file's size as an unsigned long long.
24 |
25 | 8) The second argument to the callback function has been changed from
26 | an int to an unsigned long long. This value contains the number of
27 | bytes transferred so far.
28 |
29 | 9) The library version 1 interface compatability macros have been
30 | removed from the header file. If your application needs them, extract
31 | them from the old header file.
32 |
33 | 10) The usage information in qftp.c has been corrected.
34 |
35 | 11) qftp now accepts a '-s ' option to send as a SITE
36 | command.
37 |
38 | 12) qftp progress reports now use floating point calculation so that
39 | large numbers don't cause overflows. If the remote server does not
40 | support the SIZE command, qftp will update every 32KB.
41 |
42 | 13) A new type-safe method is provided to establish a callback
43 | function. Put the details of when the function should be called into
44 | a FtpCallbackOptions structure and pass it to FtpSetCallback(). To
45 | remove a callback, call FtpClearCallback().
46 |
47 | 14) Updated html documentation.
48 |
49 | Changes from V3.1 to V3.1-1
50 |
51 | 1) Delay setting the control handle pointer in the data handle until
52 | after the transfer request has received a positive acknowledgement.
53 | This should resolve problems calling FtpClose() on the data handle
54 | when the transfer is rejected.
55 |
56 | 2) Fix error handling in FtpRead() and FtpWrite().
57 |
58 | 3) Return status of transfer from FtpXfer() instead of status of
59 | FtpClose().
60 |
61 | 4) Allow FtpClose() to be called on a control handle. This should be
62 | used instead of FtpQuit() in cases where a transfer was interrupted.
63 | FtpQuit() would attempt to send a 'QUIT' command and wait for a
64 | response but this would be out of sync after an interrupt.
65 |
66 | 5) The idle callback routine was not being set in the data handle if
67 | the user didn't set FTPLIB_IDLETIME. Fixed this so it would get set
68 | up if either this or FTPLIB_CALLBACKBYTES was set.
69 |
70 | 6) Open local files in binary mode when appropriate. This is
71 | necessary on some systems like NT and VMS.
72 |
73 | 7) Added a wildcard mode to qftp for wildcard retrieves. Argument
74 | after '-w' is treated as a remote wildcard file specification.
75 |
76 | Changes from 12/2/97 (V3) to .... (V3.1)
77 |
78 | 1) Added FtpPwd(), FtpSysType(), FtpCDUp(), FtpSize() and FtpModDate().
79 |
80 | 2) Fixed bug in FtpClose() - It wasn't waiting for the '226 Transfer
81 | Complete' since it didn't have access to the control connection. A
82 | pointer to it is now kept in the data connection.
83 |
84 | 3) Fixed bug in FtpClose() - The data connection wasn't being freed. This
85 | could have resulted in memory leaks.
86 |
87 | 4) Allow runtime selection of connection mode (PORT/PASV) with default set
88 | at compile time.
89 |
90 | 5) Added support for a user callback routine which can get called after a
91 | user specified number of bytes are transferred or after waiting for data
92 | on a socket for a user specified time period.
93 |
94 | 6) Add FtpOptions() which allows changing connection options. Options
95 | include connection mode, callback routine, and parameters regarding when
96 | the user's callback routine gets called.
97 |
98 | 7) Added checks to make sure strcpy()/sprintf()/etc. wouldn't write past
99 | end of buffers.
100 |
101 | 8) Modified build procedure to create a shared library.
102 |
103 | 9) Added install option to makefile which installs under /usr/local.
104 |
105 | 10) Modified qftp to use new interface.
106 |
107 | 11) Modified qftp to log progress every 10% of file or every time data
108 | is delayd by 1 second if -v setting is not zero.
109 |
110 | 12) Modified qftp to use fgets() instead of gets().
111 |
112 | ------------------------------------------------------------------------
113 |
114 | Changes from 3/15/97 to 12/2/97
115 |
116 | 1) FtpLastResponse() returns NULL if passed a NULL pointer.
117 |
118 | 2) Added 'const' keyword on appropriate function arguments.
119 |
120 | 3) First attempt to translate passed host string as an IP address in dot
121 | notation by passing it to inet_addr(). If this fails, pass the string
122 | to gethostbyname(). Apparently, some versions of gethostbyname() will
123 | parse the translation of a dot notation address for you. One user
124 | reports he knows of at least one that does not. In any case, it's the
125 | right thing to do.
126 |
127 | 4) Added protection from double inclusion to header file. Also added
128 | 'extern "C"' for C++.
129 |
130 | 5) Made sure qftp was passed two arguments before examining the second
131 | one.
132 |
133 | 6) Made sure all commands to the server were in upper case. I've been
134 | told that some servers require this.
135 |
136 | 7) Attempt to handle login to accounts with no passwords.
137 |
138 | 8) Added common data transfer routines so that ascii mode transfers would
139 | be handled properly in all cases. Also, exposed these routines for
140 | user programs to call. There's now FtpAccess() to open a remote file
141 | or directory, FtpRead() and FtpWrite() to pass data, and FtpClose() to
142 | terminate the data connection.
143 |
144 | 9) Added 'list' command to qftp to perform a terse directory (names
145 | only). This could be piped into another copy of qftp to retrieve the
146 | files.
147 |
148 | 10) ftplib.c and ftplib.h are now covered by the LGPL instead of the GPL.
149 | Feel free to send me a complementary copy of anything you develop
150 | commercially with my libraries. All other programs are still covered
151 | by the GPL.
152 |
153 | 11) Added ability to specify a different port number than the default by
154 | appending a colon and the desired port number to the remote host name
155 | (e.g., remote.host.name:500 would connect to port remote.host.name on
156 | port 500).
157 |
158 | ------------------------------------------------------------------------
159 |
160 | Changes from 8/31/96 version to 3/15/97 version
161 |
162 | 1) Added copyright information to sources.
163 |
164 | 2) Changed from 'port' to 'pasv' which I'm told will allow the routines
165 | to work from behind a firewall. It's also a lot simpler and cleaner
166 | than all that code to setup and accept a connect from the server.
167 |
168 | 3) Added delete (ftprm) support to qftp.c.
169 |
170 | 4) Modified qftp to allow use without a softlink by passing the ftp
171 | command as the first argument.
172 |
173 | 5) Added netbuf argument to all calls to eliminate static storage and
174 | allow multiple simultaneous connections.
175 |
176 | 6) Renamed routines from ftp*() to Ftp*() to avoid problems with existing
177 | programs. Added macros in libftp.h to support old interface. Renamed
178 | ftpOpen() to FtpConnect().
179 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/LICENSE:
--------------------------------------------------------------------------------
1 | Artistic License 2.0
2 |
3 | Copyright (c) 2000-2006, The Perl Foundation.
4 |
5 | Everyone is permitted to copy and distribute verbatim copies of this
6 | license document, but changing it is not allowed. Preamble
7 |
8 | This license establishes the terms under which a given free software
9 | Package may be copied, modified, distributed, and/or
10 | redistributed. The intent is that the Copyright Holder maintains some
11 | artistic control over the development of that Package while still
12 | keeping the Package available as open source and free software.
13 |
14 | You are always permitted to make arrangements wholly outside of this
15 | license directly with the Copyright Holder of a given Package. If the
16 | terms of this license do not permit the full use that you propose to
17 | make of the Package, you should contact the Copyright Holder and seek
18 | a different licensing arrangement. Definitions
19 |
20 | "Copyright Holder" means the individual(s) or organization(s) named in
21 | the copyright notice for the entire Package.
22 |
23 | "Contributor" means any party that has contributed code or other
24 | material to the Package, in accordance with the Copyright Holder's
25 | procedures.
26 |
27 | "You" and "your" means any person who would like to copy, distribute,
28 | or modify the Package.
29 |
30 | "Package" means the collection of files distributed by the Copyright
31 | Holder, and derivatives of that collection and/or of those files. A
32 | given Package may consist of either the Standard Version, or a
33 | Modified Version.
34 |
35 | "Distribute" means providing a copy of the Package or making it
36 | accessible to anyone else, or in the case of a company or
37 | organization, to others outside of your company or organization.
38 |
39 | "Distributor Fee" means any fee that you charge for Distributing this
40 | Package or providing support for this Package to another party. It
41 | does not mean licensing fees.
42 |
43 | "Standard Version" refers to the Package if it has not been modified,
44 | or has been modified only in ways explicitly requested by the
45 | Copyright Holder.
46 |
47 | "Modified Version" means the Package, if it has been changed, and such
48 | changes were not explicitly requested by the Copyright Holder.
49 |
50 | "Original License" means this Artistic License as Distributed with the
51 | Standard Version of the Package, in its current version or as it may
52 | be modified by The Perl Foundation in the future.
53 |
54 | "Source" form means the source code, documentation source, and
55 | configuration files for the Package.
56 |
57 | "Compiled" form means the compiled bytecode, object code, binary, or
58 | any other form resulting from mechanical transformation or translation
59 | of the Source form. Permission for Use and Modification Without
60 | Distribution
61 |
62 | (1) You are permitted to use the Standard Version and create and use
63 | Modified Versions for any purpose without restriction, provided that
64 | you do not Distribute the Modified Version. Permissions for
65 | Redistribution of the Standard Version
66 |
67 | (2) You may Distribute verbatim copies of the Source form of the
68 | Standard Version of this Package in any medium without restriction,
69 | either gratis or for a Distributor Fee, provided that you duplicate
70 | all of the original copyright notices and associated disclaimers. At
71 | your discretion, such verbatim copies may or may not include a
72 | Compiled form of the Package.
73 |
74 | (3) You may apply any bug fixes, portability changes, and other
75 | modifications made available from the Copyright Holder. The resulting
76 | Package will still be considered the Standard Version, and as such
77 | will be subject to the Original License. Distribution of Modified
78 | Versions of the Package as Source
79 |
80 | (4) You may Distribute your Modified Version as Source (either gratis
81 | or for a Distributor Fee, and with or without a Compiled form of the
82 | Modified Version) provided that you clearly document how it differs
83 | from the Standard Version, including, but not limited to, documenting
84 | any non-standard features, executables, or modules, and provided that
85 | you do at least ONE of the following:
86 |
87 | (a) make the Modified Version available to the Copyright Holder of the
88 | Standard Version, under the Original License, so that the Copyright
89 | Holder may include your modifications in the Standard Version. (b)
90 | ensure that installation of your Modified Version does not prevent the
91 | user installing or running the Standard Version. In addition, the
92 | Modified Version must bear a name that is different from the name of
93 | the Standard Version. (c) allow anyone who receives a copy of the
94 | Modified Version to make the Source form of the Modified Version
95 | available to others under (i) the Original License or (ii) a license
96 | that permits the licensee to freely copy, modify and redistribute the
97 | Modified Version using the same licensing terms that apply to the copy
98 | that the licensee received, and requires that the Source form of the
99 | Modified Version, and of any works derived from it, be made freely
100 | available in that license fees are prohibited but Distributor Fees are
101 | allowed. Distribution of Compiled Forms of the Standard Version or
102 | Modified Versions without the Source
103 |
104 | (5) You may Distribute Compiled forms of the Standard Version without
105 | the Source, provided that you include complete instructions on how to
106 | get the Source of the Standard Version. Such instructions must be
107 | valid at the time of your distribution. If these instructions, at any
108 | time while you are carrying out such distribution, become invalid, you
109 | must provide new instructions on demand or cease further
110 | distribution. If you provide valid instructions or cease distribution
111 | within thirty days after you become aware that the instructions are
112 | invalid, then you do not forfeit any of your rights under this
113 | license.
114 |
115 | (6) You may Distribute a Modified Version in Compiled form without the
116 | Source, provided that you comply with Section 4 with respect to the
117 | Source of the Modified Version. Aggregating or Linking the Package
118 |
119 | (7) You may aggregate the Package (either the Standard Version or
120 | Modified Version) with other packages and Distribute the resulting
121 | aggregation provided that you do not charge a licensing fee for the
122 | Package. Distributor Fees are permitted, and licensing fees for other
123 | components in the aggregation are permitted. The terms of this license
124 | apply to the use and Distribution of the Standard or Modified Versions
125 | as included in the aggregation.
126 |
127 | (8) You are permitted to link Modified and Standard Versions with
128 | other works, to embed the Package in a larger work of your own, or to
129 | build stand-alone binary or bytecode versions of applications that
130 | include the Package, and Distribute the result without restriction,
131 | provided the result does not expose a direct interface to the Package.
132 | Items That are Not Considered Part of a Modified Version
133 |
134 | (9) Works (including, but not limited to, modules and scripts) that
135 | merely extend or make use of the Package, do not, by themselves, cause
136 | the Package to be a Modified Version. In addition, such works are not
137 | considered parts of the Package itself, and are not subject to the
138 | terms of this license. General Provisions
139 |
140 | (10) Any use, modification, and distribution of the Standard or
141 | Modified Versions is governed by this Artistic License. By using,
142 | modifying or distributing the Package, you accept this license. Do not
143 | use, modify, or distribute the Package, if you do not accept this
144 | license.
145 |
146 | (11) If your Modified Version has been derived from a Modified Version
147 | made by someone other than you, you are nevertheless required to
148 | ensure that your Modified Version complies with the requirements of
149 | this license.
150 |
151 | (12) This license does not grant you the right to use any trademark,
152 | service mark, tradename, or logo of the Copyright Holder.
153 |
154 | (13) This license includes the non-exclusive, worldwide,
155 | free-of-charge patent license to make, have made, use, offer to sell,
156 | sell, import and otherwise transfer the Package with respect to any
157 | patent claims licensable by the Copyright Holder that are necessarily
158 | infringed by the Package. If you institute patent litigation
159 | (including a cross-claim or counterclaim) against any party alleging
160 | that the Package constitutes direct or contributory patent
161 | infringement, then this Artistic License to you shall terminate on the
162 | date that such litigation is filed.
163 |
164 | (14) Disclaimer of Warranty: THE PACKAGE IS PROVIDED BY THE COPYRIGHT
165 | HOLDER AND CONTRIBUTORS "AS IS' AND WITHOUT ANY EXPRESS OR IMPLIED
166 | WARRANTIES. THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
167 | PARTICULAR PURPOSE, OR NON-INFRINGEMENT ARE DISCLAIMED TO THE EXTENT
168 | PERMITTED BY YOUR LOCAL LAW. UNLESS REQUIRED BY LAW, NO COPYRIGHT
169 | HOLDER OR CONTRIBUTOR WILL BE LIABLE FOR ANY DIRECT, INDIRECT,
170 | INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING IN ANY WAY OUT OF THE USE
171 | OF THE PACKAGE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
172 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/README.ftplib-4.0:
--------------------------------------------------------------------------------
1 | FTP Library Routines Release 4.0
2 | Thomas Pfau (tfpfau@gmail.com)
3 | June 7, 2013
4 |
5 | This package implements a callable interface to FTP. The FTP protocol is
6 | specified in RFC 959. The library has been tested on linux, OpenVMS and
7 | Windows NT. It should also work without major modification on other
8 | POSIX systems.
9 |
10 | All programs using the library should include ftplib.h.
11 |
12 | The routines look at the global variable ftplib_debug to determine how
13 | much information they should display. Level 1 has been left for user
14 | programs. Level 2 displays all responses received from the server.
15 | Level 3 displays all commands sent to the server.
16 |
17 | Function documentation is provided in HTML format in the html
18 | subdirectory.
19 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/README.qftp:
--------------------------------------------------------------------------------
1 | qftp is a simple program which demonstrates the use of ftplib.
2 |
3 | qftp performs directories or file transfers using the ftp protocol based
4 | on the command it was invoked with and command line arguments. qftp
5 | can be invoked through a softlink which indicates which operation it
6 | should perform.
7 |
8 | To install, copy qftp to a directory in your path. Execute the following
9 | commands in that directory:
10 |
11 | ln -s qftp ftpdir
12 | ln -s qftp ftpget
13 | ln -s qftp ftpsend
14 | ln -s qftp ftprm
15 | ln -s qftp ftplist
16 |
17 | Then, invoke qftp by using the commands ftpdir, ftpget, ftpsend, ftprm or
18 | ftplist.
19 |
20 | qftp processes the command line in order. The first argument should be
21 | the name of the system you wish to converse with. If you need to specify
22 | login information, that should be specified next with '-l' and '-p'. On
23 | UNIX systems, if you specify a username with '-l' and don't specify a
24 | password with '-p', qftp will prompt for a password. It is a good idea
25 | to do it this way as it keeps the password off the command line and out
26 | of 'ps' and other displays.
27 |
28 | When working through a proxy firewall, specify the firewall machine's
29 | name as the host. Specify the real host's name with the -l and -p
30 | parameters. For example:
31 |
32 | ftpget firewall -l anonymous@real.host.com -p user@myhost.org
33 |
34 | The exit status from qftp can be used to determine whether the transfer
35 | worked or not. Exit status 2 means a command line syntax error. 3
36 | indicates a failure while attempting to translate the system name into an
37 | IP address. 4 indicates a failure attempting to connect to the remote
38 | machine. 5 indicates a login failure. 6 indicates a remote command
39 | error. 7 indicates a system call error.
40 |
41 | See the HTML documentation in the html subdirectory for more details.
42 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/additional_rfcs:
--------------------------------------------------------------------------------
1 | RFC2228 FTP Security Extensions. M. Horowitz, S. Lunt. October 1997.
2 | RFC1579 Firewall-Friendly FTP. S. Bellovin. February 1994.
3 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/html/FtpAccess.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | FtpAccess
5 |
6 |
7 |
8 |
FtpAccess
9 |
Open a file or directory on the remote system.
10 |
SYNOPSIS
11 |
12 | #include <ftplib.h>
13 | int FtpAccess(const char *path, int typ, int mode, netbuf *nControl,
14 | netbuf **nData);
15 |
16 |
PARAMETERS
17 |
18 |
path
19 |
Specifies the name of the remote file or directory to
20 | open.
21 |
typ
22 |
Specifies the type of transfer to be performed. FTPLIB_DIR
23 | performs a terse directory. FTPLIB_DIR_VERBOSE performs a verbose
24 | directory. FTPLIB_FILE_READ opens a remote file for reading.
25 | FTPLIB_FILE_WRITE creates a remote file and readies it for
26 | writing.
27 |
mode
28 |
Specifies the transfer mode as FTPLIB_ASCII or
29 | FTPLIB_IMAGE.
Closes the connection specified by 'nData' and frees associated
23 | resources. If the connection is a command connection, any
24 | associated data connection is also closed and the command
25 | connection is closed without sending any commands.
26 |
FtpClose() destroys the connection object and any associated
27 | data connection object. Do not use either connection after calling
28 | FtpClose().
The name of the host machine to connect to and optionally an
19 | alternate port number to use.
20 |
nControl
21 |
The address where the pointer to the newly created control
22 | handle should be stored.
23 |
24 |
DESCRIPTION
25 |
FtpConnect() establishes a connection to the FTP server on the
26 | specified machine and returns a handle which can be used to
27 | initiate data transfers. The host name should be specified as
28 | <host> or <host>:<port>. <host> may be
29 | either a host name or ip address. <port> may be either a
30 | service name or a port number.
31 |
RETURN VALUE
32 |
If the connection to the remote server if successful,
33 | FtpConnect() returns 1. Otherwise, 0 is returned.
Sends a LIST command to the server with the specified path. The
28 | response to this is usually a long format directory listing which
29 | will be written to the file named in outputfile. If outputfile is
30 | specified as NULL, the list will be written to stdout.
31 |
The format of the listing is dependent on the type of the remote
32 | system. The system type can be determined from
33 | FtpSysType().
A pointer to a control handle returned by
19 | FtpConnect().
20 |
21 |
DESCRIPTION
22 |
FtpLastResponse() returns a pointer to the last response string
23 | sent by the server. This can be parsed by the user program to
24 | determine more information about the last request or can be
25 | displayed along with an error message.
26 |
RETURN VALUE
27 |
If nControl is a valid control handle, FtpLastResponse() returns
28 | a pointer to the last server response string. Otherwise, NULL is
29 | returned.
FtpModDate() attempts to determine the last access time of a
28 | remote file and return it to the user's buffer. The date and time
29 | are returned as a string in the format 'YYYYMMDDHHMMSS'.
30 |
RETURN VALUE
31 |
If a good response is received and the date and time are
32 | successfully parsed out of the result, 1 is returned. Otherwise, 0
33 | is returned.
12 | #include <ftplib.h>
13 | int FtpOptions(int opt, long val, netbuf *nControl);
14 |
15 |
PARAMETERS
16 |
17 |
opt
18 |
Specifies the option to change. Valid options are
19 | FTPLIB_CONNMODE, FTPLIB_CALLBACK, FTPLIB_IDLETIME,
20 | FTPLIB_CALLBACKARG, and FTPLIB_CALLBACKBYTES.
21 |
val
22 |
Specifies the new value for the option. The value may need to
23 | by cast to a long.
FtpOptions() changes the options for a connection handle. A data
30 | connection inherits the options assigned to the control connection
31 | it is created from. Callbacks are only called on file data
32 | connections.
FtpQuit() sends a QUIT command to the server and waits for a
22 | response. It closes the connection to the remote server and frees any
23 | resources associated with the connection. The connection should not
24 | be used after calling FtpQuit().
FtpRead copies up to max bytes of data from the specified data
27 | connection and returns it to the user's buffer. If the data
28 | connection was opened in ascii mode, no more than one line of data
29 | will be returned.
30 |
RETURN VALUE
31 |
Returns the number of bytes written to the user's buffer or -1
32 | on error or end of file.
17 | typedef struct FtpCallbackOptions {
18 | FtpCallback cbFunc; /* function to call */
19 | void *cbArg; /* argument to pass to function */
20 | unsigned int bytesXferred; /* callback if this number of bytes transferred */
21 | unsigned int idleTime; /* callback if this many milliseconds have elapsed */
22 | } FtpCallbackOptions;
23 |
24 |
PARAMETERS
25 |
26 |
opt
27 |
The address of a structure that contains a pointer to the callback
28 | function and the criteria for calling it.
FtpSetCallback() establishes a callback functions and tells FTPlib
35 | when to call it. A data connection inherits the options assigned to
36 | the control connection it is created from. Callbacks are only called
37 | on file data connections.
38 |
The fields in FtpCallbackStruct are described below.
39 |
40 |
cbFunc
41 |
Specifies the address of a user callback routine.
42 |
cbArg
43 |
Specifies an argument to pass to the user's callback
44 | routine.
45 |
idleTime
46 |
Specifies the socket idle time in milliseconds that triggers
47 | calling the user's callback routine.
48 |
bytesXferred
49 |
Specifies the number of bytes to transfer between calls to the
50 | user's callback routine.
51 |
52 |
The user's callback routine is specified as:
53 |
54 | typedef int (*FtpCallback)(netbuf *nControl, int xfered, void *arg);
55 |
56 | nControl is the data connection in use. xfered specifies
57 | how many bytes of data have been transferred on the
58 | connection. arg is the value passed in the FtpCallbackOptions
59 | field cbArg.
60 |
The user can request to be called back on either of two
61 | events.
62 |
If the routine should be called when the data socket is idle for
63 | some period of time, pass the number of milliseconds of inactivity
64 | that should trigger a callback in the idleTime field.
65 |
If the routine should be called when a certain amount of data has
66 | been transferred, specify a non-zero value in bytesXferred. This
67 | value represents the minimum number of bytes to transfer between
68 | callbacks. When using this option, ftplib keeps track of the number of
69 | bytes transferred and calls the user once the specified number of
70 | bytes or more has been transferred. It then resets the count to 0 and
71 | starts again.
72 |
If the user wishes to continue the transfer, the callback
73 | routine should return true (non-zero). It can abort the transfer by
74 | return zero.
FtpSize() attempts to determine the size of a remote file.
29 |
RETURN VALUE
30 |
If a good response is received and the size is successfully
31 | parsed out of the result, 1 is returned. Otherwise, 0 is
32 | returned.
33 |
Some servers may not support the SIZE command. If this request
34 | fails, the size may be available in the response to a RETR
35 | (FtpOpen() with
36 | typ=FTPLIB_FILE_READ).
FtpSize() attempts to determine the size of a remote file.
29 |
RETURN VALUE
30 |
If a good response is received and the size is successfully
31 | parsed out of the result, 1 is returned. Otherwise, 0 is
32 | returned.
33 |
Some servers may not support the SIZE command. If this request
34 | fails, the size may be available in the response to a RETR
35 | (FtpOpen() with
36 | typ=FTPLIB_FILE_READ).
37 |
This function is identical to FtpSize()
38 | except for the type of the returned value.
FtpSysType() issues a SYST command to the remote system and
26 | attempts to parse the system type out of the response and return it
27 | to the user's buffer.
ftplib is a set of routines that implement the FTP protocol. They
12 | allow applications to create and access remote files through function
13 | calls instead of needing to fork and exec an interactive ftp client
14 | program.
15 |
16 |
ftplib has been built and tested on Linux (X86) and OpenVMS (AXP).
The documentation is included in the kit in html format. Also, the
29 | current working documentation for the release in
30 | progress is available on line.
qftp is a utility that performs file transfers using
10 | ftplib based on instructions presented on the command
11 | line.
12 |
Format
13 |
14 | qftp <action> <host> [ -l user [ -p pass ] ] { options/files }...
15 |
16 | Actions: send, get, dir, list, rm
17 |
18 | Options:
19 | -v level Set verbosity
20 | -r rootpath Change remote working directory
21 | -m umask Set umask for created files
22 | -a | -i Set ascii/image transfer mode
23 | -w Toggle wildcard mode
24 | -s cmd Send cmd as a SITE command
25 | -b Toggle stripping of path from filename
26 | on send
27 |
28 |
29 |
action
30 |
Specifies what qftp is to do. qftp can
31 | send files to a remote system, get files from a
32 | remote system, remove (rm) files from a remote system, or
33 | retreive a directory of files or a list of files on a
34 | remote system.
35 |
host
36 |
Specifies the name of the remote system. An alternate port may
37 | be specified by appending a colon and the port name or number to
38 | the host name.
39 |
-l user
40 |
Specifies the username to log in with on host.
41 |
-p pass
42 |
Specifies the password to log in with on host.
43 |
If user is not specified, qftp will use
44 | anonymous. If pass is also not specified, qftp
45 | attempts to build a password from the translation of the
46 | environment variable "USER" and the string returned by
47 | gethostname() separated by an "@".
48 |
49 |
-v level
50 |
Specifies the verbosity level. A level of 1 will cause
51 | qftp to display messages indicating successful transfers. A
52 | level of 2 will cause FTP protocol responses to be displayed. A
53 | level of 3 will cause FTP protocol commands to be displayed.
54 |
-r rootpath
55 |
Sends a 'change directory' request to the remote server. All
56 | subsequent file names on the command line will be parsed relative
57 | to this new directory.
58 |
-m umask
59 |
Sends a request to change the umask to the remote server. This
60 | may not be supported by all servers. It is implemented using the
61 | 'SITE' command in the FTP protocol.
62 |
-a
63 |
Requests that subsequent files be sent in ascii mode.
64 |
-i
65 |
Requests that subsequent files be sent in image mode.
66 |
-w
67 |
Toggles handling of filenames to get as wildcards. When a
68 | wildcard filename is encountered it is passed to the server in a
69 | NLST (brief directory) command. qftp will save the list of files
70 | returned and then retrieve each file individually.
71 |
-s cmd
72 |
Sends cmd in a SITE command. This can be useful to alter the way
73 | filenames are presented. For example, an OpenVMS FTP server will
74 | strip version numbers from file names after receiving a 'SITE UNIX'
75 | command.
76 |
-b
77 |
Toggles stripping of paths from filenames on send. By default,
78 | qftp passes the full path of the input file as specified on the
79 | command line to the remote FTP server as the target filename. This
80 | option will cause qftp to send only the basename of the file.
81 |
82 |
qftp reads the command line argument by argument and acts on
83 | each as it comes to it. Most options only change the value of a
84 | variable. The '-m' (umask), '-s' (site), and '-r' (change
85 | directory) options are executed immediately by sending the command
86 | to the server. The '-a' (ascii) and '-i' (image) options save the
87 | type for subsequent transfers. When a filename is encountered it
88 | is sent to the server with the command for the selected action.
89 |
It is possible to send multiple files with different modes on the
90 | same command line. For example, the following command will send all
91 | text files in ascii mode and all zip files in image mode:
92 |
93 | qftp send srvr -a *.txt -i *.zip
94 |
95 |
qftp may optionally be invoked through a softlink.
96 | qftp searches the command which invoked it for 'send', 'get'
97 | or 'dir' and, if found, performs the requested function. In this
98 | case, leave off the action argument on the command line.
and then invoke transfers with 'ftpsend' instead of 'qftp send',
108 | etc.
109 |
If no file names are specified on the command line, qftp
110 | will read file names from stdin. Use your favorite utility to
111 | generate a list of files to send/retreive or type them
112 | interactively.
113 |
114 |
115 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/Makefile:
--------------------------------------------------------------------------------
1 | #
2 | # This makefile contains modifications submitted by Richard Braakman
3 | # (dark@xs4all.nl) for the shared library generation.
4 | #
5 |
6 | # By default, ftplib uses PASV. If you need it to use PORT
7 | # instead, uncomment the next line
8 | #DEFINES = -DFTPLIB_DEFMODE=FTPLIB_PORT
9 |
10 | SONAME = 4
11 | SOVERSION = $(SONAME).0
12 |
13 | TARGETS = qftp libftp.so libftp.a qftp.static
14 | OBJECTS = qftp.o ftplib.o
15 | SOURCES = qftp.c ftplib.c
16 |
17 | CFLAGS = -Wall $(DEBUG) -I. $(INCLUDES) $(DEFINES) -Wno-unused-variable -D_FILE_OFFSET_BITS=64 -D__unix__
18 | LDFLAGS = -L.
19 | DEPFLAGS =
20 |
21 | all : $(TARGETS)
22 |
23 | clean :
24 | rm -f $(OBJECTS) core *.bak
25 | rm -rf unshared
26 |
27 | clobber : clean
28 | rm -f $(TARGETS) .depend
29 | rm -f libftp.so.*
30 |
31 | install : all
32 | install qftp /usr/local/bin
33 | install -m 644 libftp.so.$(SOVERSION) /usr/local/lib
34 | install -m 644 ftplib.h /usr/local/include
35 | (cd /usr/local/lib && \
36 | ln -sf libftp.so.$(SOVERSION) libftp.so.$(SONAME) && \
37 | ln -sf libftp.so.$(SONAME) libftp.so)
38 | -(cd /usr/local/bin && \
39 | for f in ftpdir ftpget ftplist ftprm ftpsend; \
40 | do ln -s qftp $$f; done)
41 |
42 | depend :
43 | $(CC) $(CFLAGS) -M $(SOURCES) > .depend
44 |
45 | # build without -fPIC
46 | unshared/ftplib.o: ftplib.c ftplib.h
47 | test -d unshared || mkdir unshared
48 | $(CC) -c $(CFLAGS) -D_REENTRANT $< -o $@
49 |
50 | static : libftp.a qftp.static
51 |
52 | qftp.static : qftp.o libftp.a
53 | $(CC) -o $@ $< libftp.a
54 |
55 | ftplib.o: ftplib.c ftplib.h
56 | $(CC) -c $(CFLAGS) -fPIC -D_REENTRANT $< -o $@
57 |
58 | libftp.a: unshared/ftplib.o
59 | ar -rcs $@ $<
60 |
61 | libftp.so.$(SOVERSION): ftplib.o
62 | $(CC) -shared -Wl,-soname,libftp.so.$(SONAME) -lc -o $@ $<
63 |
64 | libftp.so: libftp.so.$(SOVERSION)
65 | ln -sf $< libftp.so.$(SONAME)
66 | ln -sf $< $@
67 |
68 | qftp : qftp.o libftp.so ftplib.h
69 | $(CC) $(LDFLAGS) -o $@ $< -lftp
70 |
71 | ifeq (.depend,$(wildcard .depend))
72 | include .depend
73 | endif
74 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/README:
--------------------------------------------------------------------------------
1 | To build FTPlib on linux, type 'make'. This should produce a shared
2 | library and a static library. It should also create the qftp
3 | executable. 'make install' should install into /usr/local. To
4 | install elsewhere, modify the Makefile.
5 |
6 | To build on MAC, type 'make static'. This should build a static link
7 | library and qftp.static.
8 |
9 | The provided Makefile may work on other unix-like systems although it
10 | will most likely require some modifications.
11 |
12 | To build on OpenVMS, some extra files are provided. DESCRIP.MMS can
13 | be used with MMS or MMK. Options files are provied for VAX, Alpha and
14 | Itanium systems.
15 |
16 | This release was not tested on Microsoft Windows. Previous releases
17 | have built without any problems and I don't believe any significant
18 | changes have ocurred that should cause this release to fail. To build
19 | on Windows using Visual Studio, create a library project for FTPlib
20 | and a command line executable project qftp. Add a dependency from
21 | qftp to FTPlib. 'Build All' should create working files.
22 |
23 | Also not tested but the provided Makefile will probably work with
24 | Cygwin.
25 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/descrip.mms:
--------------------------------------------------------------------------------
1 | .ifdef MMSIA64
2 | SUFFIX = _IA64
3 | CFLAGS = $(CFLAGS)/define=(_LARGEFILE)
4 | .endif
5 | .ifdef MMSALPHA
6 | SUFFIX = _ALPHA
7 | CFLAGS = $(CFLAGS)/define=(_LARGEFILE)
8 | .endif
9 | .ifdef MMSVAX
10 | XFER_VECTOR = ftplib_vector.obj
11 | .endif
12 |
13 | TARGETS = ftplib$(SUFFIX).exe qftp$(SUFFIX).exe
14 | SHLINKFLAGS = /SHARE=$(MMS$TARGET)/NOMAP
15 |
16 | * : $(TARGETS)
17 | continue
18 |
19 | clean :
20 | if f$search("ftplib.obj") .nes. "" then delete ftplib.obj;*
21 | if f$search("ftplib_alpha.obj") .nes. "" then delete ftplib_alpha.obj;*
22 | if f$search("ftplib.exe") .nes. "" then delete ftplib.exe;*
23 | if f$search("ftplib_alpha.exe") .nes. "" then delete ftplib_alpha.exe;*
24 | if f$search("qftp.obj") .nes. "" then delete qftp.obj;*
25 | if f$search("qftp_alpha.obj") .nes. "" then delete qftp_alpha.obj;*
26 | if f$search("qftp.exe") .nes. "" then delete qftp.exe;*
27 | if f$search("qftp_alpha.exe") .nes. "" then delete qftp_alpha.exe;*
28 | if f$search("ftplib_vector.obj") .nes. "" then delete ftplib_vector.obj;*
29 |
30 | ftplib$(SUFFIX).obj : ftplib.c ftplib.h
31 | $(CC) $(CFLAGS) $<
32 |
33 | ftplib$(SUFFIX).exe : ftplib$(SUFFIX).obj $(XFER_VECTOR)
34 | $(LINK) $(SHLINKFLAGS) ftplib$(SUFFIX).opt/options
35 |
36 | qftp$(SUFFIX).exe : qftp$(SUFFIX).obj
37 | $(LINK) $(LINKFLAGS) qftp$(SUFFIX).opt/options
38 |
39 | qftp$(SUFFIX).obj : qftp.c ftplib.h
40 | $(CC) $(CFLAGS) $<
41 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/ftplib.h:
--------------------------------------------------------------------------------
1 | /***************************************************************************/
2 | /* */
3 | /* ftplib.h - header file for callable ftp access routines */
4 | /* Copyright (C) 1996-2001, 2013 Thomas Pfau, tfpfau@gmail.com */
5 | /* 1407 Thomas Ave, North Brunswick, NJ, 08902 */
6 | /* */
7 | /* This library is free software. You can redistribute it and/or */
8 | /* modify it under the terms of the Artistic License 2.0. */
9 | /* */
10 | /* This library is distributed in the hope that it will be useful, */
11 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 | /* Artistic License 2.0 for more details. */
14 | /* */
15 | /* See the file LICENSE or */
16 | /* http://www.perlfoundation.org/artistic_license_2_0 */
17 | /* */
18 | /***************************************************************************/
19 |
20 | #if !defined(__FTPLIB_H)
21 | #define __FTPLIB_H
22 |
23 | #if defined(__unix__) || defined(VMS) || defined(__APPLE__)
24 | #define GLOBALDEF
25 | #define GLOBALREF extern
26 | #elif defined(_WIN32)
27 | #if defined BUILDING_LIBRARY
28 | #define GLOBALDEF __declspec(dllexport)
29 | #define GLOBALREF __declspec(dllexport)
30 | #else
31 | #define GLOBALREF __declspec(dllimport)
32 | #endif
33 | #endif
34 |
35 | #include
36 | #include
37 |
38 | /* FtpAccess() type codes */
39 | #define FTPLIB_DIR 1
40 | #define FTPLIB_DIR_VERBOSE 2
41 | #define FTPLIB_FILE_READ 3
42 | #define FTPLIB_FILE_WRITE 4
43 |
44 | /* FtpAccess() mode codes */
45 | #define FTPLIB_ASCII 'A'
46 | #define FTPLIB_IMAGE 'I'
47 | #define FTPLIB_TEXT FTPLIB_ASCII
48 | #define FTPLIB_BINARY FTPLIB_IMAGE
49 |
50 | /* connection modes */
51 | #define FTPLIB_PASSIVE 1
52 | #define FTPLIB_PORT 2
53 |
54 | /* connection option names */
55 | #define FTPLIB_CONNMODE 1
56 | #define FTPLIB_CALLBACK 2
57 | #define FTPLIB_IDLETIME 3
58 | #define FTPLIB_CALLBACKARG 4
59 | #define FTPLIB_CALLBACKBYTES 5
60 |
61 | #ifdef __cplusplus
62 | extern "C" {
63 | #endif
64 |
65 | #if defined(__UINT64_MAX)
66 | typedef uint64_t fsz_t;
67 | #else
68 | typedef uint32_t fsz_t;
69 | #endif
70 |
71 | typedef struct NetBuf netbuf;
72 | typedef int (*FtpCallback)(netbuf *nControl, fsz_t xfered, void *arg);
73 |
74 | typedef struct FtpCallbackOptions {
75 | FtpCallback cbFunc; /* function to call */
76 | void *cbArg; /* argument to pass to function */
77 | unsigned int bytesXferred; /* callback if this number of bytes transferred */
78 | unsigned int idleTime; /* callback if this many milliseconds have elapsed */
79 | } FtpCallbackOptions;
80 |
81 | GLOBALREF int ftplib_debug;
82 | GLOBALREF void FtpInit(void);
83 | GLOBALREF char *FtpLastResponse(netbuf *nControl);
84 | GLOBALREF int FtpConnect(const char *host, netbuf **nControl);
85 | GLOBALREF int FtpOptions(int opt, long val, netbuf *nControl);
86 | GLOBALREF int FtpSetCallback(const FtpCallbackOptions *opt, netbuf *nControl);
87 | GLOBALREF int FtpClearCallback(netbuf *nControl);
88 | GLOBALREF int FtpLogin(const char *user, const char *pass, netbuf *nControl);
89 | GLOBALREF int FtpAccess(const char *path, int typ, int mode, netbuf *nControl, netbuf **nData);
90 | GLOBALREF int FtpRead(void *buf, int max, netbuf *nData);
91 | GLOBALREF int FtpWrite(const void *buf, int len, netbuf *nData);
92 | GLOBALREF int FtpClose(netbuf *nData);
93 | GLOBALREF int FtpSite(const char *cmd, netbuf *nControl);
94 | GLOBALREF int FtpSysType(char *buf, int max, netbuf *nControl);
95 | GLOBALREF int FtpSendCmd(const char *cmd, char expresp, netbuf *nControl);
96 | GLOBALREF int FtpMkdir(const char *path, netbuf *nControl);
97 | GLOBALREF int FtpChdir(const char *path, netbuf *nControl);
98 | GLOBALREF int FtpCDUp(netbuf *nControl);
99 | GLOBALREF int FtpRmdir(const char *path, netbuf *nControl);
100 | GLOBALREF int FtpPwd(char *path, int max, netbuf *nControl);
101 | GLOBALREF int FtpNlst(const char *output, const char *path, netbuf *nControl);
102 | GLOBALREF int FtpDir(const char *output, const char *path, netbuf *nControl);
103 | GLOBALREF int FtpSize(const char *path, unsigned int *size, char mode, netbuf *nControl);
104 | #if defined(__UINT64_MAX)
105 | GLOBALREF int FtpSizeLong(const char *path, fsz_t *size, char mode, netbuf *nControl);
106 | #endif
107 | GLOBALREF int FtpModDate(const char *path, char *dt, int max, netbuf *nControl);
108 | GLOBALREF int FtpGet(const char *output, const char *path, char mode, netbuf *nControl);
109 | GLOBALREF int FtpPut(const char *input, const char *path, char mode, netbuf *nControl);
110 | GLOBALREF int FtpRename(const char *src, const char *dst, netbuf *nControl);
111 | GLOBALREF int FtpDelete(const char *fnm, netbuf *nControl);
112 | GLOBALREF void FtpQuit(netbuf *nControl);
113 |
114 | #ifdef __cplusplus
115 | };
116 | #endif
117 |
118 | #endif /* __FTPLIB_H */
119 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/ftplib.opt:
--------------------------------------------------------------------------------
1 | ident=V4.0
2 | gsmatch=lequal,4,0
3 |
4 | ftplib.obj
5 | ftplib_vector.obj
6 |
7 | collect=transfer_vectors,ftplib_vector
8 | universal=ftplib_debug
9 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/ftplib_alpha.opt:
--------------------------------------------------------------------------------
1 | ident=V4.0
2 | gsmatch=lequal,4,0
3 |
4 | ftplib_alpha.obj
5 |
6 | symbol_vector=(-
7 | FTPACCESS=procedure,-
8 | FTPCHDIR=procedure,-
9 | FTPCLOSE=procedure,-
10 | FTPCONNECT=procedure,-
11 | FTPDELETE=procedure,-
12 | FTPDIR=procedure,-
13 | FTPGET=procedure,-
14 | FTPINIT=procedure,-
15 | FTPLASTRESPONSE=procedure,-
16 | FTPLIB_DEBUG=data,-
17 | FTPLOGIN=procedure,-
18 | FTPMKDIR=procedure,-
19 | FTPNLST=procedure,-
20 | FTPPUT=procedure,-
21 | FTPQUIT=procedure,-
22 | FTPREAD=procedure,-
23 | FTPRENAME=procedure,-
24 | FTPRMDIR=procedure,-
25 | FTPSITE=procedure,-
26 | FTPWRITE=procedure,-
27 | FTPPWD=procedure,-
28 | FTPSYSTYPE=procedure,-
29 | FTPCDUP=procedure,-
30 | FTPSIZE=procedure,-
31 | FTPMODDATE=procedure,-
32 | FTPOPTIONS=procedure,-
33 | FTPSIZELONG=procedure,-
34 | FTPSETCALLBACK=procedure,-
35 | FTPCLEARCALLBACK=procedure)
36 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/ftplib_ia64.opt:
--------------------------------------------------------------------------------
1 | ident=V4.0
2 | gsmatch=lequal,4,0
3 |
4 | ftplib_ia64.obj
5 |
6 | symbol_vector=(-
7 | FTPACCESS=procedure,-
8 | FTPCHDIR=procedure,-
9 | FTPCLOSE=procedure,-
10 | FTPCONNECT=procedure,-
11 | FTPDELETE=procedure,-
12 | FTPDIR=procedure,-
13 | FTPGET=procedure,-
14 | FTPINIT=procedure,-
15 | FTPLASTRESPONSE=procedure,-
16 | FTPLIB_DEBUG=data,-
17 | FTPLOGIN=procedure,-
18 | FTPMKDIR=procedure,-
19 | FTPNLST=procedure,-
20 | FTPPUT=procedure,-
21 | FTPQUIT=procedure,-
22 | FTPREAD=procedure,-
23 | FTPRENAME=procedure,-
24 | FTPRMDIR=procedure,-
25 | FTPSITE=procedure,-
26 | FTPWRITE=procedure,-
27 | FTPPWD=procedure,-
28 | FTPSYSTYPE=procedure,-
29 | FTPCDUP=procedure,-
30 | FTPSIZE=procedure,-
31 | FTPMODDATE=procedure,-
32 | FTPOPTIONS=procedure,-
33 | FTPSIZELONG=procedure,-
34 | FTPSETCALLBACK=procedure,-
35 | FTPCLEARCALLBACK=procedure)
36 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/ftplib_vector.mar:
--------------------------------------------------------------------------------
1 | .title ftplib_vector
2 | .macro xfer rtn
3 | .align quad
4 | .transfer rtn
5 | .mask rtn
6 | jmp rtn+2
7 | .endm
8 | .psect ftplib_vector,quad
9 | xfer FTPACCESS
10 | xfer FTPCHDIR
11 | xfer FTPCLOSE
12 | xfer FTPCONNECT
13 | xfer FTPDELETE
14 | xfer FTPDIR
15 | xfer FTPGET
16 | xfer FTPINIT
17 | xfer FTPLASTRESPONSE
18 | xfer FTPLOGIN
19 | xfer FTPMKDIR
20 | xfer FTPNLST
21 | xfer FTPPUT
22 | xfer FTPQUIT
23 | xfer FTPREAD
24 | xfer FTPRENAME
25 | xfer FTPRMDIR
26 | xfer FTPSITE
27 | xfer FTPWRITE
28 | xfer FTPPWD
29 | xfer FTPSYSTYPE
30 | xfer FTPCDUP
31 | xfer FTPSIZE
32 | xfer FTPMODDATE
33 | xfer FTPOPTIONS
34 | xfer FTPSETCALLBACK
35 | xfer FTPCLEARCALLBACK
36 | .end
37 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/qftp.c:
--------------------------------------------------------------------------------
1 | /***************************************************************************/
2 | /* */
3 | /* qftp.c - command line driven ftp file transfer program */
4 | /* Copyright (C) 1996-2001, 2013 Thomas Pfau, tfpfau@gmail.com */
5 | /* 1407 Thomas Ave, North Brunswick, NJ, 08902 */
6 | /* */
7 | /* This library is free software. You can redistribute it and/or */
8 | /* modify it under the terms of the Artistic License 2.0. */
9 | /* */
10 | /* This library is distributed in the hope that it will be useful, */
11 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
12 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
13 | /* Artistic License 2.0 for more details. */
14 | /* */
15 | /* See the file LICENSE or */
16 | /* http://www.perlfoundation.org/artistic_license_2_0 */
17 | /* */
18 | /***************************************************************************/
19 |
20 | #if defined(__unix__) || defined(__VMS)
21 | #include
22 | #endif
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #if defined(_WIN32)
29 | #include
30 | #include
31 | #include "getopt.h"
32 | #endif
33 |
34 | #include "ftplib.h"
35 |
36 | #if !defined(S_ISDIR)
37 | #define S_ISDIR(m) ((m&S_IFMT) == S_IFDIR)
38 | #endif
39 |
40 | /* exit values */
41 | #define EX_SYNTAX 2 /* command syntax errors */
42 | #define EX_NETDB 3 /* network database errors */
43 | #define EX_CONNECT 4 /* network connect errors */
44 | #define EX_LOGIN 5 /* remote login errors */
45 | #define EX_REMCMD 6 /* remote command errors */
46 | #define EX_SYSERR 7 /* system call errors */
47 |
48 | #define FTP_SEND 1 /* send files */
49 | #define FTP_GET 2 /* retreive files */
50 | #define FTP_DIR 3 /* verbose directory */
51 | #define FTP_RM 4 /* delete files */
52 | #define FTP_LIST 5 /* terse directory */
53 |
54 | #define DIRBUF_SIZE 1024 /* for wildcard processing */
55 |
56 | #if defined(__UINT64_MAX)
57 | #if defined(PRIu64)
58 | #define PRIFSZ PRIu64
59 | #else
60 | #if ULONG_MAX == __UINT32_MAX
61 | #define PRIFSZ "llu"
62 | #else
63 | #define PRIFSZ "lu"
64 | #endif
65 | #endif
66 | #else
67 | #ifdef PRIu32
68 | #define PRIFSZ PRIu32
69 | #else
70 | #define PRIFSZ "u"
71 | #endif
72 | #endif
73 |
74 | static int logged_in = 0;
75 | static char *host = NULL;
76 | static char *user = NULL;
77 | static char *pass = NULL;
78 | static char mode = 'I';
79 | static int action = 0;
80 | static char *invocation;
81 | static netbuf *conn = NULL;
82 | static int wildcard = 0;
83 | static int strippath = 0;
84 |
85 | void usage(void)
86 | {
87 | printf(
88 | "usage: %s \n"
89 | "\t cmd = send | get | dir | list | rm\n"
90 | "\t[ -l user [ -p pass ] ] defaults to anonymous/user@hostname\n"
91 | "\t[\n"
92 | "\t [ -v level ] debug level\n"
93 | "\t [ -r rootpath ] chdir path\n"
94 | "\t [ -m umask ] umask for created files\n"
95 | "\t [ -a | -i ] ] ascii/image transfer file\n"
96 | "\t [ -w ] toggle wildcard mode\n"
97 | "\t [ -s cmd ] issue a SITE command\n"
98 | "\t [ -b ] toggles stripping of path from filename on send\n"
99 | "\t [ file ] file spec for directory or file to transfer\n"
100 | "\t]...\n\n"
101 | "If no files are specified on command line, the program\n"
102 | "will read file names from stdin.\n", invocation);
103 | }
104 |
105 | void ftp_connect(void)
106 | {
107 | if (conn)
108 | return;
109 | if (host == NULL)
110 | {
111 | fprintf(stderr,"Host name not specified\n");
112 | usage();
113 | exit(EX_SYNTAX);
114 | }
115 | if (!logged_in)
116 | {
117 | if (user == NULL)
118 | {
119 | user = "anonymous";
120 | if (pass == NULL)
121 | {
122 | char *u,h[64];
123 | u = getenv("USER");
124 | if (gethostname(h,64) < 0)
125 | {
126 | perror("gethostname");
127 | exit(EX_NETDB);
128 | }
129 | if ((u != NULL) && (h != NULL))
130 | {
131 | static char xxx[256];
132 | sprintf(xxx,"%s@%s",u,h);
133 | pass = xxx;
134 | }
135 | }
136 | }
137 | else if (pass == NULL)
138 | #if defined(_WIN32) || defined(VMS)
139 | exit(EX_LOGIN);
140 | #else
141 | if ((pass = getpass("Password: ")) == NULL)
142 | exit(EX_SYSERR);
143 | #endif
144 | if (!FtpConnect(host,&conn))
145 | {
146 | fprintf(stderr,"Unable to connect to node %s\n",host);
147 | exit(EX_CONNECT);
148 | }
149 | if (!FtpLogin(user,pass,conn))
150 | {
151 | fprintf(stderr,"Login failure\n%s",FtpLastResponse(conn));
152 | exit(EX_LOGIN);
153 | }
154 | logged_in++;
155 | }
156 | }
157 |
158 | void change_directory(char *root)
159 | {
160 | ftp_connect();
161 | if (!FtpChdir(root, conn))
162 | {
163 | fprintf(stderr,"Change directory failed\n%s",FtpLastResponse(conn));
164 | exit(EX_REMCMD);
165 | }
166 | }
167 |
168 | void site_cmd(char *cmd)
169 | {
170 | ftp_connect();
171 | if (!FtpSite( cmd, conn ))
172 | {
173 | fprintf(stderr,"SITE command failed\n%s", FtpLastResponse(conn));
174 | exit(EX_REMCMD);
175 | }
176 | }
177 |
178 | struct REMFILE {
179 | struct REMFILE *next;
180 | fsz_t fsz;
181 | char *fnm;
182 | };
183 |
184 | static int log_progress(netbuf *ctl, fsz_t xfered, void *arg)
185 | {
186 | struct REMFILE *f = (struct REMFILE *) arg;
187 | if ( f->fsz )
188 | {
189 | double pct = (xfered * 100.0) / f->fsz;
190 | printf("%s %5.2f%% %" PRIFSZ "\r", f->fnm, pct, xfered);
191 | }
192 | else
193 | {
194 | printf("%s %" PRIFSZ "\r", f->fnm, xfered);
195 | }
196 | fflush(stdout);
197 | return 1;
198 | }
199 |
200 | void process_file(char *fnm)
201 | {
202 | int sts=0;
203 | fsz_t fsz;
204 | struct REMFILE *filelist = NULL;
205 | struct REMFILE rem;
206 |
207 | ftp_connect();
208 | FtpClearCallback(conn);
209 | if ((action == FTP_SEND) || (action == FTP_GET) || (action == FTP_RM))
210 | {
211 | if (action == FTP_SEND)
212 | {
213 | struct stat info;
214 | if (stat(fnm,&info) == -1)
215 | {
216 | perror(fnm);
217 | return;
218 | }
219 | if (S_ISDIR(info.st_mode))
220 | {
221 | if (!FtpMkdir(fnm, conn))
222 | fprintf(stderr,"mkdir %s failed\n%s",fnm,FtpLastResponse(conn));
223 | else
224 | if (ftplib_debug)
225 | fprintf(stderr,"Directory %s created\n",fnm);
226 | return;
227 | }
228 | fsz = info.st_size;
229 | }
230 | else
231 | {
232 | if (!wildcard)
233 | {
234 | struct REMFILE *f;
235 | f = (struct REMFILE *) malloc(sizeof(struct REMFILE));
236 | memset(f,0,sizeof(struct REMFILE));
237 | f->next = filelist;
238 | filelist = f;
239 | f->fnm = strdup(fnm);
240 | } else {
241 | netbuf *dir;
242 | char *buf;
243 | if (!FtpAccess(fnm, FTPLIB_DIR, FTPLIB_ASCII, conn, &dir))
244 | {
245 | fprintf(stderr,"error requesting directory of %s\n%s\n",
246 | fnm, FtpLastResponse(conn));
247 | return;
248 | }
249 | buf = malloc(DIRBUF_SIZE);
250 | while (FtpRead(buf, DIRBUF_SIZE, dir) > 0)
251 | {
252 | struct REMFILE *f;
253 | char *p;
254 | f = (struct REMFILE *) malloc(sizeof(struct REMFILE));
255 | memset(f,0,sizeof(struct REMFILE));
256 | f->next = filelist;
257 | p = strchr(buf,'\n');
258 | if (p)
259 | *p = '\0';
260 | f->fnm = strdup(buf);
261 | filelist = f;
262 | }
263 | free(buf);
264 | FtpClose(dir);
265 | }
266 | }
267 | }
268 | switch (action)
269 | {
270 | case FTP_DIR :
271 | sts = FtpDir(NULL, fnm, conn);
272 | break;
273 | case FTP_LIST :
274 | sts = FtpNlst(NULL, fnm, conn);
275 | break;
276 | case FTP_SEND :
277 | rem.next = NULL;
278 | rem.fnm = fnm;
279 | rem.fsz = fsz;
280 | fsz /= 100;
281 | if (fsz > 100000)
282 | fsz = 100000;
283 | if (ftplib_debug && fsz)
284 | {
285 | FtpCallbackOptions opt;
286 | opt.cbFunc = log_progress;
287 | opt.cbArg = &rem;
288 | opt.idleTime = 1000;
289 | opt.bytesXferred = fsz;
290 | FtpSetCallback(&opt,conn);
291 | }
292 | sts = FtpPut(fnm,strippath ? basename(fnm) : fnm,mode,conn);
293 | if (ftplib_debug && sts)
294 | printf("%s sent\n",fnm);
295 | break;
296 | case FTP_GET :
297 | while (filelist)
298 | {
299 | struct REMFILE *f = filelist;
300 | filelist = f->next;
301 | #if defined(__UINT64_MAX)
302 | if (!FtpSizeLong(f->fnm, &fsz, mode, conn))
303 | #else
304 | if (!FtpSize(f->fnm, &fsz, mode, conn))
305 | #endif
306 | fsz = 0;
307 | f->fsz = fsz;
308 | fsz /= 100;
309 | if (fsz > 100000)
310 | fsz = 100000;
311 | if ( fsz == 0 )
312 | fsz = 32768;
313 | if (ftplib_debug)
314 | {
315 | FtpCallbackOptions opt;
316 | opt.cbFunc = log_progress;
317 | opt.cbArg = f;
318 | opt.idleTime = 1000;
319 | opt.bytesXferred = fsz;
320 | FtpSetCallback(&opt,conn);
321 | }
322 | sts = FtpGet(f->fnm,f->fnm,mode,conn);
323 | if (ftplib_debug && sts)
324 | printf("%s retrieved\n",f->fnm);
325 | free(f->fnm);
326 | free(f);
327 | }
328 | break;
329 | case FTP_RM :
330 | while (filelist)
331 | {
332 | struct REMFILE *f = filelist;
333 | filelist = f->next;
334 | sts = FtpDelete(f->fnm,conn);
335 | if (ftplib_debug && sts)
336 | printf("%s deleted\n", f->fnm);
337 | free(f->fnm);
338 | free(f);
339 | }
340 | break;
341 | }
342 | if (!sts)
343 | printf("ftp error\n%s\n",FtpLastResponse(conn));
344 | return;
345 | }
346 |
347 | void set_umask(char *m)
348 | {
349 | char buf[80];
350 | sprintf(buf,"umask %s", m);
351 | ftp_connect();
352 | FtpSite(buf, conn);
353 | }
354 |
355 | int main(int argc, char *argv[])
356 | {
357 | int files_processed = 0;
358 | int opt;
359 |
360 | invocation = argv[0];
361 | optind = 1;
362 | if (strstr(argv[0],"send") != NULL)
363 | action = FTP_SEND;
364 | else if (strstr(argv[0],"get") != NULL)
365 | action = FTP_GET;
366 | else if (strstr(argv[0],"dir") != NULL)
367 | action = FTP_DIR;
368 | else if (strstr(argv[0],"list") != NULL)
369 | action = FTP_LIST;
370 | else if (strstr(argv[0],"rm") != NULL)
371 | action = FTP_RM;
372 | if ((action == 0) && (argc > 2))
373 | {
374 | if ( argc < 3 ) /* command + site */
375 | {
376 | usage();
377 | exit( EX_SYNTAX );
378 | }
379 | if (strcmp(argv[1],"send") == 0)
380 | action = FTP_SEND;
381 | else if (strcmp(argv[1],"get") == 0)
382 | action = FTP_GET;
383 | else if (strcmp(argv[1],"dir") == 0)
384 | action = FTP_DIR;
385 | else if (strcmp(argv[1],"list") == 0)
386 | action = FTP_LIST;
387 | else if (strcmp(argv[1],"rm") == 0)
388 | action = FTP_RM;
389 | if (action)
390 | optind++;
391 | }
392 | if (action == 0)
393 | {
394 | usage();
395 | exit(EX_SYNTAX);
396 | }
397 |
398 | FtpInit();
399 |
400 | // while (argv[optind] != NULL)
401 | while ( optind < argc )
402 | {
403 | if (argv[optind][0] != '-')
404 | {
405 | if (host == NULL)
406 | host = argv[optind++];
407 | else
408 | {
409 | process_file(argv[optind++]);
410 | files_processed++;
411 | }
412 | continue;
413 | }
414 | opt = getopt(argc,argv,"abil:m:p:r:s:v:w");
415 | switch (opt)
416 | {
417 | case '?' :
418 | fprintf(stderr,"Invalid option: %c\n", opt);
419 | usage();
420 | exit(EX_SYNTAX);
421 | case ':' :
422 | usage();
423 | exit(EX_SYNTAX);
424 | case 'a' : mode = 'A'; break;
425 | case 'b' : strippath = !strippath; break;
426 | case 'i' : mode = 'I'; break;
427 | case 'l' : user = optarg; break;
428 | case 'm' : set_umask(optarg); break;
429 | case 'p' : pass = optarg; break;
430 | case 'r' : change_directory(optarg); break;
431 | case 's' : site_cmd(optarg); break;
432 | case 'v' :
433 | if (opt == ':')
434 | ftplib_debug++;
435 | else
436 | ftplib_debug = atoi(optarg);
437 | break;
438 | case 'w' : wildcard = !wildcard; break;
439 | default :
440 | usage();
441 | exit(EX_SYNTAX);
442 | }
443 | }
444 |
445 | if (files_processed == 0)
446 | {
447 | ftp_connect();
448 | if ((action == FTP_DIR) || (action == FTP_LIST))
449 | process_file(NULL);
450 | else
451 | {
452 | char fnm[256];
453 | do
454 | {
455 | char *nl;
456 | if (isatty(fileno(stdin)))
457 | printf("file> ");
458 | if (fgets(fnm, sizeof(fnm), stdin) == NULL)
459 | break;
460 | if ((nl = strchr(fnm,'\n')) != NULL)
461 | *nl = '\0';
462 | process_file(fnm);
463 | }
464 | while (1);
465 | }
466 | }
467 | if (conn)
468 | FtpClose(conn);
469 | return 0;
470 | }
471 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/qftp.opt:
--------------------------------------------------------------------------------
1 | qftp.obj
2 | ftplib.exe/share
3 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/qftp_alpha.opt:
--------------------------------------------------------------------------------
1 | qftp_alpha.obj
2 | ftplib_alpha.exe/share
3 |
--------------------------------------------------------------------------------
/Libraries/include/ftplib/src/qftp_ia64.opt:
--------------------------------------------------------------------------------
1 | qftp_ia64.obj
2 | ftplib_ia64.exe/share
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # FTPKit
2 |
3 | Version 1.3.1
4 |
5 | FTPKit is an Objective-C library providing facilities implementing the client
6 | side of the File Transfer Protocol (FTP).
7 |
8 | This lib is based off or inspired by the BlackRaccoon, WhiteReaccoon and Apple's SimpleFTP
9 | example. It utilizes the ftplib library, developed by Thomas Pfau, for most of
10 | the remote actions.
11 |
12 | ## Features
13 |
14 | - List directory contents
15 | - Upload files
16 | - Download files
17 | - Delete remote files and folders
18 | - Change file mode on files (chmod)
19 | - Rename (move) files from one path to another
20 | - All calls are asynchronous
21 | - Built with ARC
22 |
23 | # Tutorial
24 |
25 | ## List directory contents
26 |
27 | #import
28 |
29 | ...
30 |
31 | // Connect and list contents.
32 | FTPClient *client = [FTPClient clientWithHost:@"localhost" port:21 username:@"user" password:@"pass"];
33 | NSArray *contents = [client listContentsAtPath:@"/" showHiddenFiles:NO];
34 |
35 | if (contents /* Returns nil if an error occured */) {
36 | // Iterate through handles. Display them in a table, etc.
37 | for (FTPHandle *handle in handles) {
38 | if (handle.type == FTPHandleTypeFile) {
39 | // Do something with file.
40 | } else if (handle.type == FTPHandleTypeDirectory) {
41 | // Do something with directory.
42 | }
43 | }
44 | } else {
45 | // Display error using: client.lastError
46 | }
47 |
48 | ...
49 |
50 | // Or, make the call asynchronous;
51 | [client listContentsAtPath:@"/test" showHiddenFiles:YES success:^(NSArray *contents) {
52 | if (handle.type == FTPHandleTypeFile) {
53 | // Do something with file.
54 | } else if (handle.type == FTPHandleTypeDirectory) {
55 | // Do something with directory.
56 | }
57 | } failure:^(NSError *error) {
58 | // Display error...
59 | }];
60 |
61 |
62 |
63 | ## Create a new directory
64 |
65 | Continuing on from our previous example; below shows how to create a remote directory.
66 |
67 | BOOL success = [client createDirectoryAtPath:@"/my_new_folder"];
68 | if (! success) {
69 | // Display error...
70 | }
71 |
72 | ...
73 |
74 | // Or, make the call asynchronous;
75 | [client createDirectoryAtPath:@"/my_new_folder" success:^(void) {
76 | // Success!
77 | } failure:^(NSError *error) {
78 | // Display an error...
79 | }];
80 |
81 | ## Download a file
82 |
83 | BOOL success = [client downloadFile:@"/index.html" to:@"/Users/me/index.html"];
84 | if (! success) {
85 | // Display an error...
86 | }
87 |
88 | ...
89 |
90 | // Or, make the call asynchronous;
91 | [client downloadFile:@"/index.html" to:@"/Users/me/index.html" progress:NULL success:^(void) {
92 | // Success!
93 | } failure:^(NSError *error) {
94 | // Display an error...
95 | }];
96 |
97 | Please note that the `progress:` parameter has not yet been implemented.
98 |
99 | ## Upload a file
100 |
101 | // Upload index.html to the /public/ directory on the FTP server.
102 | BOOL success = [client uploadFile:@"index.html" to:@"/public/index.html"];
103 | if (! success) {
104 | // Display an error...
105 | }
106 |
107 | ...
108 |
109 | // Or, make the call asynchronous;
110 | [client uploadFile:@"index.html" to:@"/public/index.html" progress:NULL success:^(void) {
111 | // Success!
112 | } failure:^(NSError *error) {
113 | // Display an error...
114 | }];
115 |
116 | ## Rename a file
117 |
118 | // You can easily rename (or move) a file from one path to another.
119 | BOOL success = [client renamePath:@"/index.html" to:@"/public/index.html"];
120 | if (! success) {
121 | // Display an error...
122 | }
123 |
124 | ...
125 |
126 | // Or, make the call asynchronous;
127 | [client renamePath:@"/index.html" to:@"/public/index.html" success:^(void) {
128 | // Success!
129 | } failure:^(NSError *error) {
130 | // Display an error...
131 | }];
132 |
133 | ## Delete a file
134 |
135 | // You can either provide a FTPHandle or a path on the FTP server to delete.
136 | // The FTPHandle will have been returned from the listDirectory* method.
137 | BOOL success = [client deleteFileAtPath:@"/path/deleteme.html"];
138 | if (! success) {
139 | // Display an error...
140 | }
141 |
142 | ...
143 |
144 | // Or, make the call asynchronous;
145 | [client deleteFileAtPath:@"/path/deleteme.html" success:^(void) {
146 | // Success!
147 | } failure:^(NSError *error) {
148 | // Display an error...
149 | }];
150 |
151 | ## chmod a file
152 |
153 | BOOL success = [client chmodPath:@"/public/defaceme.html" toMode:777];
154 | if (! success) {
155 | // Display an error...
156 | }
157 |
158 | ...
159 |
160 | // Or, make the call asynchronous;
161 | [client chmodPath:@"/public/defaceme.html" toMode:777 success:^(void) {
162 | // Success!
163 | } failure:^(NSError *error) {
164 | // Display an error...
165 | }];
166 |
167 | ## Check if a directory exists
168 |
169 | BOOL success = [ftp directoryExistsAtPath:@"/mypath"];
170 | if (! success) {
171 | // Display an error...
172 | }
173 |
174 | ...
175 |
176 | // Or, make the call asynchronous;
177 | [ftp directoryExistsAtPath:@"/mypath" success:^(BOOL exists) {
178 | if (exists) {
179 | // The file exists.
180 | } else {
181 | // The file doesn't exist.
182 | }
183 | } failure:^(NSError *error) {
184 | // Display an error...
185 | }];
186 |
187 | # Setup & Integration
188 |
189 | ## Requirements
190 |
191 | This project was developed using Xcode 5.0. It requires a deployment target of iOS 7 or greater or OS X 10.9. It will work with ARC projects. I'm not sure about non-ARC projects.
192 |
193 | ## Required Frameworks
194 |
195 | - Foundation
196 |
197 | If you add FTPKit to your project as a static library, you will need to set the **-ObjC** and **-all_load** linker flags. Look below for more details.
198 |
199 | ## Integration
200 |
201 | 1. Drag the "FTPKit.xcodeproj" into your project.
202 | 2. Add the FTPKit (FTPKit) as a Target Dependency (refer to the screehnshot below)
203 | 3. Add the required library and frameworks (refer screenshot below).
204 | - Open the "Build Phases" tab
205 | - Expand Link Binary With Libraries
206 | - Click the "+" button and add CFNetwork.framework, Foundation.framework and libFTPKit.a
207 | 4. Add linker flags.
208 | - Open the "Build Settings" tab
209 | - Find "Other Linker Flags" and set the value to **-ObjC -all_load**
210 | 5. Add the FTPKit header file, **#import \**, where you want to use the library.
211 |
212 | ### Notes
213 |
214 | The #import \ header may not be recognized until you build the project. After the project builds for the first time the error will go away.
215 |
216 | ![][1]
217 |
218 |
219 | [1]: https://dl.dropboxusercontent.com/u/55773661/FTPKit/xcode.png
220 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample.xcodeproj/project.xcworkspace/xcuserdata/eric.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PeqNP/FTPKit/0db6817d7161f35a8b9b4a483784d180e3f6fc09/Sample/FTPKitSample/FTPKitSample.xcodeproj/project.xcworkspace/xcuserdata/eric.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample.xcodeproj/xcuserdata/eric.xcuserdatad/xcschemes/FTPKitSample.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
49 |
50 |
51 |
52 |
61 |
62 |
68 |
69 |
70 |
71 |
72 |
73 |
79 |
80 |
86 |
87 |
88 |
89 |
91 |
92 |
95 |
96 |
97 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample.xcodeproj/xcuserdata/eric.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | FTPKitSample.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 076BD41518CE376D00517DEE
16 |
17 | primary
18 |
19 |
20 | 076BD43018CE376D00517DEE
21 |
22 | primary
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/AppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.h
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface AppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/AppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // AppDelegate.m
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import "AppDelegate.h"
10 | #import "MainViewController.h"
11 |
12 | @implementation AppDelegate
13 |
14 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
15 | {
16 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
17 | MainViewController *root = [[MainViewController alloc] init];
18 | UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:root];
19 | self.window.rootViewController = nav;
20 | self.window.backgroundColor = [UIColor whiteColor];
21 | [self.window makeKeyAndVisible];
22 | return YES;
23 | }
24 |
25 | - (void)applicationWillResignActive:(UIApplication *)application
26 | {
27 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
28 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
29 | }
30 |
31 | - (void)applicationDidEnterBackground:(UIApplication *)application
32 | {
33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
35 | }
36 |
37 | - (void)applicationWillEnterForeground:(UIApplication *)application
38 | {
39 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
40 | }
41 |
42 | - (void)applicationDidBecomeActive:(UIApplication *)application
43 | {
44 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
45 | }
46 |
47 | - (void)applicationWillTerminate:(UIApplication *)application
48 | {
49 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/FTPKitSample-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIdentifier
12 | com.upstart-illustration-llc.${PRODUCT_NAME:rfc1034identifier}
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | ${PRODUCT_NAME}
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | 1.0
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | 1.0
25 | LSRequiresIPhoneOS
26 |
27 | UIRequiredDeviceCapabilities
28 |
29 | armv7
30 |
31 | UISupportedInterfaceOrientations
32 |
33 | UIInterfaceOrientationPortrait
34 | UIInterfaceOrientationLandscapeLeft
35 | UIInterfaceOrientationLandscapeRight
36 |
37 | UISupportedInterfaceOrientations~ipad
38 |
39 | UIInterfaceOrientationPortrait
40 | UIInterfaceOrientationPortraitUpsideDown
41 | UIInterfaceOrientationLandscapeLeft
42 | UIInterfaceOrientationLandscapeRight
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/FTPKitSample-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header
3 | //
4 | // The contents of this file are implicitly included at the beginning of every source file.
5 | //
6 |
7 | #import
8 |
9 | #ifndef __IPHONE_3_0
10 | #warning "This project uses features only available in iOS SDK 3.0 and later."
11 | #endif
12 |
13 | #ifdef __OBJC__
14 | #import
15 | #import
16 | #endif
17 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "size" : "29x29",
6 | "scale" : "2x"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "size" : "40x40",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "size" : "60x60",
16 | "scale" : "2x"
17 | },
18 | {
19 | "idiom" : "ipad",
20 | "size" : "29x29",
21 | "scale" : "1x"
22 | },
23 | {
24 | "idiom" : "ipad",
25 | "size" : "29x29",
26 | "scale" : "2x"
27 | },
28 | {
29 | "idiom" : "ipad",
30 | "size" : "40x40",
31 | "scale" : "1x"
32 | },
33 | {
34 | "idiom" : "ipad",
35 | "size" : "40x40",
36 | "scale" : "2x"
37 | },
38 | {
39 | "idiom" : "ipad",
40 | "size" : "76x76",
41 | "scale" : "1x"
42 | },
43 | {
44 | "idiom" : "ipad",
45 | "size" : "76x76",
46 | "scale" : "2x"
47 | }
48 | ],
49 | "info" : {
50 | "version" : 1,
51 | "author" : "xcode"
52 | }
53 | }
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Images.xcassets/LaunchImage.launchimage/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "orientation" : "portrait",
5 | "idiom" : "iphone",
6 | "extent" : "full-screen",
7 | "minimum-system-version" : "7.0",
8 | "scale" : "2x"
9 | },
10 | {
11 | "orientation" : "portrait",
12 | "idiom" : "iphone",
13 | "subtype" : "retina4",
14 | "extent" : "full-screen",
15 | "minimum-system-version" : "7.0",
16 | "scale" : "2x"
17 | },
18 | {
19 | "orientation" : "portrait",
20 | "idiom" : "ipad",
21 | "extent" : "full-screen",
22 | "minimum-system-version" : "7.0",
23 | "scale" : "1x"
24 | },
25 | {
26 | "orientation" : "landscape",
27 | "idiom" : "ipad",
28 | "extent" : "full-screen",
29 | "minimum-system-version" : "7.0",
30 | "scale" : "1x"
31 | },
32 | {
33 | "orientation" : "portrait",
34 | "idiom" : "ipad",
35 | "extent" : "full-screen",
36 | "minimum-system-version" : "7.0",
37 | "scale" : "2x"
38 | },
39 | {
40 | "orientation" : "landscape",
41 | "idiom" : "ipad",
42 | "extent" : "full-screen",
43 | "minimum-system-version" : "7.0",
44 | "scale" : "2x"
45 | }
46 | ],
47 | "info" : {
48 | "version" : 1,
49 | "author" : "xcode"
50 | }
51 | }
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/MainViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // MainViewController.h
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "TestCase.h"
11 |
12 | @interface MainViewController : UIViewController
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/MainViewController.m:
--------------------------------------------------------------------------------
1 | //
2 | // MainViewController.m
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import "MainViewController.h"
10 | #import "GeneralTest.h"
11 | #import "HandleTest.h"
12 | #import "PerformanceTest.h"
13 |
14 | @interface MainViewController ()
15 | @property (nonatomic, strong) TestCase *testCase;
16 | @end
17 |
18 | @implementation MainViewController
19 |
20 | @synthesize testCase;
21 |
22 | - (void)viewDidLoad
23 | {
24 | [super viewDidLoad];
25 |
26 | UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
27 | button.frame = CGRectMake(10.0f, 70.0f, 100.0f, 30.0f);
28 | button.backgroundColor = [UIColor lightGrayColor];
29 | [button setTitle:@"Start Tests" forState:UIControlStateNormal];
30 | [button addTarget:self action:@selector(startTests) forControlEvents:UIControlEventTouchUpInside];
31 | [self.view addSubview:button];
32 | }
33 |
34 | - (void)startTests
35 | {
36 | [self testGeneral];
37 | //[self testHandle];
38 | }
39 |
40 | - (void)testGeneral
41 | {
42 | self.testCase = [[GeneralTest alloc] init];
43 | testCase.delegate = self;
44 | [testCase run];
45 | }
46 |
47 | - (void)testHandle
48 | {
49 | self.testCase = [[HandleTest alloc] init];
50 | testCase.delegate = self;
51 | [testCase run];
52 | }
53 |
54 | - (void)testPerformance
55 | {
56 | self.testCase = [[PerformanceTest alloc] init];
57 | testCase.delegate = self;
58 | [testCase run];
59 | }
60 |
61 | // TestCaseDelegate
62 |
63 | - (void)testCaseDidFinish:(TestCase *)aTestCase
64 | {
65 | NSLog(@"END %@", NSStringFromClass([aTestCase class]));
66 | if ([aTestCase isKindOfClass:[GeneralTest class]])
67 | {
68 | [self testPerformance];
69 | }
70 | else if ([aTestCase isKindOfClass:[PerformanceTest class]])
71 | {
72 | [self testHandle];
73 | }
74 | else
75 | {
76 | self.testCase = nil;
77 | }
78 | }
79 |
80 | @end
81 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/GeneralTest.h:
--------------------------------------------------------------------------------
1 | /*
2 | * This tests every FTP function synchronously. It does not test for edge
3 | * cases. This file can be used as a way to learn how the API works.
4 | */
5 |
6 | #import
7 | #import "TestCase.h"
8 |
9 | @interface GeneralTest : TestCase
10 |
11 | @end
12 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/GeneralTest.m:
--------------------------------------------------------------------------------
1 |
2 | #import "GeneralTest.h"
3 |
4 | @implementation GeneralTest
5 |
6 | - (void)run
7 | {
8 | // TODO:
9 | // Make sure hidden files are returned.
10 | // Make sure you can not rename a file to a dest file that already exists.
11 |
12 | self.ftp = [FTPClient clientWithHost:@"localhost" port:21 username:@"unittest" password:@"unitpass"];
13 | NSURL *localUrl = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:@"ftplib.tgz"];
14 |
15 | [ftp directoryExistsAtPath:@"/" success:^(BOOL exists) {
16 | if (exists) {
17 | NSLog(@"Success: 000");
18 | } else {
19 | NSLog(@"Error: Root path '/' must exist");
20 | }
21 | } failure:^(NSError *error) {
22 | NSLog(@"Error: %@", error.localizedDescription);
23 | }];
24 |
25 | // Note: All of these actions will queue in the order they are called.
26 | // Note: All of these tests are 1 to 1 relationship with the tests used within
27 | // the FTPKit, except the actions are synchronized.
28 | [ftp listContentsAtPath:@"/test" showHiddenFiles:YES success:^(NSArray *contents) {
29 | if (contents.count == 0) {
30 | NSLog(@"Success 001");
31 | } else {
32 | NSLog(@"Error: Should not have no contents!");
33 | }
34 | } failure:^(NSError *error) {
35 | NSLog(@"Error: %@", error.localizedDescription);
36 | }];
37 |
38 | /*
39 | * @todo
40 | *
41 | long long int bytes = [ftp fileSizeAtPath:@"/ftplib.tgz"];
42 | XCTAssertTrue((bytes > 0), @"");
43 |
44 | bytes = [ftp fileSizeAtPath:@"/copy.tgz"];
45 | XCTAssertEqual(-1, -1, @"");
46 | */
47 |
48 | [ftp downloadFile:@"/ftplib.tgz" to:localUrl.path progress:NULL success:^(void) {
49 | NSLog(@"Success 002");
50 | } failure:^(NSError *error) {
51 | NSLog(@"Error: %@", error.localizedDescription);
52 | }];
53 |
54 | [ftp uploadFile:localUrl.path to:@"/copy.tgz" progress:NULL success:^(void) {
55 | NSLog(@"Success 003");
56 | } failure:^(NSError *error) {
57 | NSLog(@"Error: %@", error.localizedDescription);
58 | }];
59 |
60 | [ftp chmodPath:@"/copy.tgz" toMode:777 success:^(void) {
61 | NSLog(@"Success 004");
62 | } failure:^(NSError *error) {
63 | NSLog(@"Error: %@", error.localizedDescription);
64 | }];
65 |
66 | [ftp createDirectoryAtPath:@"/test" success:^(void) {
67 | NSLog(@"Success 005");
68 | } failure:^(NSError *error) {
69 | NSLog(@"Error: %@", error.localizedDescription);
70 | }];
71 |
72 | // chmod 'test' to 777
73 | [ftp chmodPath:@"/test" toMode:777 success:^(void) {
74 | NSLog(@"Success 006");
75 | } failure:^(NSError *error) {
76 | NSLog(@"Error: %@", error.localizedDescription);
77 | }];
78 |
79 | [ftp listContentsAtPath:@"/test" showHiddenFiles:YES success:^(NSArray *contents) {
80 | if (contents.count == 0) {
81 | NSLog(@"Success 007");
82 | } else {
83 | NSLog(@"Error: Should not have no contents!");
84 | }
85 | } failure:^(NSError *error) {
86 | NSLog(@"Error: %@", error.localizedDescription);
87 | }];
88 |
89 | [ftp renamePath:@"/copy.tgz" to:@"/test/copy.tgz" success:^(void) {
90 | NSLog(@"Success 008");
91 | } failure:^(NSError *error) {
92 | NSLog(@"Error: %@", error.localizedDescription);
93 | }];
94 |
95 | [ftp createDirectoryAtPath:@"/test/test2" success:^(void) {
96 | NSLog(@"Success 009");
97 | } failure:^(NSError *error) {
98 | NSLog(@"Error: %@", error.localizedDescription);
99 | }];
100 |
101 | [ftp listContentsAtPath:@"/test" showHiddenFiles:YES success:^(NSArray *contents) {
102 | if (contents.count == 2) {
103 | NSLog(@"Success 010");
104 | } else {
105 | NSLog(@"Error: Must have contents!");
106 | }
107 | } failure:^(NSError *error) {
108 | NSLog(@"Error: %@", error.localizedDescription);
109 | }];
110 |
111 | [ftp deleteDirectoryAtPath:@"/test" success:^(void) {
112 | NSLog(@"Error: Should have failed!");
113 | } failure:^(NSError *error) {
114 | NSLog(@"Success 011 -- Error: %@", error.localizedDescription);
115 | }];
116 |
117 | [ftp deleteFileAtPath:@"/test/copy.tgz" success:^(void) {
118 | NSLog(@"Success 012");
119 | } failure:^(NSError *error) {
120 | NSLog(@"Error: %@", error.localizedDescription);
121 | }];
122 |
123 | [ftp deleteDirectoryAtPath:@"/test/test2" success:^(void) {
124 | NSLog(@"Success 013");
125 | } failure:^(NSError *error) {
126 | NSLog(@"Error: %@", error.localizedDescription);
127 | }];
128 |
129 | // Add a file that has a space in the name.
130 | [ftp uploadFile:localUrl.path to:@"/test/Hello World.tgz" progress:NULL success:^(void) {
131 | NSLog(@"Success 013-a");
132 | } failure:^(NSError *error) {
133 | NSLog(@"Error: %@", error.localizedDescription);
134 | }];
135 |
136 | [ftp chmodPath:@"/test/Hello World.tgz" toMode:777 success:^(void) {
137 | NSLog(@"Success 013-b");
138 | } failure:^(NSError *error) {
139 | NSLog(@"Error: %@", error.localizedDescription);
140 | }];
141 |
142 | [ftp renamePath:@"/test/Hello World.tgz" to:@"/test/eric test.tgz" success:^(void) {
143 | NSLog(@"Success 013-c");
144 | } failure:^(NSError *error) {
145 | NSLog(@"Error: %@", error.localizedDescription);
146 | }];
147 |
148 | [ftp lastModifiedAtPath:@"/test/eric test.tgz" success:^(NSDate *lastModified) {
149 | NSLog(@"Success 013-d -- Date: %@", lastModified);
150 | long long filesize = [ftp fileSizeAtPath:@"/test/eric test.tgz"];
151 | if (filesize > 0) {
152 | NSLog(@"Success 013-e -- Size: %llu", filesize);
153 | } else {
154 | NSLog(@"Error: filesizeAtPath: failed.");
155 | }
156 | } failure:^(NSError *error) {
157 | NSLog(@"Error: %@", error.localizedDescription);
158 | }];
159 |
160 | [ftp listContentsAtPath:@"/test" showHiddenFiles:NO success:^(NSArray *contents) {
161 | if (contents.count == 1) {
162 | NSLog(@"Success 013-f -- Contents (%@)", ((FTPHandle *)[contents objectAtIndex:0]).name);
163 | } else {
164 | NSLog(@"Error: Too many folders (%@)", [contents componentsJoinedByString:@", "]);
165 | }
166 | } failure:^(NSError *error) {
167 | NSLog(@"Error: %@", error.localizedDescription);
168 | }];
169 |
170 | [ftp deleteFileAtPath:@"/test/eric test.tgz" success:^(void) {
171 | NSLog(@"Success 013-g");
172 | } failure:^(NSError *error) {
173 | NSLog(@"Error: %@", error.localizedDescription);
174 | }];
175 |
176 | [ftp createDirectoryAtPath:@"/test/Hello World" success:^(void) {
177 | NSLog(@"Success 013-h");
178 | if ([ftp changeDirectoryToPath:@"/test/Hello World"]) {
179 | NSLog(@"Success 013-i");
180 | } else {
181 | NSLog(@"Error: Failed to change directory w/ space in name");
182 | }
183 | } failure:^(NSError *error) {
184 | NSLog(@"Error: %@", error.localizedDescription);
185 | }];
186 |
187 | [ftp directoryExistsAtPath:@"/test/Hello World" success:^(BOOL exists) {
188 | if (exists) {
189 | NSLog(@"Success 013-j");
190 | } else {
191 | NSLog(@"Error: Failed to determine if directory exists w/ space in name");
192 | }
193 | } failure:^(NSError *error) {
194 | NSLog(@"Error: %@", error.localizedDescription);
195 | }];
196 |
197 | // @todo Add contents to this folder before testing.
198 | [ftp listContentsAtPath:@"/test/Hello World" showHiddenFiles:NO success:^(NSArray *contents) {
199 | NSLog(@"Success 013-k -- Contents.count (%lu)", contents.count);
200 | } failure:^(NSError *error) {
201 | NSLog(@"Error: %@", error.localizedDescription);
202 | }];
203 |
204 | [ftp deleteDirectoryAtPath:@"/test/Hello World" success:^(void) {
205 | NSLog(@"Success 013-l");
206 | } failure:^(NSError *error) {
207 | NSLog(@"Error: %@", error.localizedDescription);
208 | }];
209 |
210 | // @todo one more.. can't remember.
211 |
212 | [ftp deleteDirectoryAtPath:@"/test" success:^(void) {
213 | NSLog(@"Success 014");
214 | } failure:^(NSError *error) {
215 | NSLog(@"Error: %@", error.localizedDescription);
216 | }];
217 |
218 | [ftp directoryExistsAtPath:@"/badpath" success:^(BOOL exists) {
219 | if (exists) {
220 | NSLog(@"Error: /badpath should not exist");
221 | } else {
222 | NSLog(@"Success 015");
223 | }
224 | } failure:^(NSError *error) {
225 | NSLog(@"Error: %@", error.localizedDescription);
226 | }];
227 |
228 | [ftp lastModifiedAtPath:@"/ftplib.tgz" success:^(NSDate *lastModified) {
229 | NSLog(@"Success 016 -- Date: %@", lastModified);
230 | } failure:^(NSError *error) {
231 | NSLog(@"Error: %@", error.localizedDescription);
232 | }];
233 | }
234 |
235 | @end
236 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/HandleTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // HandleTests.h
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/11/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import "TestCase.h"
11 |
12 | @interface HandleTest : TestCase
13 |
14 | @end
15 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/HandleTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // HandleTests.m
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/11/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import "HandleTest.h"
10 |
11 | @implementation HandleTest
12 |
13 | - (void)run
14 | {
15 | // @todo Make sure that files that contain spaces, or special characters,
16 | // are escaped as they should before being sent to the FTP server.
17 | // Test: Create /My File.txt (file)
18 | // Create /My (file)
19 | // Create /My File (directory)
20 | // Test: Delete file /My File.txt
21 | // This should not delete '/My'
22 | // Test: Delete folder with space
23 |
24 | [self connect];
25 | NSURL *localUrl = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:@"My File.tgz"];
26 | }
27 |
28 | @end
29 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/PerformanceTest.h:
--------------------------------------------------------------------------------
1 | //
2 | // PerformanceTest.h
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/11/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import "TestCase.h"
10 |
11 | @interface PerformanceTest : TestCase
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/PerformanceTest.m:
--------------------------------------------------------------------------------
1 | //
2 | // PerformanceTest.m
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/11/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import "PerformanceTest.h"
10 |
11 | #define NUM_TESTS 50
12 |
13 | @interface PerformanceTest()
14 | @property (nonatomic, assign) NSInteger counter;
15 | @property (nonatomic, strong) NSString *localPath;
16 | @end
17 |
18 | @implementation PerformanceTest
19 |
20 | - (void)run
21 | {
22 | // Test: Uploading a file 1000x
23 | // Test: Downloading a file 1000x
24 | _counter = 0;
25 |
26 | [self connect];
27 | NSURL *localUrl = [[[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject] URLByAppendingPathComponent:@"ftplib.tgz"];
28 | self.localPath = localUrl.path;
29 | }
30 |
31 | @end
32 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/TestCase.h:
--------------------------------------------------------------------------------
1 | //
2 | // TestCase.h
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 |
12 | @class TestCase;
13 |
14 | @protocol TestCaseDelegate
15 | - (void)testCaseDidFinish:(TestCase *)testCase;
16 | @end
17 |
18 | @interface TestCase : NSObject
19 | {
20 | FTPClient *ftp;
21 | }
22 |
23 | @property (nonatomic, weak) id delegate;
24 | @property (nonatomic, strong) FTPClient *ftp;
25 |
26 | - (void)connect;
27 | - (void)run;
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/Tests/TestCase.m:
--------------------------------------------------------------------------------
1 | //
2 | // TestCase.m
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import "TestCase.h"
10 |
11 | @implementation TestCase
12 |
13 | @synthesize ftp;
14 |
15 | - (void)connect
16 | {
17 | self.ftp = [FTPClient clientWithHost:@"localhost" port:21 username:@"unittest" password:@"unitpass"];
18 | }
19 |
20 | - (void)run
21 | {
22 | // Nothing to do.
23 | }
24 |
25 | @end
26 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSample/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // FTPKitSample
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "AppDelegate.h"
12 |
13 | int main(int argc, char * argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSampleTests/FTPKitSampleTests-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | ${EXECUTABLE_NAME}
9 | CFBundleIdentifier
10 | com.upstart-illustration-llc.${PRODUCT_NAME:rfc1034identifier}
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundlePackageType
14 | BNDL
15 | CFBundleShortVersionString
16 | 1.0
17 | CFBundleSignature
18 | ????
19 | CFBundleVersion
20 | 1
21 |
22 |
23 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSampleTests/FTPKitSampleTests.m:
--------------------------------------------------------------------------------
1 | //
2 | // FTPKitSampleTests.m
3 | // FTPKitSampleTests
4 | //
5 | // Created by Eric Chamberlain on 3/10/14.
6 | // Copyright (c) 2014 Upstart Illustration LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface FTPKitSampleTests : XCTestCase
12 |
13 | @end
14 |
15 | @implementation FTPKitSampleTests
16 |
17 | - (void)setUp
18 | {
19 | [super setUp];
20 | // Put setup code here. This method is called before the invocation of each test method in the class.
21 | }
22 |
23 | - (void)tearDown
24 | {
25 | // Put teardown code here. This method is called after the invocation of each test method in the class.
26 | [super tearDown];
27 | }
28 |
29 | - (void)testExample
30 | {
31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__);
32 | }
33 |
34 | @end
35 |
--------------------------------------------------------------------------------
/Sample/FTPKitSample/FTPKitSampleTests/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------