Skip to content

Commit

Permalink
Migrate to Cocoapods
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisballinger committed Apr 10, 2014
1 parent 8c8df56 commit af7dcd0
Show file tree
Hide file tree
Showing 17 changed files with 1,298 additions and 444 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ xcuserdata
.svn
DerivedData
*.orig

Pods/
19 changes: 19 additions & 0 deletions PodSpecs/libplist.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Pod::Spec.new do |s|
s.name = 'libplist'
s.version = '1.11'
s.summary = 'A library to handle Apple Property List format in binary or XML'

s.homepage = 'https://github.com/libimobiledevice/libplist'
s.license = { :type => 'LGPL2.1+', :file => 'COPYING.LESSER' }

s.authors = { 'Chris Ballinger' => '[email protected]'} # Podspec maintainer
s.platform = :osx, '10.7'
s.source = { :git => 'https://github.com/libimobiledevice/libplist.git', :tag => s.version.to_s}
s.source_files = 'src/*.{h,c,m,cpp}', 'libcnary/*.{h,c,m,cpp}', 'libcnary/include/*.h'
s.public_header_files = 'include/*.h'
s.library = 'xml2'
s.preserve_paths = 'include/plist/*.*'
s.xcconfig = {"HEADER_SEARCH_PATHS" => '"$(SDKROOT)/usr/include/libxml2" "${PODS_ROOT}/libplist/include/"'}
s.requires_arc = false
end

20 changes: 20 additions & 0 deletions PodSpecs/libusbmuxd.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Pod::Spec.new do |s|
s.name = 'libusbmuxd'
s.version = '1.0.9'
s.summary = 'A client library to multiplex connections from and to iOS devices'

s.homepage = 'https://github.com/libimobiledevice/libusbmuxd'
s.license = { :type => 'LGPL2.1+', :file => 'COPYING.LGPLv2.1' }

s.authors = { 'Chris Ballinger' => '[email protected]'} # Podspec maintainer
s.platform = :osx, '10.7'
s.source = { :git => 'https://github.com/libimobiledevice/libusbmuxd.git', :tag => s.version.to_s}
s.source_files = 'src/*.{h,c}', 'include/*.h'
s.public_header_files = 'include/*.h'
#s.preserve_paths = 'include/*.h'
s.dependency 'libplist', '~> 1.11'
s.xcconfig = {'OTHER_CFLAGS' => '$(inherited) -DHAS_PLIST',
'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/libplist/include/"'}
s.requires_arc = false
end

4 changes: 4 additions & 0 deletions Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pod 'libplist', :podspec => 'PodSpecs/libplist.podspec'
pod 'libusbmuxd', :podspec => 'PodSpecs/libusbmuxd.podspec'
pod 'CocoaAsyncSocket', '~> 7.3'
pod 'CocoaLumberjack', '~> 1.8'
30 changes: 30 additions & 0 deletions Podfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
PODS:
- CocoaAsyncSocket (7.3.4)
- CocoaLumberjack (1.8.1):
- CocoaLumberjack/Extensions
- CocoaLumberjack/Core (1.8.1)
- CocoaLumberjack/Extensions (1.8.1):
- CocoaLumberjack/Core
- libplist (1.11)
- libusbmuxd (1.0.9):
- libplist (~> 1.11)

DEPENDENCIES:
- CocoaAsyncSocket (~> 7.3)
- CocoaLumberjack (~> 1.8)
- libplist (from `PodSpecs/libplist.podspec`)
- libusbmuxd (from `PodSpecs/libusbmuxd.podspec`)

EXTERNAL SOURCES:
libplist:
:podspec: PodSpecs/libplist.podspec
libusbmuxd:
:podspec: PodSpecs/libusbmuxd.podspec

SPEC CHECKSUMS:
CocoaAsyncSocket: 534d09416f992fd51efb23f534742ce70b3a7999
CocoaLumberjack: 020378ec400d658923bf5887178394f65f052c90
libplist: 36d0286d0b8adc3f11006f9880a204deac67f017
libusbmuxd: 28b1bfe677f556970487b644ce2d324f09e13121

COCOAPODS: 0.31.1
1 change: 0 additions & 1 deletion Submodules/libplist
Submodule libplist deleted from c56c81
1 change: 0 additions & 1 deletion Submodules/libusbmuxd
Submodule libusbmuxd deleted from fff774
511 changes: 69 additions & 442 deletions Tether.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Tether.xcworkspace/contents.xcworkspacedata

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

