Removed network from MP OS X + initial STM code MP iOS.
[REMOVED] OS X: Removed networking code. We're going to use SendToMac instead. [ADDED] iOS: Initial code for communicating with SendToMac hosts.
This commit is contained in:
parent
0d19202ca7
commit
657fef6249
2
External/Pearl
vendored
2
External/Pearl
vendored
@ -1 +1 @@
|
|||||||
Subproject commit efe1b532952a2cdc725b489160114a135d1ca939
|
Subproject commit 9b1a79dc981997c2c0c0276bca4aad2eeb9de9cd
|
@ -7498,6 +7498,7 @@
|
|||||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||||
ONLY_ACTIVE_ARCH = YES;
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
@ -7520,6 +7521,7 @@
|
|||||||
LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)";
|
LD_DYLIB_INSTALL_NAME = "@rpath/$(EXECUTABLE_PATH)";
|
||||||
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
MACOSX_DEPLOYMENT_TARGET = 10.7;
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
@ -7530,8 +7532,6 @@
|
|||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "MasterPassword/Mac/MasterPassword-Prefix.pch";
|
GCC_PREFIX_HEADER = "MasterPassword/Mac/MasterPassword-Prefix.pch";
|
||||||
INFOPLIST_FILE = "MasterPassword/Mac/MasterPassword-Info.plist";
|
INFOPLIST_FILE = "MasterPassword/Mac/MasterPassword-Info.plist";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
WRAPPER_EXTENSION = app;
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -7541,8 +7541,6 @@
|
|||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "MasterPassword/Mac/MasterPassword-Prefix.pch";
|
GCC_PREFIX_HEADER = "MasterPassword/Mac/MasterPassword-Prefix.pch";
|
||||||
INFOPLIST_FILE = "MasterPassword/Mac/MasterPassword-Info.plist";
|
INFOPLIST_FILE = "MasterPassword/Mac/MasterPassword-Info.plist";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
WRAPPER_EXTENSION = app;
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@ -7555,7 +7553,6 @@
|
|||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "Pearl/Pearl-Prefix.pch";
|
GCC_PREFIX_HEADER = "Pearl/Pearl-Prefix.pch";
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/External/Pearl/External/iOSPorts/include/**";
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/External/Pearl/External/iOSPorts/include/**";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -7568,7 +7565,6 @@
|
|||||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
GCC_PREFIX_HEADER = "Pearl/Pearl-Prefix.pch";
|
GCC_PREFIX_HEADER = "Pearl/Pearl-Prefix.pch";
|
||||||
HEADER_SEARCH_PATHS = "$(SRCROOT)/External/Pearl/External/iOSPorts/include/**";
|
HEADER_SEARCH_PATHS = "$(SRCROOT)/External/Pearl/External/iOSPorts/include/**";
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@ -7581,7 +7577,6 @@
|
|||||||
"-DHAVE_CONFIG_H",
|
"-DHAVE_CONFIG_H",
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -7594,7 +7589,6 @@
|
|||||||
"-DHAVE_CONFIG_H",
|
"-DHAVE_CONFIG_H",
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
@ -7613,7 +7607,6 @@
|
|||||||
"-DOPENSSL_NO_STORE",
|
"-DOPENSSL_NO_STORE",
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
@ -7632,7 +7625,6 @@
|
|||||||
"-DOPENSSL_NO_STORE",
|
"-DOPENSSL_NO_STORE",
|
||||||
"$(inherited)",
|
"$(inherited)",
|
||||||
);
|
);
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
@ -712,6 +712,10 @@
|
|||||||
DAB8D97A15036BF700CED3BC /* tip_location_wood.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D6F815036BF600CED3BC /* tip_location_wood.png */; };
|
DAB8D97A15036BF700CED3BC /* tip_location_wood.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D6F815036BF600CED3BC /* tip_location_wood.png */; };
|
||||||
DAB8D97B15036BF700CED3BC /* tip_location_wood@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D6F915036BF600CED3BC /* tip_location_wood@2x.png */; };
|
DAB8D97B15036BF700CED3BC /* tip_location_wood@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D6F915036BF600CED3BC /* tip_location_wood@2x.png */; };
|
||||||
DAB8D97C1503718B00CED3BC /* jquery-1.6.1.min.js in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D6AB15036BF600CED3BC /* jquery-1.6.1.min.js */; };
|
DAB8D97C1503718B00CED3BC /* jquery-1.6.1.min.js in Resources */ = {isa = PBXBuildFile; fileRef = DAB8D6AB15036BF600CED3BC /* jquery-1.6.1.min.js */; };
|
||||||
|
DABB9809150FF40100B05417 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA5BFA4A147E415C00F98B1E /* Foundation.framework */; };
|
||||||
|
DABB980F150FF40100B05417 /* SendToMac.m in Sources */ = {isa = PBXBuildFile; fileRef = DABB980E150FF40100B05417 /* SendToMac.m */; };
|
||||||
|
DABB9814150FF5C100B05417 /* libSendToMac.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DABB9808150FF40100B05417 /* libSendToMac.a */; };
|
||||||
|
DABB981615100B4000B05417 /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DABB981515100B4000B05417 /* SystemConfiguration.framework */; };
|
||||||
DAC6325E1486805C0075AEA5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA5BFA4A147E415C00F98B1E /* Foundation.framework */; };
|
DAC6325E1486805C0075AEA5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA5BFA4A147E415C00F98B1E /* Foundation.framework */; };
|
||||||
DAC6326D148680650075AEA5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA5BFA4A147E415C00F98B1E /* Foundation.framework */; };
|
DAC6326D148680650075AEA5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA5BFA4A147E415C00F98B1E /* Foundation.framework */; };
|
||||||
DAC63277148680700075AEA5 /* libuicolor-utilities.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC6325D1486805C0075AEA5 /* libuicolor-utilities.a */; };
|
DAC63277148680700075AEA5 /* libuicolor-utilities.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DAC6325D1486805C0075AEA5 /* libuicolor-utilities.a */; };
|
||||||
@ -1556,6 +1560,11 @@
|
|||||||
DAB8D6F715036BF600CED3BC /* tip_location_teal@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tip_location_teal@2x.png"; sourceTree = "<group>"; };
|
DAB8D6F715036BF600CED3BC /* tip_location_teal@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tip_location_teal@2x.png"; sourceTree = "<group>"; };
|
||||||
DAB8D6F815036BF600CED3BC /* tip_location_wood.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tip_location_wood.png; sourceTree = "<group>"; };
|
DAB8D6F815036BF600CED3BC /* tip_location_wood.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tip_location_wood.png; sourceTree = "<group>"; };
|
||||||
DAB8D6F915036BF600CED3BC /* tip_location_wood@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tip_location_wood@2x.png"; sourceTree = "<group>"; };
|
DAB8D6F915036BF600CED3BC /* tip_location_wood@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "tip_location_wood@2x.png"; sourceTree = "<group>"; };
|
||||||
|
DABB9808150FF40100B05417 /* libSendToMac.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libSendToMac.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
DABB980C150FF40100B05417 /* SendToMac-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "SendToMac-Prefix.pch"; sourceTree = "<group>"; };
|
||||||
|
DABB980D150FF40100B05417 /* SendToMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SendToMac.h; sourceTree = "<group>"; };
|
||||||
|
DABB980E150FF40100B05417 /* SendToMac.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = SendToMac.m; sourceTree = "<group>"; };
|
||||||
|
DABB981515100B4000B05417 /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; };
|
||||||
DAC6325D1486805C0075AEA5 /* libuicolor-utilities.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libuicolor-utilities.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
DAC6325D1486805C0075AEA5 /* libuicolor-utilities.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libuicolor-utilities.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
DAC6326C148680650075AEA5 /* libjrswizzle.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjrswizzle.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
DAC6326C148680650075AEA5 /* libjrswizzle.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libjrswizzle.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
DAC632791486809A0075AEA5 /* JRSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JRSwizzle.h; path = External/Pearl/External/jrswizzle/JRSwizzle.h; sourceTree = SOURCE_ROOT; };
|
DAC632791486809A0075AEA5 /* JRSwizzle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = JRSwizzle.h; path = External/Pearl/External/jrswizzle/JRSwizzle.h; sourceTree = SOURCE_ROOT; };
|
||||||
@ -1648,6 +1657,8 @@
|
|||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
|
DABB981615100B4000B05417 /* SystemConfiguration.framework in Frameworks */,
|
||||||
|
DABB9814150FF5C100B05417 /* libSendToMac.a in Frameworks */,
|
||||||
DA672D3014F9413D004A189C /* libPearl.a in Frameworks */,
|
DA672D3014F9413D004A189C /* libPearl.a in Frameworks */,
|
||||||
DA672D2F14F92C6B004A189C /* libz.dylib in Frameworks */,
|
DA672D2F14F92C6B004A189C /* libz.dylib in Frameworks */,
|
||||||
DAEBC45314F6364500987BF6 /* QuartzCore.framework in Frameworks */,
|
DAEBC45314F6364500987BF6 /* QuartzCore.framework in Frameworks */,
|
||||||
@ -1671,6 +1682,14 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
DABB9805150FF40100B05417 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
DABB9809150FF40100B05417 /* Foundation.framework in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
DAC6325A1486805C0075AEA5 /* Frameworks */ = {
|
DAC6325A1486805C0075AEA5 /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -1715,9 +1734,9 @@
|
|||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
DA1A142714E494DA00BCFFBE /* scrypt.xcodeproj */,
|
DA1A142714E494DA00BCFFBE /* scrypt.xcodeproj */,
|
||||||
DA95D5F014DF0B1E008D1B94 /* MessageUI.framework */,
|
|
||||||
DA5BFA50147E415C00F98B1E /* MasterPassword */,
|
DA5BFA50147E415C00F98B1E /* MasterPassword */,
|
||||||
DAB8D46F15036BF600CED3BC /* Resources */,
|
DAB8D46F15036BF600CED3BC /* Resources */,
|
||||||
|
DABB980A150FF40100B05417 /* SendToMac */,
|
||||||
DAC77CAF148291A600BCF976 /* Pearl */,
|
DAC77CAF148291A600BCF976 /* Pearl */,
|
||||||
DAC6325F1486805C0075AEA5 /* uicolor-utilities */,
|
DAC6325F1486805C0075AEA5 /* uicolor-utilities */,
|
||||||
DAC6326E148680650075AEA5 /* jrswizzle */,
|
DAC6326E148680650075AEA5 /* jrswizzle */,
|
||||||
@ -1736,6 +1755,7 @@
|
|||||||
DAC6325D1486805C0075AEA5 /* libuicolor-utilities.a */,
|
DAC6325D1486805C0075AEA5 /* libuicolor-utilities.a */,
|
||||||
DAC6326C148680650075AEA5 /* libjrswizzle.a */,
|
DAC6326C148680650075AEA5 /* libjrswizzle.a */,
|
||||||
DA95D59C14DF063C008D1B94 /* libInAppSettingsKit.a */,
|
DA95D59C14DF063C008D1B94 /* libInAppSettingsKit.a */,
|
||||||
|
DABB9808150FF40100B05417 /* libSendToMac.a */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1743,6 +1763,8 @@
|
|||||||
DA5BFA47147E415C00F98B1E /* Frameworks */ = {
|
DA5BFA47147E415C00F98B1E /* Frameworks */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
DA95D5F014DF0B1E008D1B94 /* MessageUI.framework */,
|
||||||
|
DABB981515100B4000B05417 /* SystemConfiguration.framework */,
|
||||||
DA672D2E14F92C6B004A189C /* libz.dylib */,
|
DA672D2E14F92C6B004A189C /* libz.dylib */,
|
||||||
DAEBC45214F6364500987BF6 /* QuartzCore.framework */,
|
DAEBC45214F6364500987BF6 /* QuartzCore.framework */,
|
||||||
DA04E33D14B1E70400ECA4F3 /* MobileCoreServices.framework */,
|
DA04E33D14B1E70400ECA4F3 /* MobileCoreServices.framework */,
|
||||||
@ -2610,6 +2632,24 @@
|
|||||||
name = "Supporting Files";
|
name = "Supporting Files";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
DABB980A150FF40100B05417 /* SendToMac */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
DABB980D150FF40100B05417 /* SendToMac.h */,
|
||||||
|
DABB980E150FF40100B05417 /* SendToMac.m */,
|
||||||
|
DABB980B150FF40100B05417 /* Supporting Files */,
|
||||||
|
);
|
||||||
|
path = SendToMac;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
|
DABB980B150FF40100B05417 /* Supporting Files */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
DABB980C150FF40100B05417 /* SendToMac-Prefix.pch */,
|
||||||
|
);
|
||||||
|
name = "Supporting Files";
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
DAC6325F1486805C0075AEA5 /* uicolor-utilities */ = {
|
DAC6325F1486805C0075AEA5 /* uicolor-utilities */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -2787,6 +2827,13 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
DABB9806150FF40100B05417 /* Headers */ = {
|
||||||
|
isa = PBXHeadersBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
DAC6325B1486805C0075AEA5 /* Headers */ = {
|
DAC6325B1486805C0075AEA5 /* Headers */ = {
|
||||||
isa = PBXHeadersBuildPhase;
|
isa = PBXHeadersBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -2886,6 +2933,23 @@
|
|||||||
productReference = DA95D59C14DF063C008D1B94 /* libInAppSettingsKit.a */;
|
productReference = DA95D59C14DF063C008D1B94 /* libInAppSettingsKit.a */;
|
||||||
productType = "com.apple.product-type.library.static";
|
productType = "com.apple.product-type.library.static";
|
||||||
};
|
};
|
||||||
|
DABB9807150FF40100B05417 /* SendToMac */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = DABB9810150FF40100B05417 /* Build configuration list for PBXNativeTarget "SendToMac" */;
|
||||||
|
buildPhases = (
|
||||||
|
DABB9804150FF40100B05417 /* Sources */,
|
||||||
|
DABB9805150FF40100B05417 /* Frameworks */,
|
||||||
|
DABB9806150FF40100B05417 /* Headers */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
);
|
||||||
|
name = SendToMac;
|
||||||
|
productName = SendToMac;
|
||||||
|
productReference = DABB9808150FF40100B05417 /* libSendToMac.a */;
|
||||||
|
productType = "com.apple.product-type.library.static";
|
||||||
|
};
|
||||||
DAC6325C1486805C0075AEA5 /* uicolor-utilities */ = {
|
DAC6325C1486805C0075AEA5 /* uicolor-utilities */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = DAC632651486805C0075AEA5 /* Build configuration list for PBXNativeTarget "uicolor-utilities" */;
|
buildConfigurationList = DAC632651486805C0075AEA5 /* Build configuration list for PBXNativeTarget "uicolor-utilities" */;
|
||||||
@ -2973,6 +3037,7 @@
|
|||||||
DAC6325C1486805C0075AEA5 /* uicolor-utilities */,
|
DAC6325C1486805C0075AEA5 /* uicolor-utilities */,
|
||||||
DAC6326B148680650075AEA5 /* jrswizzle */,
|
DAC6326B148680650075AEA5 /* jrswizzle */,
|
||||||
DA95D59B14DF063C008D1B94 /* InAppSettingsKit */,
|
DA95D59B14DF063C008D1B94 /* InAppSettingsKit */,
|
||||||
|
DABB9807150FF40100B05417 /* SendToMac */,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
/* End PBXProject section */
|
/* End PBXProject section */
|
||||||
@ -3722,6 +3787,14 @@
|
|||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
DABB9804150FF40100B05417 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
DABB980F150FF40100B05417 /* SendToMac.m in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
DAC632591486805C0075AEA5 /* Sources */ = {
|
DAC632591486805C0075AEA5 /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
@ -4014,6 +4087,54 @@
|
|||||||
};
|
};
|
||||||
name = AppStore;
|
name = AppStore;
|
||||||
};
|
};
|
||||||
|
DABB9811150FF40100B05417 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
DSTROOT = /tmp/SendToMac.dst;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = "SendToMac/SendToMac-Prefix.pch";
|
||||||
|
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||||
|
"DEBUG=1",
|
||||||
|
"$(inherited)",
|
||||||
|
);
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
DABB9812150FF40100B05417 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
COPY_PHASE_STRIP = YES;
|
||||||
|
DSTROOT = /tmp/SendToMac.dst;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = "SendToMac/SendToMac-Prefix.pch";
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
DABB9813150FF40100B05417 /* AppStore */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
CLANG_ENABLE_OBJC_ARC = YES;
|
||||||
|
COPY_PHASE_STRIP = YES;
|
||||||
|
DSTROOT = /tmp/SendToMac.dst;
|
||||||
|
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||||
|
GCC_PREFIX_HEADER = "SendToMac/SendToMac-Prefix.pch";
|
||||||
|
GCC_WARN_UNINITIALIZED_AUTOS = YES;
|
||||||
|
OTHER_LDFLAGS = "-ObjC";
|
||||||
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
SKIP_INSTALL = YES;
|
||||||
|
};
|
||||||
|
name = AppStore;
|
||||||
|
};
|
||||||
DAC632661486805C0075AEA5 /* Debug */ = {
|
DAC632661486805C0075AEA5 /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
@ -4123,6 +4244,15 @@
|
|||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
|
DABB9810150FF40100B05417 /* Build configuration list for PBXNativeTarget "SendToMac" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
DABB9811150FF40100B05417 /* Debug */,
|
||||||
|
DABB9812150FF40100B05417 /* Release */,
|
||||||
|
DABB9813150FF40100B05417 /* AppStore */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
};
|
||||||
DAC632651486805C0075AEA5 /* Build configuration list for PBXNativeTarget "uicolor-utilities" */ = {
|
DAC632651486805C0075AEA5 /* Build configuration list for PBXNativeTarget "uicolor-utilities" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
#import "MPPasswordWindowController.h"
|
#import "MPPasswordWindowController.h"
|
||||||
|
|
||||||
@interface MPAppDelegate : NSObject <NSApplicationDelegate, NSNetServiceDelegate>
|
@interface MPAppDelegate : NSObject <NSApplicationDelegate>
|
||||||
|
|
||||||
@property (assign) IBOutlet NSWindow *window;
|
@property (assign) IBOutlet NSWindow *window;
|
||||||
|
|
||||||
@ -17,8 +17,6 @@
|
|||||||
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
|
@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel;
|
||||||
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
|
@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext;
|
||||||
|
|
||||||
@property (readonly, strong, nonatomic) NSNetService *netService;
|
|
||||||
|
|
||||||
+ (NSManagedObjectModel *)managedObjectModel;
|
+ (NSManagedObjectModel *)managedObjectModel;
|
||||||
+ (NSManagedObjectContext *)managedObjectContext;
|
+ (NSManagedObjectContext *)managedObjectContext;
|
||||||
|
|
||||||
|
@ -9,17 +9,10 @@
|
|||||||
#import "MPAppDelegate_Key.h"
|
#import "MPAppDelegate_Key.h"
|
||||||
#import "MPConfig.h"
|
#import "MPConfig.h"
|
||||||
|
|
||||||
#import <netinet/in.h>
|
|
||||||
#import <sys/socket.h>
|
|
||||||
|
|
||||||
|
|
||||||
@interface MPAppDelegate ()
|
@interface MPAppDelegate ()
|
||||||
|
|
||||||
@property (readwrite, strong, nonatomic) MPPasswordWindowController *passwordWindow;
|
@property (readwrite, strong, nonatomic) MPPasswordWindowController *passwordWindow;
|
||||||
@property (readwrite, strong, nonatomic) NSNetService *netService;
|
|
||||||
@property (readwrite, assign, nonatomic) CFSocketRef listeningSocket;
|
|
||||||
|
|
||||||
- (void)connectionEstablishedOnHandle:(CFSocketNativeHandle)handle;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -28,24 +21,18 @@
|
|||||||
@synthesize persistentStoreCoordinator = __persistentStoreCoordinator;
|
@synthesize persistentStoreCoordinator = __persistentStoreCoordinator;
|
||||||
@synthesize managedObjectModel = __managedObjectModel;
|
@synthesize managedObjectModel = __managedObjectModel;
|
||||||
@synthesize managedObjectContext = __managedObjectContext;
|
@synthesize managedObjectContext = __managedObjectContext;
|
||||||
@synthesize netService, listeningSocket;
|
|
||||||
@synthesize passwordWindow;
|
@synthesize passwordWindow;
|
||||||
|
|
||||||
@synthesize key;
|
@synthesize key;
|
||||||
@synthesize keyHash;
|
@synthesize keyHash;
|
||||||
@synthesize keyHashHex;
|
@synthesize keyHashHex;
|
||||||
|
|
||||||
static void ListeningSocketCallback(CFSocketRef s, CFSocketCallBackType type, CFDataRef address, const void *data, void *info) {
|
|
||||||
|
|
||||||
[[MPAppDelegate get] connectionEstablishedOnHandle:*(const CFSocketNativeHandle *)data];
|
|
||||||
}
|
|
||||||
|
|
||||||
+ (void)initialize {
|
+ (void)initialize {
|
||||||
|
|
||||||
[MPConfig get];
|
[MPConfig get];
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
[PearlLogger get].autoprintLevel = PearlLogLevelTrace;
|
[PearlLogger get].autoprintLevel = PearlLogLevelDebug;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,120 +48,8 @@ static void ListeningSocketCallback(CFSocketRef s, CFSocketCallBackType type, CF
|
|||||||
|
|
||||||
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
|
||||||
|
|
||||||
[self setupNetworkListener];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setupNetworkListener {
|
|
||||||
|
|
||||||
struct sockaddr_in6 serverAddress6;
|
|
||||||
socklen_t serverAddress6_len = sizeof(serverAddress6);
|
|
||||||
memset(&serverAddress6, 0, serverAddress6_len);
|
|
||||||
serverAddress6.sin6_len = serverAddress6_len;
|
|
||||||
serverAddress6.sin6_family = AF_INET6;
|
|
||||||
|
|
||||||
NSSocketNativeHandle socketHandle;
|
|
||||||
if (0 > (socketHandle = socket(AF_INET6, SOCK_STREAM, 0))) {
|
|
||||||
err(@"Couldn't create socket: %@", errstr());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (0 > bind(socketHandle, (const struct sockaddr *) &serverAddress6, serverAddress6_len)) {
|
|
||||||
err(@"Couldn't bind socket: %@", errstr());
|
|
||||||
close(socketHandle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (0 > getsockname(socketHandle, (struct sockaddr *) &serverAddress6, &serverAddress6_len)) {
|
|
||||||
err(@"Couldn't get socket info: %@", errstr());
|
|
||||||
close(socketHandle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (0 > listen(socketHandle, 5)) {
|
|
||||||
err(@"Couldn't get socket info: %@", errstr());
|
|
||||||
close(socketHandle);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!(self.listeningSocket = CFSocketCreateWithNative(NULL, socketHandle, kCFSocketAcceptCallBack, ListeningSocketCallback, NULL))) {
|
|
||||||
err(@"Couldn't start listening on the socket: %@", errstr());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
CFRunLoopSourceRef runLoopSource = CFSocketCreateRunLoopSource(NULL, self.listeningSocket, 0);
|
|
||||||
CFRunLoopAddSource(CFRunLoopGetCurrent(), runLoopSource, kCFRunLoopDefaultMode);
|
|
||||||
CFRelease(runLoopSource);
|
|
||||||
|
|
||||||
int chosenPort = ntohs(serverAddress6.sin6_port);
|
|
||||||
inf(@"Master Password bound to port %d", chosenPort);
|
|
||||||
self.netService = [[NSNetService alloc] initWithDomain:@"" type:@"_masterpassword._tcp." name:@"Master Password" port:chosenPort];
|
|
||||||
if(!self.netService) {
|
|
||||||
err(@"Couldn't initialize the Bonjour service.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.netService.delegate = self;
|
|
||||||
[self.netService publish];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connectionEstablishedOnHandle:(CFSocketNativeHandle)handle {
|
|
||||||
|
|
||||||
dbg(@"%@%d", NSStringFromSelector(_cmd), handle);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate prior to advertising the service on the network. If for some reason the service cannot be published, the delegate will not receive this message, and an error will be delivered to the delegate via the delegate's -netService:didNotPublish: method.
|
|
||||||
*/
|
|
||||||
- (void)netServiceWillPublish:(NSNetService *)sender {
|
|
||||||
|
|
||||||
dbg(@"%@", NSStringFromSelector(_cmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate when the publication of the instance is complete and successful.
|
|
||||||
*/
|
|
||||||
- (void)netServiceDidPublish:(NSNetService *)sender {
|
|
||||||
|
|
||||||
dbg(@"%@", NSStringFromSelector(_cmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate when an error in publishing the instance occurs. The error dictionary will contain two key/value pairs representing the error domain and code (see the NSNetServicesError enumeration above for error code constants). It is possible for an error to occur after a successful publication.
|
|
||||||
*/
|
|
||||||
- (void)netService:(NSNetService *)sender didNotPublish:(NSDictionary *)errorDict {
|
|
||||||
|
|
||||||
dbg(@"%@%@", NSStringFromSelector(_cmd), errorDict);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate prior to resolving a service on the network. If for some reason the resolution cannot occur, the delegate will not receive this message, and an error will be delivered to the delegate via the delegate's -netService:didNotResolve: method.
|
|
||||||
*/
|
|
||||||
- (void)netServiceWillResolve:(NSNetService *)sender {
|
|
||||||
|
|
||||||
dbg(@"%@", NSStringFromSelector(_cmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate when one or more addresses have been resolved for an NSNetService instance. Some NSNetService methods will return different results before and after a successful resolution. An NSNetService instance may get resolved more than once; truly robust clients may wish to resolve again after an error, or to resolve more than once.
|
|
||||||
*/
|
|
||||||
- (void)netServiceDidResolveAddress:(NSNetService *)sender {
|
|
||||||
|
|
||||||
dbg(@"%@", NSStringFromSelector(_cmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate when an error in resolving the instance occurs. The error dictionary will contain two key/value pairs representing the error domain and code (see the NSNetServicesError enumeration above for error code constants).
|
|
||||||
*/
|
|
||||||
- (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict {
|
|
||||||
|
|
||||||
dbg(@"%@%@", NSStringFromSelector(_cmd), errorDict);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate when the instance's previously running publication or resolution request has stopped.
|
|
||||||
*/
|
|
||||||
- (void)netServiceDidStop:(NSNetService *)sender {
|
|
||||||
|
|
||||||
dbg(@"%@", NSStringFromSelector(_cmd));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Sent to the NSNetService instance's delegate when the instance is being monitored and the instance's TXT record has been updated. The new record is contained in the data parameter.
|
|
||||||
*/
|
|
||||||
- (void)netService:(NSNetService *)sender didUpdateTXTRecordData:(NSData *)data {
|
|
||||||
|
|
||||||
dbg(@"%@%@", NSStringFromSelector(_cmd), data);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (void)applicationDidBecomeActive:(NSNotification *)notification {
|
- (void)applicationDidBecomeActive:(NSNotification *)notification {
|
||||||
|
|
||||||
if (!self.passwordWindow)
|
if (!self.passwordWindow)
|
||||||
|
@ -582,9 +582,42 @@
|
|||||||
<nil key="activeLocalization"/>
|
<nil key="activeLocalization"/>
|
||||||
<dictionary class="NSMutableDictionary" key="localizations"/>
|
<dictionary class="NSMutableDictionary" key="localizations"/>
|
||||||
<nil key="sourceID"/>
|
<nil key="sourceID"/>
|
||||||
<int key="maxID">711</int>
|
<int key="maxID">715</int>
|
||||||
|
</object>
|
||||||
|
<object class="IBClassDescriber" key="IBDocument.Classes">
|
||||||
|
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
|
||||||
|
<object class="IBPartialClassDescription">
|
||||||
|
<string key="className">MPAppDelegate</string>
|
||||||
|
<string key="superclassName">NSObject</string>
|
||||||
|
<object class="NSMutableDictionary" key="actions">
|
||||||
|
<string key="NS.key.0">saveAction:</string>
|
||||||
|
<string key="NS.object.0">id</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="actionInfosByName">
|
||||||
|
<string key="NS.key.0">saveAction:</string>
|
||||||
|
<object class="IBActionInfo" key="NS.object.0">
|
||||||
|
<string key="name">saveAction:</string>
|
||||||
|
<string key="candidateClassName">id</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="outlets">
|
||||||
|
<string key="NS.key.0">window</string>
|
||||||
|
<string key="NS.object.0">NSWindow</string>
|
||||||
|
</object>
|
||||||
|
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
|
||||||
|
<string key="NS.key.0">window</string>
|
||||||
|
<object class="IBToOneOutletInfo" key="NS.object.0">
|
||||||
|
<string key="name">window</string>
|
||||||
|
<string key="candidateClassName">NSWindow</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
<object class="IBClassDescriptionSource" key="sourceIdentifier">
|
||||||
|
<string key="majorKey">IBProjectSource</string>
|
||||||
|
<string key="minorKey">./Classes/MPAppDelegate.h</string>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</array>
|
||||||
</object>
|
</object>
|
||||||
<object class="IBClassDescriber" key="IBDocument.Classes"/>
|
|
||||||
<int key="IBDocument.localizationMode">0</int>
|
<int key="IBDocument.localizationMode">0</int>
|
||||||
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
|
||||||
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
|
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
|
||||||
|
@ -5,20 +5,20 @@
|
|||||||
#import <Availability.h>
|
#import <Availability.h>
|
||||||
|
|
||||||
#ifndef __IPHONE_5_0
|
#ifndef __IPHONE_5_0
|
||||||
#warning "This project uses features only available in iOS SDK 5.0 and later."
|
#warning "This project uses features only available in iOS SDK 5.0 and later."
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#import "Pearl-Prefix.pch"
|
||||||
|
|
||||||
#ifdef __OBJC__
|
#ifdef __OBJC__
|
||||||
#import <UIKit/UIKit.h>
|
#import <UIKit/UIKit.h>
|
||||||
#import <Foundation/Foundation.h>
|
#import <Foundation/Foundation.h>
|
||||||
#import <CoreData/CoreData.h>
|
#import <CoreData/CoreData.h>
|
||||||
|
|
||||||
#ifndef PRODUCTION
|
#ifdef TESTFLIGHT
|
||||||
#import "TestFlight.h"
|
#import "TestFlight.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#import "MPTypes.h"
|
||||||
|
#import "MPiOSConfig.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#import "Pearl-Prefix.pch"
|
|
||||||
|
|
||||||
#import "MPTypes.h"
|
|
||||||
#import "MPiOSConfig.h"
|
|
||||||
|
9
SendToMac/SendToMac-Prefix.pch
Normal file
9
SendToMac/SendToMac-Prefix.pch
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
//
|
||||||
|
// Prefix header for all source files of the 'SendToMac' target in the 'SendToMac' project
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifdef __OBJC__
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#import "Pearl-Prefix.pch"
|
17
SendToMac/SendToMac.h
Normal file
17
SendToMac/SendToMac.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//
|
||||||
|
// SendToMac.h
|
||||||
|
// SendToMac
|
||||||
|
//
|
||||||
|
// Created by Maarten Billemont on 13/03/12.
|
||||||
|
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import <Foundation/Foundation.h>
|
||||||
|
|
||||||
|
@interface SendToMac : NSObject <NSNetServiceDelegate>
|
||||||
|
|
||||||
|
@property (assign) NSTimeInterval timeout;
|
||||||
|
@property (strong) NSNetServiceBrowser *netServiceBrowser;
|
||||||
|
@property (strong) NSMutableDictionary *messageQueues;
|
||||||
|
|
||||||
|
@end
|
107
SendToMac/SendToMac.m
Normal file
107
SendToMac/SendToMac.m
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
//
|
||||||
|
// SendToMac.m
|
||||||
|
// SendToMac
|
||||||
|
//
|
||||||
|
// Created by Maarten Billemont on 13/03/12.
|
||||||
|
// Copyright (c) 2012 Lyndir. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
#import "SendToMac.h"
|
||||||
|
|
||||||
|
#import <SystemConfiguration/SystemConfiguration.h>
|
||||||
|
#import <netinet/in.h>
|
||||||
|
#import <sys/socket.h>
|
||||||
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
|
@implementation SendToMac
|
||||||
|
@synthesize timeout, netServiceBrowser, messageQueues;
|
||||||
|
|
||||||
|
- (id)initWithDelegate:(id<NSNetServiceBrowserDelegate>)delegate {
|
||||||
|
|
||||||
|
if (!(self = [super init]))
|
||||||
|
return nil;
|
||||||
|
|
||||||
|
self.timeout = 10;
|
||||||
|
self.messageQueues = [NSMutableDictionary dictionaryWithCapacity:1];
|
||||||
|
|
||||||
|
self.netServiceBrowser = [NSNetServiceBrowser new];
|
||||||
|
self.netServiceBrowser.delegate = delegate;
|
||||||
|
|
||||||
|
return self;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)start {
|
||||||
|
|
||||||
|
[self.netServiceBrowser searchForServicesOfType:@"_sendtomac._tcp." inDomain:@""];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)stop {
|
||||||
|
|
||||||
|
[self.netServiceBrowser stop];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)send:(NSString *)string toMac:(NSNetService *)service {
|
||||||
|
|
||||||
|
NSMutableArray *messageQueue = [self.messageQueues objectForKey:service];
|
||||||
|
if (!messageQueue)
|
||||||
|
[self.messageQueues setObject:messageQueue = [NSMutableArray arrayWithCapacity:3] forKey:service];
|
||||||
|
[messageQueue addObject:string];
|
||||||
|
|
||||||
|
service.delegate = self;
|
||||||
|
[service resolveWithTimeout:self.timeout];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)netServiceDidResolveAddress:(NSNetService *)sender {
|
||||||
|
|
||||||
|
struct sockaddr *senderAddress = NULL;
|
||||||
|
for (NSData *address in sender.addresses) {
|
||||||
|
struct sockaddr *socketAddress = (struct sockaddr *)address.bytes;
|
||||||
|
char *addressName = inet_ntoa((((struct sockaddr_in *)socketAddress)->sin_addr));
|
||||||
|
|
||||||
|
SCNetworkReachabilityRef target = SCNetworkReachabilityCreateWithAddress(NULL, socketAddress);
|
||||||
|
SCNetworkReachabilityFlags flags;
|
||||||
|
if (!SCNetworkReachabilityGetFlags(target, &flags)) {
|
||||||
|
err(@"Couldn't determine reachability for address: %s", addressName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(flags & kSCNetworkReachabilityFlagsReachable)) {
|
||||||
|
err(@"Not reachable: %s", addressName);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
senderAddress = socketAddress;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (senderAddress == NULL) {
|
||||||
|
dbg(@"Couldn't determine a reachable address for: %@", sender);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
NSSocketNativeHandle socketHandle;
|
||||||
|
if (0 > (socketHandle = socket(senderAddress->sa_family, SOCK_STREAM, 0))) {
|
||||||
|
err(@"Couldn't create socket: %@", errstr());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (0 > connect(socketHandle, senderAddress, senderAddress->sa_len)) {
|
||||||
|
err(@"Couldn't connect socket: %@", errstr());
|
||||||
|
close(socketHandle);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (0 > close(socketHandle)) {
|
||||||
|
err(@"Couldn't close socket: %@", errstr());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (NSString *messange in [self.messageQueues objectForKey:sender]) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict {
|
||||||
|
|
||||||
|
err(@"%@%@", NSStringFromSelector(_cmd), errorDict);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@end
|
Loading…
Reference in New Issue
Block a user