89 changes: 89 additions & 0 deletions Tether.xcworkspace/xcshareddata/Tether.xccheckout
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http:https://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDESourceControlProjectFavoriteDictionaryKey</key>
<false/>
<key>IDESourceControlProjectIdentifier</key>
<string>68D77D00-2CCB-40B7-8B7B-AC1AAFC4B246</string>
<key>IDESourceControlProjectName</key>
<string>Tether</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>0ED34DCF-5560-47B6-B675-5A8237DA9A1A</key>
<string>ssh:https://github.com/chrisballinger/Tether-iOS.git</string>
<key>1B8752AE-100F-4DFD-AA86-355CF0392E0A</key>
<string>ssh:https://github.com/chrisballinger/ProxyKit.git</string>
<key>72CEDF93-3DC8-4ED5-8D90-D887BCE9A1C6</key>
<string>ssh:https://github.com/robbiehanson/CocoaAsyncSocket.git</string>
<key>B1DFC0A1-0D57-426D-AE3F-E8DABD0942E5</key>
<string>ssh:https://github.com/libimobiledevice/libplist.git</string>
<key>C72E8FC4-C6BC-42E4-A89B-F36567CFEAE4</key>
<string>ssh:https://github.com/libimobiledevice/libusbmuxd.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>Tether.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>0ED34DCF-5560-47B6-B675-5A8237DA9A1A</key>
<string>..</string>
<key>1B8752AE-100F-4DFD-AA86-355CF0392E0A</key>
<string>../Submodules/ProxyKit</string>
<key>72CEDF93-3DC8-4ED5-8D90-D887BCE9A1C6</key>
<string>../Submodules/CocoaAsyncSocket</string>
<key>B1DFC0A1-0D57-426D-AE3F-E8DABD0942E5</key>
<string>../Submodules/libplist</string>
<key>C72E8FC4-C6BC-42E4-A89B-F36567CFEAE4</key>
<string>../Submodules/libusbmuxd</string>
</dict>
<key>IDESourceControlProjectURL</key>
<string>ssh:https://github.com/chrisballinger/Tether-iOS.git</string>
<key>IDESourceControlProjectVersion</key>
<integer>110</integer>
<key>IDESourceControlProjectWCCIdentifier</key>
<string>0ED34DCF-5560-47B6-B675-5A8237DA9A1A</string>
<key>IDESourceControlProjectWCConfigurations</key>
<array>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>72CEDF93-3DC8-4ED5-8D90-D887BCE9A1C6</string>
<key>IDESourceControlWCCName</key>
<string>CocoaAsyncSocket</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>B1DFC0A1-0D57-426D-AE3F-E8DABD0942E5</string>
<key>IDESourceControlWCCName</key>
<string>libplist</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>C72E8FC4-C6BC-42E4-A89B-F36567CFEAE4</string>
<key>IDESourceControlWCCName</key>
<string>libusbmuxd</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>1B8752AE-100F-4DFD-AA86-355CF0392E0A</string>
<key>IDESourceControlWCCName</key>
<string>ProxyKit</string>
</dict>
<dict>
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
<string>public.vcs.git</string>
<key>IDESourceControlWCCIdentifierKey</key>
<string>0ED34DCF-5560-47B6-B675-5A8237DA9A1A</string>
<key>IDESourceControlWCCName</key>
<string>Tether-iOS</string>
</dict>
</array>
</dict>
</plist>
4 changes: 4 additions & 0 deletions Tether/CBDeviceWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "USBMuxClient.h"
#import "USBMuxDevice.h"
#import "CBDeviceConnection.h"
#import "CBTunDevice.h"

const static uint16_t kDefaultLocalPortNumber = 8000;
const static uint16_t kDefaultRemotePortNumber = 8123;
Expand Down Expand Up @@ -130,6 +131,9 @@ - (NSView *)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn
}

- (IBAction)refreshButtonPressed:(id)sender {
CBTunDevice *tunDevice = [[CBTunDevice alloc] init];
[tunDevice openTun];

if (self.listeningSocket) {
NSLog(@"Disconnecting local socket");
[self.listeningSocket disconnect];
Expand Down
14 changes: 14 additions & 0 deletions Tether/CBNetworkServiceEditor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//
// CBNetworkServiceEditor.h
// Tether
//
// Created by Christopher Ballinger on 3/31/14.
// Copyright (c) 2014 Christopher Ballinger. All rights reserved.
//
// http:https://stackoverflow.com/a/6375307/805882

#import <Foundation/Foundation.h>

@interface CBNetworkServiceEditor : NSObject

@end
28 changes: 28 additions & 0 deletions Tether/CBNetworkServiceEditor.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// CBNetworkServiceEditor.m
// Tether
//
// Created by Christopher Ballinger on 3/31/14.
// Copyright (c) 2014 Christopher Ballinger. All rights reserved.
//

#import "CBNetworkServiceEditor.h"

static NSString * const kPreferencesFilePath = @"/Library/Preferences/SystemConfiguration/preferences.plist";

@interface CBNetworkServiceEditor()
@property (nonatomic, strong) NSDictionary *preferencesDictionary;
@end

@implementation CBNetworkServiceEditor

- (id) init {
if (self = [super init]) {

}
return self;
}



@end
16 changes: 16 additions & 0 deletions Tether/CBTunDevice.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// CBTunDevice.h
// Tether
//
// Created by Christopher Ballinger on 3/8/14.
// Copyright (c) 2014 Christopher Ballinger. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface CBTunDevice : NSObject

- (void) openTun;
- (void) closeTun;

@end
121 changes: 121 additions & 0 deletions Tether/CBTunDevice.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
//
// CBTunDevice.m
// Tether
//
// Created by Christopher Ballinger on 3/8/14.
// Copyright (c) 2014 Christopher Ballinger. All rights reserved.
//

#import "CBTunDevice.h"
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <sys/sys_domain.h>
#include <sys/kern_control.h>
#include <net/if_utun.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include <syslog.h>
#include <unistd.h>


int
tun(void)
{
struct sockaddr_ctl sc;
struct ctl_info ctlInfo;
int fd;


memset(&ctlInfo, 0, sizeof(ctlInfo));
if (strlcpy(ctlInfo.ctl_name, UTUN_CONTROL_NAME, sizeof(ctlInfo.ctl_name)) >=
sizeof(ctlInfo.ctl_name)) {
fprintf(stderr,"UTUN_CONTROL_NAME too long");
return -1;
}
fd = socket(PF_SYSTEM, SOCK_DGRAM, SYSPROTO_CONTROL);

if (fd == -1) {
perror ("socket(SYSPROTO_CONTROL)");
return -1;
}
if (ioctl(fd, CTLIOCGINFO, &ctlInfo) == -1) {
perror ("ioctl(CTLIOCGINFO)");
close(fd);
return -1;
}

sc.sc_id = ctlInfo.ctl_id;
sc.sc_len = sizeof(sc);
sc.sc_family = AF_SYSTEM;
sc.ss_sysaddr = AF_SYS_CONTROL;
sc.sc_unit = 2; /* Only have one, in this example... */


// If the connect is successful, a tun%d device will be created, where "%d"
// is our unit number -1

if (connect(fd, (struct sockaddr *)&sc, sizeof(sc)) == -1) {
perror ("connect(AF_SYS_CONTROL)");
close(fd);
return -1;
}
return fd;
}

@interface CBTunDevice()
@property (nonatomic) int utunFileDescriptor;
@end


@implementation CBTunDevice

- (void) dealloc {
[self closeTun];
}

- (void) closeTun {
if (!_utunFileDescriptor) {
return;
}
close(_utunFileDescriptor);
_utunFileDescriptor = 0;
}

- (void) openTun {
[self closeTun];
self.utunFileDescriptor = tun ();

if (_utunFileDescriptor == -1)
{
fprintf(stderr,"Unable to establish UTUN descriptor - aborting\n");
[self closeTun];
return;
}

fprintf(stderr,"Utun interface is up.. Configure IPv4 using \"ifconfig utun1 _ipA_ _ipB_\"\n");
fprintf(stderr," Configure IPv6 using \"ifconfig utun1 inet6 _ip6_\"\n");
fprintf(stderr,"Then (e.g.) ping _ipB_ (IPv6 will automatically generate ND messages)\n");


// PoC - Just dump the packets...
for (;;)
{
unsigned char c[1500];
ssize_t len;
int i;

len = read (_utunFileDescriptor,c, 1500);

// First 4 bytes of read data are the AF: 2 for AF_INET, 1E for AF_INET6, etc..
for (i = 4; i< len; i++)
{
printf ("%02x ", c[i]);
if ( (i-4)%16 ==15) printf("\n");
}
printf ("\n");
}
}

@end
13 changes: 13 additions & 0 deletions Tether/UTUN.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//
// UTUN.h
// Tether
//
// Created by Christopher Ballinger on 12/8/13.
// Copyright (c) 2013 Christopher Ballinger. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface UTUN : NSObject

@end
Loading

0 comments on commit af7dcd0

Please sign in to comment.