summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2016-05-31 08:59:20 +0200
committerBenoit Foucher <benoit@zeroc.com>2016-05-31 08:59:20 +0200
commit9f99bad130508d529814c778852621f6a1b814cc (patch)
tree4fa8328539c80f719cca38a0fb7f67b2995618fc /cpp
parentPHP 7 fix for printing Exception info (diff)
downloadice-9f99bad130508d529814c778852621f6a1b814cc.tar.bz2
ice-9f99bad130508d529814c778852621f6a1b814cc.tar.xz
ice-9f99bad130508d529814c778852621f6a1b814cc.zip
Added support for building Xcode SDK, added iAP transport
Diffstat (limited to 'cpp')
-rw-r--r--cpp/Makefile3
-rw-r--r--cpp/config/Make.rules40
-rw-r--r--cpp/config/Make.xcodesdk.rules68
-rw-r--r--cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mk1
-rw-r--r--cpp/src/Ice/ConnectionFactory.cpp10
-rw-r--r--cpp/src/Ice/EventHandler.h2
-rw-r--r--cpp/src/Ice/Exception.cpp2
-rw-r--r--cpp/src/Ice/Makefile.mk15
-rw-r--r--cpp/src/Ice/Selector.cpp14
-rw-r--r--cpp/src/Ice/Selector.h2
-rw-r--r--cpp/src/Ice/Transceiver.h2
-rw-r--r--cpp/src/Ice/ios/Notifications.mm138
-rw-r--r--cpp/src/Ice/ios/RegisterPluginsInit.cpp30
-rw-r--r--cpp/src/Ice/ios/StreamAcceptor.cpp160
-rw-r--r--cpp/src/Ice/ios/StreamAcceptor.h54
-rw-r--r--cpp/src/Ice/ios/StreamConnector.cpp169
-rw-r--r--cpp/src/Ice/ios/StreamConnector.h52
-rw-r--r--cpp/src/Ice/ios/StreamEndpointI.cpp820
-rw-r--r--cpp/src/Ice/ios/StreamEndpointI.h170
-rw-r--r--cpp/src/Ice/ios/StreamTransceiver.cpp793
-rw-r--r--cpp/src/Ice/ios/StreamTransceiver.h102
-rw-r--r--cpp/src/Ice/ios/iAPConnector.h58
-rw-r--r--cpp/src/Ice/ios/iAPConnector.mm153
-rw-r--r--cpp/src/Ice/ios/iAPEndpointI.h109
-rw-r--r--cpp/src/Ice/ios/iAPEndpointI.mm640
-rw-r--r--cpp/src/Ice/ios/iAPTransceiver.h85
-rw-r--r--cpp/src/Ice/ios/iAPTransceiver.mm490
-rw-r--r--cpp/src/IceBT/Makefile.mk4
-rw-r--r--cpp/src/IceSSL/Makefile.mk4
-rw-r--r--cpp/src/IceUtil/Makefile.mk6
-rw-r--r--cpp/test/Common/Makefile.mk6
-rw-r--r--cpp/test/ios/BundleInfo.plist48
-rwxr-xr-xcpp/test/ios/C++ Test Suite.xcodeproj/project.pbxproj743
-rw-r--r--cpp/test/ios/C++ Test Suite.xcodeproj/project.xcworkspace/contents.xcworkspacedata7
-rw-r--r--cpp/test/ios/C++11 Test Suite.plist36
-rw-r--r--cpp/test/ios/C++98 Test Suite-Info.plist36
-rw-r--r--cpp/test/ios/Classes/AppDelegate.h37
-rw-r--r--cpp/test/ios/Classes/AppDelegate.mm216
-rw-r--r--cpp/test/ios/Classes/TestSelectController.h26
-rw-r--r--cpp/test/ios/Classes/TestSelectController.m130
-rw-r--r--cpp/test/ios/Classes/TestUtil.h138
-rw-r--r--cpp/test/ios/Classes/TestUtil.mm296
-rw-r--r--cpp/test/ios/Classes/TestViewController.h30
-rw-r--r--cpp/test/ios/Classes/TestViewController.mm580
-rw-r--r--cpp/test/ios/Default-568h@2x.pngbin0 -> 18594 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/Contents.json80
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/New icon-60@3x.pngbin0 -> 31818 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76.pngbin0 -> 7728 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76@2x.pngbin0 -> 23597 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40.pngbin0 -> 2870 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-1.pngbin0 -> 8216 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-2.pngbin0 -> 8216 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x-1.pngbin0 -> 15766 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x.pngbin0 -> 15766 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small.pngbin0 -> 1773 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-1.pngbin0 -> 5048 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-2.pngbin0 -> 5048 bytes
-rw-r--r--cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@3x.pngbin0 -> 9409 bytes
-rw-r--r--cpp/test/ios/MainWindow-iPad.xib43
-rw-r--r--cpp/test/ios/MainWindow.xib41
-rw-r--r--cpp/test/ios/README.md6
-rw-r--r--cpp/test/ios/TestSelect-iPad.xib77
-rw-r--r--cpp/test/ios/TestSelect.xib78
-rw-r--r--cpp/test/ios/TestView-iPad.xib59
-rw-r--r--cpp/test/ios/TestView.xib59
-rw-r--r--cpp/test/ios/dummy.ice3
-rw-r--r--cpp/test/ios/main.m17
67 files changed, 6934 insertions, 54 deletions
diff --git a/cpp/Makefile b/cpp/Makefile
index 75d3b52b04f..4da978a6091 100644
--- a/cpp/Makefile
+++ b/cpp/Makefile
@@ -17,8 +17,8 @@ include $(lang_srcdir)/config/Make.rules
# Create projects for all the Slice translators from src/slice2* and load source projects.
#
projects :=
-include $(shell find $(lang_srcdir)/src -name Makefile.mk)
$(foreach t,$(wildcard $(lang_srcdir)/src/slice2*),$(eval $(call create-translator-project,$(call project,$t))))
+include $(shell find $(lang_srcdir)/src -name Makefile.mk)
$(call make-projects,$(projects),make-cpp-src-project)
#
@@ -32,4 +32,3 @@ $(call make-projects,$(projects),make-cpp-test-project)
install:: | $(DESTDIR)$(install_configdir)
$(Q)$(INSTALL) $(lang_srcdir)/config/templates.xml $(DESTDIR)$(install_configdir)
-
diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules
index 257b922ce5f..af13caafc32 100644
--- a/cpp/config/Make.rules
+++ b/cpp/config/Make.rules
@@ -11,17 +11,19 @@
# Don't change anything below this line!
# ----------------------------------------------------------------------
--include $(lang_srcdir)/config/Make.rules.$(os)
-
#
# Supported configurations
#
supported-configs = shared static cpp11-shared cpp11-static
+-include $(lang_srcdir)/config/Make.rules.$(os)
+ifeq ($(os),Darwin)
+include $(lang_srcdir)/config/Make.xcodesdk.rules
+endif
+
#
# Define which projects to build for the different configurations.
#
-
coreandstub_components = IceUtil \
Ice \
IceSSL \
@@ -95,21 +97,13 @@ cpp11_targetname = $(if $(or $(filter-out $($1_target),program),$(filter-out %/
cpp11_targetdir = $(if $(filter %/build,$($1_targetdir)),cpp11)
#
-# Create top-level include/config dir
-#
-$(DESTDIR)$(install_includedir) $(DESTDIR)$(install_configdir):
- $(Q)$(MKDIR) $@
-
-#
# $(call make-cpp-src-project,$1=project)
#
define make-cpp-src-project
-ifeq ($(USE_BIN_DIST),yes)
-$(create-project-targets)
-else
+ifneq ($(USE_BIN_DIST),yes)
$1_slicecompiler := slice2cpp
$1_sliceflags += --ice -I$(slicedir)
-$1_cppflags += -Isrc -I$1/generated -I$(includedir) -I$(includedir)/generated
+$1_cppflags += -Isrc -I$1/generated -I$(includedir) -I$(includedir)/generated
$(make-project)
srcs:: $1
endif
@@ -120,12 +114,11 @@ endef
#
define make-cpp-test-project
$1_slicecompiler := slice2cpp
-$1_sliceflags := -I$(slicedir) $$($1_sliceflags)
-$1_cppflags := -I$(includedir) -Itest/include -I$1 -I$1/generated $$($1_cppflags)
+$1_sliceflags += -I$(slicedir)
+$1_cppflags += -I$1/generated -I$1 -Itest/include -I$(includedir)
ifneq ($(USE_BIN_DIST),yes)
$1_cppflags += -I$(includedir)/generated
endif
-
$(make-project)
tests:: $1
endef
@@ -138,7 +131,20 @@ $1_srcext := cpp
$1_dependencies := $$(or $$($1_dependencies),TestCommon Ice)
# Also link with IceSSL and IceBT (Debian/Ubuntu) when compiling the project with the static configuration
-static_dependencies[$1] := $$(or $$($1_dependencies[static]),IceSSL $(if $(filter debian ubuntu,$(linux_id)),IceBT))
+$1[static]_dependencies := IceSSL $(if $(filter debian ubuntu,$(linux_id)),IceBT)
+
+# Dependencies and target dirs for Xcode SDK test projects
+$1[xcodesdk]_dependencies := IceSSL
+$1[iphoneos-xcodesdk]_targetdir := test/ios/Bundles-iphoneos/$(subst /,_,$1)
+$1[iphonesimulator-xcodesdk]_targetdir := test/ios/Bundles-iphonesimulator/$(subst /,_,$1)
+$1[iphoneos-cpp11-xcodesdk]_targetdir := test/ios/Bundles++11-iphoneos/$(subst /,_,$1)
+$1[iphonesimulator-cpp11-xcodesdk]_targetdir := test/ios/Bundles++11-iphonesimulator/$(subst /,_,$1)
$(create-test-project)
endef
+
+#
+# Create top-level include/config dir
+#
+$(DESTDIR)$(install_includedir) $(DESTDIR)$(install_configdir):
+ $(Q)$(MKDIR) $@
diff --git a/cpp/config/Make.xcodesdk.rules b/cpp/config/Make.xcodesdk.rules
new file mode 100644
index 00000000000..de62fcee103
--- /dev/null
+++ b/cpp/config/Make.xcodesdk.rules
@@ -0,0 +1,68 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+#
+# This copy of Ice is licensed to you under the terms described in the
+# ICE_LICENSE file included in this distribution.
+#
+# **********************************************************************
+
+include $(top_srcdir)/config/Make.xcodesdk.rules
+
+supported-configs += xcodesdk cpp11-xcodesdk
+
+is-iostest-program = $(and $(filter-out macosx,$2),$(filter program,$($1_target)))
+
+#
+# Xcode configuration to build Xcode IceSDK.
+#
+xcodesdk_targetdir = $(if $(filter %/build,$5),xcodesdk,$(if $(is-iostest-program),,IceSDK/$2.sdk/usr/lib))
+xcodesdk_installdir = $(if $(filter %/build,$5),xcodesdk,$(if $(is-iostest-program),,IceSDK/$2.sdk/usr/lib))
+xcodesdk_targetrule = $(if $(is-iostest-program),iostest,$(if $(filter-out program,$($1_target)),static))
+
+xcodesdk_components = Ice IceSSL Glacier2 IceStorm IceGrid IceDiscovery IceLocatorDiscovery TestCommon
+xcodesdk_projects = test/Ice/% test/IceDiscovery/simple
+xcodesdk_excludes = $(addprefix test/Ice/,background \
+ faultTolerance \
+ gc \
+ logger \
+ properties \
+ stringConverter \
+ threadPoolPriority)
+
+
+#
+# Rule to build an iOS bundle for testing (this is used for packaging client/server programs)
+#
+define make-iostest-program
+$2/$1.bundle/$1.dylib: $5 $(foreach d,$6,$($d_targets))
+ $(E) "Linking [$8-$9] $$@"
+ $(Q)if [ ! -f $2/$1.bundle/Info.plist ] ; \
+ then \
+ $(MKDIR) -p $2/$1.bundle ; \
+ sed "s/NAME/$1/" test/ios/BundleInfo.plist > $2/$1.bundle/Info.plist ; \
+ fi
+ $(Q)$(RM) $2/$1.bundle/$1.dylib
+ $(Q)$(or $($8_cxx),$(platform_cxx)) -bundle $(LDFLAGS) -o $2/$1.bundle/$1.dylib $5 $(strip $7)
+endef
+
+get-iostest-program-targets = $2/$1.bundle/$1.dylib
+
+ifneq ($(findstring xcodesdk,$(configs)),)
+$(eval $(call make-xcodesdk,bin/slice2cpp))
+component_with_config_extensions := make-cpp-xcodesdk-component-with-config
+endif
+
+#
+# $(call make-xcodesdk-component-with-config,$1=project,$2=component,$3=platform,$4=config,$5=comp[platform-config])
+#
+define make-cpp-xcodesdk-component-with-config
+ifneq ($(filter src/%,$1),)
+
+$(make-xcodesdk-component-with-config)
+
+$5_clean::
+ $(Q)$(RM) -r $(top_srcdir)/IceSDK/$3.sdk/usr/include/$2
+
+endif
+endef
diff --git a/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mk b/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mk
index 97980df7750..62d37067f28 100644
--- a/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mk
+++ b/cpp/src/Glacier2CryptPermissionsVerifier/Makefile.mk
@@ -11,7 +11,6 @@ $(project)_libraries += Glacier2CryptPermissionsVerifier
Glacier2CryptPermissionsVerifier_targetdir := $(libdir)
Glacier2CryptPermissionsVerifier_dependencies := Glacier2 Ice
-Glacier2CryptPermissionsVerifier_system_libs := $(CRYPT_OS_LIBS)
Glacier2CryptPermissionsVerifier_cppflags := -DCRYPT_PERMISSIONS_VERIFIER_API_EXPORTS
projects += $(project)
diff --git a/cpp/src/Ice/ConnectionFactory.cpp b/cpp/src/Ice/ConnectionFactory.cpp
index 43dc7f670ce..dbfc20e9a94 100644
--- a/cpp/src/Ice/ConnectionFactory.cpp
+++ b/cpp/src/Ice/ConnectionFactory.cpp
@@ -32,8 +32,8 @@
namespace IceInternal
{
-bool registerForBackgroundNotification(IceInternal::IncomingConnectionFactory*);
-void unregisterForBackgroundNotification(IceInternal::IncomingConnectionFactory*);
+bool registerForBackgroundNotification(const IceInternal::IncomingConnectionFactoryPtr&);
+void unregisterForBackgroundNotification(const IceInternal::IncomingConnectionFactoryPtr&);
}
#endif
@@ -1461,7 +1461,7 @@ IceInternal::IncomingConnectionFactory::finished(ThreadPoolCurrent&, bool close)
#if TARGET_OS_IPHONE != 0
sync.release();
- unregisterForBackgroundNotification(this);
+ unregisterForBackgroundNotification(shared_from_this());
#endif
}
@@ -1581,7 +1581,7 @@ IceInternal::IncomingConnectionFactory::stopAcceptor()
return;
}
- if(_adapter->getThreadPool()->finish(this, true))
+ if(_adapter->getThreadPool()->finish(shared_from_this(), true))
{
_acceptorStarted = false;
closeAcceptor();
@@ -1625,7 +1625,7 @@ IceInternal::IncomingConnectionFactory::initialize()
// start the acceptor if necessary.
//
_acceptorStarted = false;
- registerForBackgroundNotification(this);
+ registerForBackgroundNotification(shared_from_this());
#else
createAcceptor();
#endif
diff --git a/cpp/src/Ice/EventHandler.h b/cpp/src/Ice/EventHandler.h
index f77e61039cd..ced022ed06a 100644
--- a/cpp/src/Ice/EventHandler.h
+++ b/cpp/src/Ice/EventHandler.h
@@ -20,7 +20,7 @@
namespace IceInternal
{
-class ICE_API EventHandler :
+class ICE_API EventHandler :
#ifdef ICE_CPP11_MAPPING
public virtual Ice::VirtualEnableSharedFromThisBase
#else
diff --git a/cpp/src/Ice/Exception.cpp b/cpp/src/Ice/Exception.cpp
index dc5e94f852a..0dd364ca01b 100644
--- a/cpp/src/Ice/Exception.cpp
+++ b/cpp/src/Ice/Exception.cpp
@@ -803,11 +803,9 @@ Ice::ResponseSentException::ice_print(ostream& out) const
out << ":\nresponse sent exception";
}
-#ifdef ICE_USE_CFSTREAM
void
Ice::CFNetworkException::ice_print(ostream& out) const
{
Exception::ice_print(out);
out << ":\nnetwork exception: domain: " << domain << " error: " << error;
}
-#endif
diff --git a/cpp/src/Ice/Makefile.mk b/cpp/src/Ice/Makefile.mk
index f37b987a708..82161acbdce 100644
--- a/cpp/src/Ice/Makefile.mk
+++ b/cpp/src/Ice/Makefile.mk
@@ -10,25 +10,20 @@
$(project)_libraries = Ice
Ice_targetdir := $(libdir)
-Ice_cppflags = -DICE_API_EXPORTS
+Ice_cppflags = -DICE_API_EXPORTS $(IceUtil_cppflags)
ifeq ($(DEFAULT_MUTEX_PROTOCOL), PrioInherit)
Ice_cppflags += -DICE_PRIO_INHERIT
endif
-ifeq ($(libbacktrace),yes)
- Ice_cppflags += -DICE_LIBBACKTRACE
-endif
-
Ice_sliceflags := --include-dir Ice --dll-export ICE_API
Ice_libs := bz2
-Ice_system_libs := $(ICE_OS_LIBS)
Ice_extra_sources := $(wildcard src/IceUtil/*.cpp)
Ice_excludes := $(currentdir)/DLLMain.cpp
-Ice_extra_sources[iphoneos] := $(wildcard $(addprefix $(currentdir)/ios/,*.cpp *.mm))
-#Ice_excludes[iphoneos] := $(wildcard $(addprefix $(currentdir)/RegistryPlugins.cpp))
-Ice_extra_sources[iphonesimulator] := $(wildcard $(addprefix $(currentdir)/ios/,*.cpp *.mm))
-#Ice_excludes[iphonesimulator] := $(wildcard $(addprefix $(currentdir)/RegistryPlugins.cpp))
+Ice[iphoneos]_extra_sources := $(wildcard $(addprefix $(currentdir)/ios/,*.cpp *.mm))
+Ice[iphoneos]_excludes := $(currentdir)/RegisterPluginsInit.cpp
+Ice[iphonesimulator]_extra_sources = $(Ice[iphoneos]_extra_sources)
+Ice[iphonesimulator]_excludes = $(Ice[iphoneos]_excludes)
projects += $(project)
diff --git a/cpp/src/Ice/Selector.cpp b/cpp/src/Ice/Selector.cpp
index 9b52c0d7eb4..580d51d74fe 100644
--- a/cpp/src/Ice/Selector.cpp
+++ b/cpp/src/Ice/Selector.cpp
@@ -552,8 +552,8 @@ Selector::finish(EventHandler* handler, bool closeNow)
{
return false;
}
-#endif
-
+#endif
+
return closeNow;
}
@@ -844,7 +844,7 @@ Selector::checkReady(EventHandler* handler)
if(handler->_ready & ~handler->_disabled & handler->_registered)
{
#ifdef ICE_CPP11_MAPPING
- _readyHandlers.insert(make_pair(dynamic_pointer_cast<EventHandler>(handler->shared_from_this()),
+ _readyHandlers.insert(make_pair(dynamic_pointer_cast<EventHandler>(handler->shared_from_this()),
SocketOperationNone));
#else
_readyHandlers.insert(make_pair(handler, SocketOperationNone));
@@ -854,7 +854,7 @@ Selector::checkReady(EventHandler* handler)
else
{
#ifdef ICE_CPP11_MAPPING
- map<EventHandlerPtr, SocketOperation>::iterator p =
+ map<EventHandlerPtr, SocketOperation>::iterator p =
_readyHandlers.find(dynamic_pointer_cast<EventHandler>(handler->shared_from_this()));
#else
map<EventHandlerPtr, SocketOperation>::iterator p = _readyHandlers.find(handler);
@@ -1038,8 +1038,12 @@ toCFCallbacks(SocketOperation op)
}
-EventHandlerWrapper::EventHandlerWrapper(const EventHandlerPtr& handler, Selector& selector) :
+EventHandlerWrapper::EventHandlerWrapper(EventHandler* handler, Selector& selector) :
+#ifdef ICE_CPP11_MAPPING
+ _handler(std::dynamic_pointer_cast<EventHandler>(handler->shared_from_this())),
+#else
_handler(handler),
+#endif
_streamNativeInfo(StreamNativeInfoPtr::dynamicCast(handler->getNativeInfo())),
_selector(selector),
_ready(SocketOperationNone),
diff --git a/cpp/src/Ice/Selector.h b/cpp/src/Ice/Selector.h
index dd8b8b3ac9c..4f433c32aa4 100644
--- a/cpp/src/Ice/Selector.h
+++ b/cpp/src/Ice/Selector.h
@@ -227,7 +227,7 @@ class EventHandlerWrapper : public SelectorReadyCallback
{
public:
- EventHandlerWrapper(const EventHandlerPtr&, Selector&);
+ EventHandlerWrapper(EventHandler*, Selector&);
~EventHandlerWrapper();
void updateRunLoop();
diff --git a/cpp/src/Ice/Transceiver.h b/cpp/src/Ice/Transceiver.h
index 452b4afd6a1..a0f14ce7ad7 100644
--- a/cpp/src/Ice/Transceiver.h
+++ b/cpp/src/Ice/Transceiver.h
@@ -49,7 +49,7 @@ public:
virtual std::string toDetailedString() const = 0;
virtual Ice::ConnectionInfoPtr getInfo() const = 0;
virtual void checkSendSize(const Buffer&) = 0;
- virtual void setBufferSize(int rcvSize, int sndSize) = 0;
+ virtual void setBufferSize(int, int) = 0;
};
}
diff --git a/cpp/src/Ice/ios/Notifications.mm b/cpp/src/Ice/ios/Notifications.mm
new file mode 100644
index 00000000000..bab9a73824c
--- /dev/null
+++ b/cpp/src/Ice/ios/Notifications.mm
@@ -0,0 +1,138 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <Ice/Config.h>
+
+#if TARGET_OS_IPHONE != 0
+
+#import <Foundation/NSObject.h>
+#import <Foundation/NSNotification.h>
+#import <UIKit/UIApplication.h>
+
+#include <Ice/ConnectionFactory.h>
+
+#include <set>
+
+using namespace std;
+using namespace IceInternal;
+
+namespace IceInternal
+{
+
+bool registerForBackgroundNotification(const IncomingConnectionFactoryPtr&);
+void unregisterForBackgroundNotification(const IncomingConnectionFactoryPtr&);
+
+}
+
+namespace
+{
+
+class Observer
+{
+public:
+
+ Observer() : _background(false)
+ {
+ [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification*)
+ {
+ didEnterBackground();
+ }];
+
+ [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillEnterForegroundNotification
+ object:nil
+ queue:nil
+ usingBlock:^(NSNotification*)
+ {
+ willEnterForeground();
+ }];
+ }
+
+ bool
+ add(const IncomingConnectionFactoryPtr& factory)
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _factories.insert(factory);
+ if(_background)
+ {
+ factory->stopAcceptor();
+ }
+ else
+ {
+ factory->startAcceptor();
+ }
+ return _background;
+ }
+
+ void
+ remove(const IncomingConnectionFactoryPtr& factory)
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+ _factories.erase(factory);
+ }
+
+ void
+ didEnterBackground()
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+
+ //
+ // Notify all the incoming connection factories that we are
+ // entering the background mode.
+ //
+ for(set<IncomingConnectionFactoryPtr>::const_iterator p = _factories.begin(); p != _factories.end(); ++p)
+ {
+ (*p)->stopAcceptor();
+ }
+ _background = true;
+ }
+
+ void
+ willEnterForeground()
+ {
+ IceUtil::Mutex::Lock sync(_mutex);
+
+ //
+ // Notify all the incoming connection factories that we are
+ // entering the foreground mode.
+ //
+ _background = false;
+ for(set<IncomingConnectionFactoryPtr>::const_iterator p = _factories.begin(); p != _factories.end(); ++p)
+ {
+ (*p)->startAcceptor();
+ }
+ }
+
+private:
+
+ IceUtil::Mutex _mutex;
+ bool _background;
+ set<IncomingConnectionFactoryPtr> _factories;
+};
+
+
+}
+
+static Observer* observer = new Observer();
+
+bool
+IceInternal::registerForBackgroundNotification(const IncomingConnectionFactoryPtr& factory)
+{
+ return observer->add(factory);
+}
+
+void
+IceInternal::unregisterForBackgroundNotification(const IncomingConnectionFactoryPtr& factory)
+{
+ observer->remove(factory);
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/RegisterPluginsInit.cpp b/cpp/src/Ice/ios/RegisterPluginsInit.cpp
new file mode 100644
index 00000000000..712f4dcc765
--- /dev/null
+++ b/cpp/src/Ice/ios/RegisterPluginsInit.cpp
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <Ice/RegisterPluginsInit.h>
+#include <Ice/CommunicatorF.h>
+#include <Ice/Initialize.h>
+
+extern "C"
+{
+
+Ice::Plugin* createIceUDP(const Ice::CommunicatorPtr&, const std::string&, const Ice::StringSeq&);
+Ice::Plugin* createIceTCP(const Ice::CommunicatorPtr&, const std::string&, const Ice::StringSeq&);
+Ice::Plugin* createIceSSL(const Ice::CommunicatorPtr&, const std::string&, const Ice::StringSeq&);
+Ice::Plugin* createIceIAP(const Ice::CommunicatorPtr&, const std::string&, const Ice::StringSeq&);
+
+};
+
+IceInternal::RegisterPluginsInit::RegisterPluginsInit()
+{
+ Ice::registerPluginFactory("IceUDP", createIceUDP, true);
+ Ice::registerPluginFactory("IceTCP", createIceTCP, true);
+ Ice::registerPluginFactory("IceSSL", createIceSSL, true);
+ Ice::registerPluginFactory("IceIAP", createIceIAP, true);
+}
diff --git a/cpp/src/Ice/ios/StreamAcceptor.cpp b/cpp/src/Ice/ios/StreamAcceptor.cpp
new file mode 100644
index 00000000000..3d1a4a956b0
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamAcceptor.cpp
@@ -0,0 +1,160 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "StreamTransceiver.h"
+#include "StreamEndpointI.h"
+#include "StreamAcceptor.h"
+
+#include <IceUtil/StringUtil.h>
+
+#include <Ice/Instance.h>
+#include <Ice/Network.h>
+#include <Ice/Exception.h>
+#include <Ice/Properties.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+NativeInfoPtr
+IceObjC::StreamAcceptor::getNativeInfo()
+{
+ return this;
+}
+
+void
+IceObjC::StreamAcceptor::close()
+{
+ if(_fd != INVALID_SOCKET)
+ {
+ closeSocketNoThrow(_fd);
+ _fd = INVALID_SOCKET;
+ }
+}
+
+EndpointIPtr
+IceObjC::StreamAcceptor::listen()
+{
+ try
+ {
+ const_cast<Address&>(_addr) = doBind(_fd, _addr);
+ doListen(_fd, _backlog);
+ }
+ catch(...)
+ {
+ _fd = INVALID_SOCKET;
+ throw;
+ }
+
+ _endpoint = _endpoint->endpoint(this);
+ return _endpoint;
+}
+
+TransceiverPtr
+IceObjC::StreamAcceptor::accept()
+{
+ SOCKET fd = doAccept(_fd);
+ setBlock(fd, false);
+ setTcpBufSize(fd, _instance);
+
+ //
+ // Create the read/write streams
+ //
+ CFReadStreamRef readStream = nil;
+ CFWriteStreamRef writeStream = nil;
+ try
+ {
+ CFStreamCreatePairWithSocket(NULL, fd, &readStream, &writeStream);
+ _instance->setupStreams(readStream, writeStream, true, "");
+ return new StreamTransceiver(_instance, readStream, writeStream, fd);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(fd != INVALID_SOCKET)
+ {
+ closeSocketNoThrow(fd);
+ }
+ if(readStream)
+ {
+ CFRelease(readStream);
+ }
+ if(writeStream)
+ {
+ CFRelease(writeStream);
+ }
+ throw;
+ }
+}
+
+string
+IceObjC::StreamAcceptor::protocol() const
+{
+ return _instance->protocol();
+}
+
+string
+IceObjC::StreamAcceptor::toString() const
+{
+ return addrToString(_addr);
+}
+
+string
+IceObjC::StreamAcceptor::toDetailedString() const
+{
+ ostringstream os;
+ os << "local address = " << toString();
+ vector<string> intfs = getHostsForEndpointExpand(inetAddrToString(_addr), _instance->protocolSupport(), true);
+ if(!intfs.empty())
+ {
+ os << "\nlocal interfaces = ";
+ os << IceUtilInternal::joinString(intfs, ", ");
+ }
+ return os.str();
+}
+
+int
+IceObjC::StreamAcceptor::effectivePort() const
+{
+ return getPort(_addr);
+}
+
+IceObjC::StreamAcceptor::StreamAcceptor(const StreamEndpointIPtr& endpoint,
+ const InstancePtr& instance,
+ const string& host,
+ int port) :
+ _endpoint(endpoint),
+ _instance(instance),
+ _addr(getAddressForServer(host, port, instance->protocolSupport(), instance->preferIPv6()))
+{
+#ifdef SOMAXCONN
+ _backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", SOMAXCONN);
+#else
+ _backlog = instance->properties()->getPropertyAsIntWithDefault("Ice.TCP.Backlog", 511);
+#endif
+
+ try
+ {
+ _fd = createSocket(false, _addr);
+ setBlock(_fd, false);
+ setTcpBufSize(_fd, _instance);
+ setReuseAddress(_fd, true);
+ }
+ catch(...)
+ {
+ _fd = INVALID_SOCKET;
+ throw;
+ }
+}
+
+IceObjC::StreamAcceptor::~StreamAcceptor()
+{
+ assert(_fd == INVALID_SOCKET);
+}
diff --git a/cpp/src/Ice/ios/StreamAcceptor.h b/cpp/src/Ice/ios/StreamAcceptor.h
new file mode 100644
index 00000000000..5997ac7c6db
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamAcceptor.h
@@ -0,0 +1,54 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_STREAM_ACCEPTOR_H
+#define ICE_STREAM_ACCEPTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/Acceptor.h>
+
+namespace IceObjC
+{
+
+class StreamEndpointI;
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+typedef ::std::shared_ptr<StreamEndpointI> StreamEndpointIPtr;
+#else
+typedef IceUtil::Handle<StreamEndpointI> StreamEndpointIPtr;
+#endif
+
+class StreamAcceptor : public IceInternal::Acceptor, public IceInternal::NativeInfo
+{
+public:
+
+ virtual IceInternal::NativeInfoPtr getNativeInfo();
+ virtual void close();
+ virtual IceInternal::EndpointIPtr listen();
+ virtual IceInternal::TransceiverPtr accept();
+ virtual std::string protocol() const;
+ virtual std::string toString() const;
+ virtual std::string toDetailedString() const;
+
+ int effectivePort() const;
+
+private:
+
+ StreamAcceptor(const StreamEndpointIPtr&, const InstancePtr&, const std::string&, int);
+ virtual ~StreamAcceptor();
+ friend class StreamEndpointI;
+
+ StreamEndpointIPtr _endpoint;
+ InstancePtr _instance;
+ int _backlog;
+ IceInternal::Address _addr;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/StreamConnector.cpp b/cpp/src/Ice/ios/StreamConnector.cpp
new file mode 100644
index 00000000000..a5b87b07db0
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamConnector.cpp
@@ -0,0 +1,169 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "StreamTransceiver.h"
+#include "StreamEndpointI.h"
+#include "StreamConnector.h"
+
+#include <Ice/Network.h>
+#include <Ice/Exception.h>
+#include <Ice/Properties.h>
+#include <Ice/NetworkProxy.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+TransceiverPtr
+IceObjC::StreamConnector::connect()
+{
+ CFReadStreamRef readStream = nil;
+ CFWriteStreamRef writeStream = nil;
+ try
+ {
+ CFStringRef h = CFStringCreateWithCString(NULL, _host.c_str(), kCFStringEncodingUTF8);
+ CFHostRef host = CFHostCreateWithName(NULL, h);
+ CFRelease(h);
+ CFStreamCreatePairWithSocketToCFHost(NULL, host, _port, &readStream, &writeStream);
+ CFRelease(host);
+
+ _instance->setupStreams(readStream, writeStream, false, _host);
+ return new StreamTransceiver(_instance, readStream, writeStream, _host, _port);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ if(readStream)
+ {
+ CFRelease(readStream);
+ }
+ if(writeStream)
+ {
+ CFRelease(writeStream);
+ }
+ throw;
+ }
+}
+
+Short
+IceObjC::StreamConnector::type() const
+{
+ return _instance->type();
+}
+
+string
+IceObjC::StreamConnector::toString() const
+{
+ string proxyHost = _instance->proxyHost();
+ ostringstream os;
+ if(!proxyHost.empty())
+ {
+ os << proxyHost << ":" << _instance->proxyPort();
+ }
+ else
+ {
+ os << _host << ":" << _port;
+ }
+ return os.str();
+}
+
+bool
+IceObjC::StreamConnector::operator==(const IceInternal::Connector& r) const
+{
+ const StreamConnector* p = dynamic_cast<const StreamConnector*>(&r);
+ if(!p)
+ {
+ return false;
+ }
+
+ if(_timeout != p->_timeout)
+ {
+ return false;
+ }
+
+ if(_connectionId != p->_connectionId)
+ {
+ return false;
+ }
+
+ if(_host != p->_host)
+ {
+ return false;
+ }
+
+ if(_port != p->_port)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+IceObjC::StreamConnector::operator!=(const IceInternal::Connector& r) const
+{
+ return !operator==(r);
+}
+
+bool
+IceObjC::StreamConnector::operator<(const IceInternal::Connector& r) const
+{
+ const StreamConnector* p = dynamic_cast<const StreamConnector*>(&r);
+ if(!p)
+ {
+ return type() < r.type();
+ }
+
+ if(_timeout < p->_timeout)
+ {
+ return true;
+ }
+ else if(p->_timeout < _timeout)
+ {
+ return false;
+ }
+
+ if(_connectionId < p->_connectionId)
+ {
+ return true;
+ }
+ else if(p->_connectionId < _connectionId)
+ {
+ return false;
+ }
+
+ if(_host < p->_host)
+ {
+ return true;
+ }
+ else if(p->_host < _host)
+ {
+ return false;
+ }
+
+ return _port < p->_port;
+}
+
+IceObjC::StreamConnector::StreamConnector(const InstancePtr& instance,
+ const string& host,
+ Ice::Int port,
+ Ice::Int timeout,
+ const string& connectionId) :
+ _instance(instance),
+ _host(host.empty() ? string("127.0.0.1") : host),
+ _port(port),
+ _timeout(timeout),
+ _connectionId(connectionId)
+{
+}
+
+IceObjC::StreamConnector::~StreamConnector()
+{
+}
diff --git a/cpp/src/Ice/ios/StreamConnector.h b/cpp/src/Ice/ios/StreamConnector.h
new file mode 100644
index 00000000000..91d806fd707
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamConnector.h
@@ -0,0 +1,52 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_STREAM_CONNECTOR_H
+#define ICE_STREAM_CONNECTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/Connector.h>
+
+namespace IceObjC
+{
+
+class StreamEndpointI;
+
+class Instance;
+typedef IceUtil::Handle<Instance> InstancePtr;
+
+class StreamConnector : public IceInternal::Connector
+{
+public:
+
+ virtual IceInternal::TransceiverPtr connect();
+
+ virtual Ice::Short type() const;
+ virtual std::string toString() const;
+
+ virtual bool operator==(const IceInternal::Connector&) const;
+ virtual bool operator!=(const IceInternal::Connector&) const;
+ virtual bool operator<(const IceInternal::Connector&) const;
+
+private:
+
+ StreamConnector(const InstancePtr&, const std::string&, Ice::Int, Ice::Int, const std::string&);
+ virtual ~StreamConnector();
+ friend class StreamEndpointI;
+
+ const InstancePtr _instance;
+ const std::string _host;
+ const Ice::Int _port;
+ const Ice::Int _timeout;
+ const std::string _connectionId;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/StreamEndpointI.cpp b/cpp/src/Ice/ios/StreamEndpointI.cpp
new file mode 100644
index 00000000000..0be2584140c
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamEndpointI.cpp
@@ -0,0 +1,820 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "StreamEndpointI.h"
+#include "StreamAcceptor.h"
+#include "StreamConnector.h"
+
+#include <IceUtil/StringUtil.h>
+
+#include <Ice/Network.h>
+#include <Ice/InputStream.h>
+#include <Ice/OutputStream.h>
+#include <Ice/LocalException.h>
+#include <Ice/Communicator.h>
+#include <Ice/EndpointFactoryManager.h>
+#include <Ice/Properties.h>
+#include <Ice/HashUtil.h>
+#include <Ice/NetworkProxy.h>
+
+#include <IceSSL/EndpointInfo.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <Security/Security.h>
+
+#include <fstream>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+extern "C"
+{
+
+Plugin*
+createIceTCP(const CommunicatorPtr& com, const string&, const StringSeq&)
+{
+ IceObjC::InstancePtr tcpInstance = new IceObjC::Instance(com, TCPEndpointType, "tcp", false);
+ return new EndpointFactoryPlugin(com, new IceObjC::StreamEndpointFactory(tcpInstance));
+}
+
+Plugin*
+createIceSSL(const CommunicatorPtr& com, const string&, const StringSeq&)
+{
+ IceObjC::InstancePtr sslInstance = new IceObjC::Instance(com, SSLEndpointType, "ssl", true);
+ return new EndpointFactoryPlugin(com, new IceObjC::StreamEndpointFactory(sslInstance));
+}
+
+}
+
+namespace Ice
+{
+
+void
+registerIceSSL(bool)
+{
+ // Nothing to do, we always register IceSSL
+}
+
+}
+
+inline CFStringRef
+toCFString(const string& s)
+{
+ return CFStringCreateWithCString(NULL, s.c_str(), kCFStringEncodingUTF8);
+}
+
+inline int
+hexValue(char c)
+{
+ if(c >= '0' && c <= '9')
+ {
+ return c - '0';
+ }
+ else if(c >= 'A' && c <= 'F')
+ {
+ return (c - 'A') + 10;
+ }
+ else if(c >= 'a' && c <= 'f')
+ {
+ return (c - 'a') + 10;
+ }
+ return -1;
+}
+
+inline CFDataRef
+parseKey(const string& keyStr)
+{
+ int i = 0, j = 0;
+ const char* m = keyStr.c_str();
+ CFMutableDataRef data = CFDataCreateMutable(0, 160);
+ unsigned char buf[160];
+ while(i < (int)keyStr.size())
+ {
+ if(isspace(m[i]) || m[i] == ':')
+ {
+ ++i;
+ continue;
+ }
+ else if(i == (int)keyStr.size() - 1)
+ {
+ CFRelease(data);
+ return 0; // Not enough bytes.
+ }
+
+ int vh = hexValue(m[i++]);
+ int vl = hexValue(m[i++]);
+ if(vh < 0 || vl < 0)
+ {
+ CFRelease(data);
+ return 0;
+ }
+ buf[j] = vh << 4;
+ buf[j++] += vl;
+
+ if(j == sizeof(buf))
+ {
+ CFDataAppendBytes(data, (UInt8*)buf, j);
+ j = 0;
+ }
+ }
+
+ if(j > 0)
+ {
+ CFDataAppendBytes(data, buf, j);
+ }
+
+ return data;
+}
+
+namespace
+{
+
+CFDataRef
+readCert(const string& defaultDir, const string& certFile)
+{
+ string path;
+ CFURLRef url = 0;
+ CFBundleRef bundle = CFBundleGetMainBundle();
+ if(bundle)
+ {
+ CFStringRef resourceName = toCFString(certFile);
+ CFStringRef subDirName = toCFString(defaultDir);
+ url = CFBundleCopyResourceURL(bundle, resourceName, 0, subDirName);
+ CFRelease(resourceName);
+ CFRelease(subDirName);
+
+ UInt8 filePath[PATH_MAX];
+ if(CFURLGetFileSystemRepresentation(url, true, filePath, sizeof(filePath)))
+ {
+ path = string(reinterpret_cast<char*>(filePath));
+ }
+ }
+
+ if(!url || path.empty())
+ {
+ path = defaultDir.empty() ? certFile : defaultDir + "/" + certFile;
+ }
+
+ FILE *file = fopen(path.c_str(), "rb");
+ if(!file)
+ {
+ ostringstream os;
+ os << "IceSSL: unable to open file " << certFile << " (error = " << IceUtilInternal::lastErrorToString() << ")";
+ throw InitializationException(__FILE__, __LINE__, os.str());
+ }
+
+ fseek(file, 0, SEEK_END);
+ unsigned long size = ftell(file);
+ fseek(file, 0, SEEK_SET);
+ CFMutableDataRef data = CFDataCreateMutable(kCFAllocatorDefault, size);
+ CFDataSetLength(data, size);
+ if(fread(CFDataGetMutableBytePtr(data), 1, size, file) != size)
+ {
+ CFRelease(data);
+ ostringstream os;
+ os << "IceSSL: error while reading file " << certFile;
+ throw InitializationException(__FILE__, __LINE__, os.str());
+ }
+ fclose(file);
+ return data;
+}
+
+}
+
+IceObjC::Instance::Instance(const Ice::CommunicatorPtr& com, Short type, const string& protocol, bool secure) :
+ ProtocolInstance(com, type, protocol, secure),
+ _voip(com->getProperties()->getPropertyAsIntWithDefault("Ice.Voip", 0) > 0),
+ _communicator(com),
+ _serverSettings(0),
+ _clientSettings(0),
+ _proxySettings(0),
+ _certificateAuthorities(0),
+ _trustOnlyKeyID(0)
+{
+ const Ice::PropertiesPtr properties = com->getProperties();
+ if(secure)
+ {
+ _clientSettings = CFDictionaryCreateMutable(0, 1, &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+ string defaultDir = properties->getProperty("IceSSL.DefaultDir");
+ string certAuthFile = properties->getProperty("IceSSL.CAs");
+ if(certAuthFile.empty())
+ {
+ certAuthFile = properties->getProperty("IceSSL.CertAuthFile");
+ }
+ string certFile = properties->getProperty("IceSSL.CertFile");
+
+ OSStatus err;
+ if(!certAuthFile.empty())
+ {
+ CFDataRef cert = readCert(defaultDir, certAuthFile);
+ if(!cert)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to open file " + certAuthFile;
+ throw ex;
+ }
+
+ SecCertificateRef result = SecCertificateCreateWithData(0, cert);
+ CFRelease(cert);
+ if(!result)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: certificate " + certAuthFile + " is not a valid DER-encoded certificate";
+ throw ex;
+ }
+
+ SecCertificateRef certs[] = { result };
+ _certificateAuthorities = CFArrayCreate(0, (const void**)certs, 1, &kCFTypeArrayCallBacks);
+ CFRelease(result);
+
+ // The root CA will be validated by the transceiver.
+ // NOTE: on the iPhone, setting kCFStreamSSLAllowsAnyRoot = true isn't enough.
+ //CFDictionarySetValue(_clientSettings, kCFStreamSSLAllowsAnyRoot, kCFBooleanTrue);
+ CFDictionarySetValue(_clientSettings, kCFStreamSSLValidatesCertificateChain, kCFBooleanFalse);
+ }
+ else if(properties->getPropertyAsInt("IceSSL.UsePlatformCAs") <= 0)
+ {
+ // Setup an empty list of Root CAs to not use the system root CAs.
+ _certificateAuthorities = CFArrayCreate(0, 0, 0, 0);
+ }
+
+ if(!certFile.empty())
+ {
+ CFDataRef cert = readCert(defaultDir, certFile);
+ if(!cert)
+ {
+ InitializationException ex(__FILE__, __LINE__);
+ ex.reason = "IceSSL: unable to open file " + certFile;
+ throw ex;
+ }
+
+ CFMutableDictionaryRef settings = CFDictionaryCreateMutable(0, 1, &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+ CFStringRef password = toCFString(properties->getProperty("IceSSL.Password"));
+ CFDictionarySetValue(settings, kSecImportExportPassphrase, password);
+ CFRelease(password);
+
+ CFArrayRef items = 0;
+ err = SecPKCS12Import(cert, settings, &items);
+ CFRelease(cert);
+ CFRelease(settings);
+ if(err != noErr)
+ {
+ ostringstream os;
+ os << "IceSSL: unable to import certificate from file " << certFile << " (error = " << err << ")";
+ throw InitializationException(__FILE__, __LINE__, os.str());
+ }
+
+ SecIdentityRef identity = 0;
+ if(CFArrayGetCount(items) > 0)
+ {
+ identity = (SecIdentityRef)CFDictionaryGetValue((CFDictionaryRef)CFArrayGetValueAtIndex(items, 0),
+ kSecImportItemIdentity);
+ }
+ if(identity == 0)
+ {
+ ostringstream os;
+ os << "IceSSL: couldn't find identity in file " << certFile << " (error = " << err << ")";
+ throw InitializationException(__FILE__, __LINE__, os.str());
+ }
+ CFRetain(identity);
+ CFRelease(items);
+
+ SecIdentityRef identities[] = { identity };
+ items = CFArrayCreate(0, (const void**)identities, 1, &kCFTypeArrayCallBacks);
+ CFDictionarySetValue(_clientSettings, kCFStreamSSLCertificates, items);
+ CFRelease(identity);
+ CFRelease(items);
+ }
+
+ string trustOnly = properties->getProperty("IceSSL.TrustOnly.Client");
+ if(!trustOnly.empty())
+ {
+ _trustOnlyKeyID = parseKey(trustOnly);
+ if(!_trustOnlyKeyID)
+ {
+ ostringstream os;
+ os << "IceSSL: invalid `IceSSL.TrustOnly.Client' property value";
+ throw InitializationException(__FILE__, __LINE__, os.str());
+ }
+ }
+
+ _serverSettings = CFDictionaryCreateMutableCopy(0, 0, _clientSettings);
+ CFDictionarySetValue(_serverSettings, kCFStreamSSLIsServer, kCFBooleanTrue);
+ }
+
+ //
+ // Proxy settings
+ //
+ _proxyHost = properties->getProperty("Ice.SOCKSProxyHost");
+ if(!_proxyHost.empty())
+ {
+#if TARGET_IPHONE_SIMULATOR != 0
+ throw Ice::FeatureNotSupportedException(__FILE__, __LINE__, "SOCKS proxy not supported");
+#endif
+ _proxySettings = CFDictionaryCreateMutable(0, 3, &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+ _proxyPort = properties->getPropertyAsIntWithDefault("Ice.SOCKSProxyPort", 1080);
+
+ CFStringRef host = toCFString(_proxyHost);
+ CFDictionarySetValue(_proxySettings, kCFStreamPropertySOCKSProxyHost, host);
+ CFRelease(host);
+
+ CFNumberRef port = CFNumberCreate(0, kCFNumberSInt32Type, &_proxyPort);
+ CFDictionarySetValue(_proxySettings, kCFStreamPropertySOCKSProxyPort, port);
+ CFRelease(port);
+
+ CFDictionarySetValue(_proxySettings, kCFStreamPropertySOCKSVersion, kCFStreamSocketSOCKSVersion4);
+ }
+}
+
+IceObjC::Instance::~Instance()
+{
+ if(_trustOnlyKeyID)
+ {
+ CFRelease(_trustOnlyKeyID);
+ }
+ if(_serverSettings)
+ {
+ CFRelease(_serverSettings);
+ }
+ if(_clientSettings)
+ {
+ CFRelease(_clientSettings);
+ }
+ if(_certificateAuthorities)
+ {
+ CFRelease(_certificateAuthorities);
+ }
+ if(_proxySettings)
+ {
+ CFRelease(_proxySettings);
+ }
+}
+
+void
+IceObjC::Instance::setupStreams(CFReadStreamRef readStream,
+ CFWriteStreamRef writeStream,
+ bool server,
+ const string& host) const
+{
+ if(_voip)
+ {
+#if TARGET_IPHONE_SIMULATOR == 0
+ if(!CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP) ||
+ !CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP))
+ {
+ throw Ice::SyscallException(__FILE__, __LINE__);
+ }
+#endif
+ }
+
+ if(!server && _proxySettings)
+ {
+ if(!CFReadStreamSetProperty(readStream, kCFStreamPropertySOCKSProxy, _proxySettings) ||
+ !CFWriteStreamSetProperty(writeStream, kCFStreamPropertySOCKSProxy, _proxySettings))
+ {
+ throw Ice::SyscallException(__FILE__, __LINE__);
+ }
+ }
+
+ if(secure())
+ {
+ CFDictionaryRef settings = server ? _serverSettings : _clientSettings;
+
+ if(!CFReadStreamSetProperty(readStream, kCFStreamPropertySocketSecurityLevel,
+ kCFStreamSocketSecurityLevelNegotiatedSSL) ||
+ !CFWriteStreamSetProperty(writeStream, kCFStreamPropertySocketSecurityLevel,
+ kCFStreamSocketSecurityLevelNegotiatedSSL))
+ {
+ throw Ice::SecurityException(__FILE__, __LINE__, "couldn't set security level");
+ }
+
+ if(!server && properties()->getPropertyAsIntWithDefault("IceSSL.CheckCertName", 1))
+ {
+ settings = CFDictionaryCreateMutableCopy(0, 0, settings);
+
+ CFStringRef h = toCFString(host);
+ CFDictionarySetValue((CFMutableDictionaryRef)settings, kCFStreamSSLPeerName, h);
+ CFRelease(h);
+ }
+ else
+ {
+ CFRetain(settings);
+ }
+
+ if(!CFReadStreamSetProperty(readStream, kCFStreamPropertySSLSettings, settings) ||
+ !CFWriteStreamSetProperty(writeStream, kCFStreamPropertySSLSettings, settings))
+ {
+ CFRelease(settings);
+ throw Ice::SecurityException(__FILE__, __LINE__, "couldn't set security options");
+ }
+ CFRelease(settings);
+ }
+}
+
+IceObjC::Instance*
+IceObjC::Instance::clone(const ProtocolInstancePtr& instance)
+{
+ return new Instance(_communicator, instance->type(), instance->protocol(), instance->secure());
+}
+
+IceObjC::StreamEndpointI::StreamEndpointI(const InstancePtr& instance, const string& ho, Int po,
+ const Address& sourceAddr, Int ti, const string& conId, bool co) :
+ IceInternal::IPEndpointI(instance, ho, po, sourceAddr, conId),
+ _instance(instance),
+ _timeout(ti),
+ _compress(co)
+{
+}
+
+IceObjC::StreamEndpointI::StreamEndpointI(const InstancePtr& instance) :
+ IceInternal::IPEndpointI(instance),
+ _instance(instance),
+ _timeout(instance->defaultTimeout()),
+ _compress(false)
+{
+}
+
+IceObjC::StreamEndpointI::StreamEndpointI(const InstancePtr& instance, Ice::InputStream* s) :
+ IPEndpointI(instance, s),
+ _instance(instance),
+ _timeout(-1),
+ _compress(false)
+{
+ s->read(const_cast<Int&>(_timeout));
+ s->read(const_cast<bool&>(_compress));
+}
+
+EndpointInfoPtr
+IceObjC::StreamEndpointI::getInfo() const
+{
+ IPEndpointInfoPtr info;
+ if(_instance->secure())
+ {
+ info = ICE_MAKE_SHARED(InfoI<IceSSL::EndpointInfo>, ICE_DYNAMIC_CAST(StreamEndpointI, shared_from_this()));
+ }
+ else
+ {
+ info = ICE_MAKE_SHARED(InfoI<Ice::TCPEndpointInfo>, ICE_DYNAMIC_CAST(StreamEndpointI, shared_from_this()));
+ }
+ fillEndpointInfo(info.get());
+ return info;
+}
+
+EndpointInfoPtr
+IceObjC::StreamEndpointI::getWSInfo(const string& resource) const
+{
+ IPEndpointInfoPtr info;
+ if(_instance->secure())
+ {
+ IceSSL::WSSEndpointInfoPtr i;
+ i = ICE_MAKE_SHARED(InfoI<IceSSL::WSSEndpointInfo>, ICE_DYNAMIC_CAST(StreamEndpointI, shared_from_this()));
+ i->resource = resource;
+ info = i;
+ }
+ else
+ {
+ Ice::WSEndpointInfoPtr i;
+ i = ICE_MAKE_SHARED(InfoI<Ice::WSEndpointInfo>, ICE_DYNAMIC_CAST(StreamEndpointI, shared_from_this()));
+ i->resource = resource;
+ info = i;
+ }
+ fillEndpointInfo(info.get());
+ return info;
+}
+
+Int
+IceObjC::StreamEndpointI::timeout() const
+{
+ return _timeout;
+}
+
+EndpointIPtr
+IceObjC::StreamEndpointI::timeout(Int t) const
+{
+ if(t == _timeout)
+ {
+ return shared_from_this();
+ }
+ else
+ {
+ return ICE_MAKE_SHARED(StreamEndpointI, _instance, _host, _port, _sourceAddr, t, _connectionId, _compress);
+ }
+}
+
+bool
+IceObjC::StreamEndpointI::compress() const
+{
+ return _compress;
+}
+
+EndpointIPtr
+IceObjC::StreamEndpointI::compress(bool c) const
+{
+ if(c == _compress)
+ {
+ return shared_from_this();
+ }
+ else
+ {
+ return ICE_MAKE_SHARED(StreamEndpointI, _instance, _host, _port, _sourceAddr, _timeout, _connectionId, c);
+ }
+}
+
+bool
+IceObjC::StreamEndpointI::datagram() const
+{
+ return false;
+}
+
+bool
+IceObjC::StreamEndpointI::secure() const
+{
+ return _instance->secure();
+}
+
+void
+IceObjC::StreamEndpointI::connectors_async(Ice::EndpointSelectionType selType, const EndpointI_connectorsPtr& cb) const
+{
+ vector<ConnectorPtr> connectors;
+ connectors.push_back(new StreamConnector(_instance, _host, _port, _timeout, _connectionId));
+ cb->connectors(connectors);
+}
+
+TransceiverPtr
+IceObjC::StreamEndpointI::transceiver() const
+{
+ return 0;
+}
+
+AcceptorPtr
+IceObjC::StreamEndpointI::acceptor(const string&) const
+{
+ return new StreamAcceptor(ICE_DYNAMIC_CAST(StreamEndpointI, shared_from_this()), _instance, _host, _port);
+}
+
+IceObjC::StreamEndpointIPtr
+IceObjC::StreamEndpointI::endpoint(const StreamAcceptorPtr& a) const
+{
+ return ICE_MAKE_SHARED(StreamEndpointI, _instance, _host, a->effectivePort(), _sourceAddr, _timeout, _connectionId,
+ _compress);
+}
+
+string
+IceObjC::StreamEndpointI::options() const
+{
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ ostringstream s;
+
+ s << IPEndpointI::options();
+
+ if(_timeout == -1)
+ {
+ s << " -t infinite";
+ }
+ else
+ {
+ s << " -t " << _timeout;
+ }
+
+ if(_compress)
+ {
+ s << " -z";
+ }
+
+ return s.str();
+}
+
+bool
+#ifdef ICE_CPP11_MAPPING
+IceObjC::StreamEndpointI::operator==(const Endpoint& r) const
+#else
+IceObjC::StreamEndpointI::operator==(const LocalObject& r) const
+#endif
+{
+ if(!IPEndpointI::operator==(r))
+ {
+ return false;
+ }
+
+ const StreamEndpointI* p = dynamic_cast<const StreamEndpointI*>(&r);
+ if(!p)
+ {
+ return false;
+ }
+
+ if(this == p)
+ {
+ return true;
+ }
+
+ if(_timeout != p->_timeout)
+ {
+ return false;
+ }
+
+ if(_compress != p->_compress)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+#ifdef ICE_CPP11_MAPPING
+IceObjC::StreamEndpointI::operator<(const Endpoint& r) const
+#else
+IceObjC::StreamEndpointI::operator<(const LocalObject& r) const
+#endif
+{
+ const StreamEndpointI* p = dynamic_cast<const StreamEndpointI*>(&r);
+ if(!p)
+ {
+ const IceInternal::EndpointI* e = dynamic_cast<const IceInternal::EndpointI*>(&r);
+ if(!e)
+ {
+ return false;
+ }
+ return type() < e->type();
+ }
+
+ if(this == p)
+ {
+ return false;
+ }
+
+ if(_timeout < p->_timeout)
+ {
+ return true;
+ }
+ else if(p->_timeout < _timeout)
+ {
+ return false;
+ }
+
+ if(!_compress && p->_compress)
+ {
+ return true;
+ }
+ else if(p->_compress < _compress)
+ {
+ return false;
+ }
+
+ return IPEndpointI::operator<(r);
+}
+
+void
+IceObjC::StreamEndpointI::streamWriteImpl(Ice::OutputStream* s) const
+{
+ IPEndpointI::streamWriteImpl(s);
+ s->write(_timeout);
+ s->write(_compress);
+}
+
+void
+IceObjC::StreamEndpointI::hashInit(Ice::Int& h) const
+{
+ IPEndpointI::hashInit(h);
+ hashAdd(h, _timeout);
+ hashAdd(h, _compress);
+}
+
+void
+IceObjC::StreamEndpointI::fillEndpointInfo(IPEndpointInfo* info) const
+{
+ IPEndpointI::fillEndpointInfo(info);
+ info->timeout = _timeout;
+ info->compress = _compress;
+}
+
+bool
+IceObjC::StreamEndpointI::checkOption(const string& option, const string& argument, const string& endpoint)
+{
+ if(IPEndpointI::checkOption(option, argument, endpoint))
+ {
+ return true;
+ }
+
+ switch(option[1])
+ {
+ case 't':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "no argument provided for -t option in endpoint " + endpoint;
+ throw ex;
+ }
+
+ if(argument == "infinite")
+ {
+ const_cast<Int&>(_timeout) = -1;
+ }
+ else
+ {
+ istringstream t(argument);
+ if(!(t >> const_cast<Int&>(_timeout)) || !t.eof() || _timeout < 1)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint;
+ throw ex;
+ }
+ }
+ return true;
+ }
+
+ case 'z':
+ {
+ if(!argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "unexpected argument `" + argument + "' provided for -z option in " + endpoint;
+ throw ex;
+ }
+ const_cast<bool&>(_compress) = true;
+ return true;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+}
+
+ConnectorPtr
+IceObjC::StreamEndpointI::createConnector(const Address& address, const NetworkProxyPtr& proxy) const
+{
+ assert(false);
+}
+
+IPEndpointIPtr
+IceObjC::StreamEndpointI::createEndpoint(const string& host, int port, const string& connectionId) const
+{
+ return ICE_MAKE_SHARED(StreamEndpointI, _instance, host, port, _sourceAddr, _timeout, connectionId, _compress);
+}
+
+IceObjC::StreamEndpointFactory::StreamEndpointFactory(const InstancePtr& instance) : _instance(instance)
+{
+}
+
+IceObjC::StreamEndpointFactory::~StreamEndpointFactory()
+{
+}
+
+Short
+IceObjC::StreamEndpointFactory::type() const
+{
+ return _instance->type();
+}
+
+string
+IceObjC::StreamEndpointFactory::protocol() const
+{
+ return _instance->protocol();
+}
+
+EndpointIPtr
+IceObjC::StreamEndpointFactory::create(vector<string>& args, bool oaEndpoint) const
+{
+ IPEndpointIPtr endpt = ICE_MAKE_SHARED(StreamEndpointI, _instance);
+ endpt->initWithOptions(args, oaEndpoint);
+ return endpt;
+}
+
+EndpointIPtr
+IceObjC::StreamEndpointFactory::read(Ice::InputStream* s) const
+{
+ return ICE_MAKE_SHARED(StreamEndpointI, _instance, s);
+}
+
+void
+IceObjC::StreamEndpointFactory::destroy()
+{
+ _instance = 0;
+}
+
+EndpointFactoryPtr
+IceObjC::StreamEndpointFactory::clone(const ProtocolInstancePtr& instance) const
+{
+ return new StreamEndpointFactory(_instance->clone(instance));
+}
diff --git a/cpp/src/Ice/ios/StreamEndpointI.h b/cpp/src/Ice/ios/StreamEndpointI.h
new file mode 100644
index 00000000000..8e45febc64b
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamEndpointI.h
@@ -0,0 +1,170 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_STREAM_ENDPOINT_I_H
+#define ICE_STREAM_ENDPOINT_I_H
+
+#include <Ice/ProtocolInstance.h>
+#include <Ice/IPEndpointI.h>
+#include <Ice/WSEndpoint.h>
+#include <Ice/EndpointFactory.h>
+#include <Ice/InstanceF.h>
+
+#include <CoreFoundation/CFDictionary.h>
+#include <CFNetwork/CFNetwork.h>
+
+namespace Ice
+{
+
+class OutputStream;
+class InputStream;
+
+}
+
+namespace IceObjC
+{
+
+class Instance : public IceInternal::ProtocolInstance
+{
+public:
+
+ Instance(const Ice::CommunicatorPtr&, Ice::Short, const std::string&, bool);
+ virtual ~Instance();
+
+ CFArrayRef certificateAuthorities() const
+ {
+ return _certificateAuthorities;
+ }
+
+ CFDataRef trustOnlyKeyID() const
+ {
+ return _trustOnlyKeyID;
+ }
+
+ const std::string& proxyHost() const
+ {
+ return _proxyHost;
+ }
+
+ int proxyPort() const
+ {
+ return _proxyPort;
+ }
+
+ void setupStreams(CFReadStreamRef, CFWriteStreamRef, bool, const std::string&) const;
+
+ Instance* clone(const IceInternal::ProtocolInstancePtr&);
+
+private:
+
+ const bool _voip;
+ const Ice::CommunicatorPtr _communicator;
+ CFMutableDictionaryRef _serverSettings;
+ CFMutableDictionaryRef _clientSettings;
+ CFMutableDictionaryRef _proxySettings;
+ CFArrayRef _certificateAuthorities;
+ CFDataRef _trustOnlyKeyID;
+
+ std::string _proxyHost;
+ int _proxyPort;
+};
+typedef IceUtil::Handle<Instance> InstancePtr;
+
+class StreamAcceptor;
+typedef IceUtil::Handle<StreamAcceptor> StreamAcceptorPtr;
+
+class StreamEndpointI;
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+typedef ::std::shared_ptr<StreamEndpointI> StreamEndpointIPtr;
+#else
+typedef IceUtil::Handle<StreamEndpointI> StreamEndpointIPtr;
+#endif
+
+class StreamEndpointI : public IceInternal::IPEndpointI, public IceInternal::WSEndpointDelegate
+{
+public:
+
+ StreamEndpointI(const InstancePtr&, const std::string&, Ice::Int, const IceInternal::Address&, Ice::Int,
+ const std::string&, bool);
+ StreamEndpointI(const InstancePtr&);
+ StreamEndpointI(const InstancePtr&, Ice::InputStream*);
+
+ virtual Ice::EndpointInfoPtr getInfo() const;
+ virtual Ice::EndpointInfoPtr getWSInfo(const std::string&) const;
+
+ virtual Ice::Int timeout() const;
+ virtual IceInternal::EndpointIPtr timeout(Ice::Int) const;
+ virtual bool compress() const;
+ virtual IceInternal::EndpointIPtr compress(bool) const;
+ virtual bool datagram() const;
+ virtual bool secure() const;
+
+ virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const;
+ virtual IceInternal::TransceiverPtr transceiver() const;
+ virtual IceInternal::AcceptorPtr acceptor(const std::string&) const;
+ virtual std::string options() const;
+
+#ifdef ICE_CPP11_MAPPING
+ virtual bool operator==(const Ice::Endpoint&) const;
+ virtual bool operator<(const Ice::Endpoint&) const;
+#else
+ virtual bool operator==(const Ice::LocalObject&) const;
+ virtual bool operator<(const Ice::LocalObject&) const;
+#endif
+
+ StreamEndpointIPtr endpoint(const StreamAcceptorPtr&) const;
+
+ using IPEndpointI::connectionId;
+
+protected:
+
+ virtual void streamWriteImpl(Ice::OutputStream*) const;
+ virtual void hashInit(Ice::Int&) const;
+ virtual void fillEndpointInfo(Ice::IPEndpointInfo*) const;
+ virtual bool checkOption(const std::string&, const std::string&, const std::string&);
+
+ virtual IceInternal::ConnectorPtr createConnector(const IceInternal::Address&,
+ const IceInternal::NetworkProxyPtr&) const;
+ virtual IceInternal::IPEndpointIPtr createEndpoint(const std::string&, int, const std::string&) const;
+
+private:
+
+ const InstancePtr _instance;
+
+ //
+ // All members are const, because endpoints are immutable.
+ //
+ const Ice::Int _timeout;
+ const bool _compress;
+};
+
+class StreamEndpointFactory : public IceInternal::EndpointFactory
+{
+public:
+
+ StreamEndpointFactory(const InstancePtr&);
+
+ virtual ~StreamEndpointFactory();
+
+ virtual Ice::Short type() const;
+ virtual std::string protocol() const;
+ virtual IceInternal::EndpointIPtr create(std::vector<std::string>&, bool) const;
+ virtual IceInternal::EndpointIPtr read(Ice::InputStream*) const;
+ virtual void destroy();
+
+ virtual IceInternal::EndpointFactoryPtr clone(const IceInternal::ProtocolInstancePtr&) const;
+
+private:
+
+ InstancePtr _instance;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/StreamTransceiver.cpp b/cpp/src/Ice/ios/StreamTransceiver.cpp
new file mode 100644
index 00000000000..90e500eed85
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamTransceiver.cpp
@@ -0,0 +1,793 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "StreamTransceiver.h"
+#include "StreamEndpointI.h"
+
+#include <Ice/Properties.h>
+#include <Ice/TraceLevels.h>
+#include <Ice/Connection.h>
+#include <Ice/LoggerUtil.h>
+#include <Ice/Buffer.h>
+#include <Ice/Network.h>
+#include <IceSSL/ConnectionInfo.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+#include <Security/Security.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+namespace
+{
+
+void selectorReadCallback(CFReadStreamRef, CFStreamEventType event, void* info)
+{
+ SelectorReadyCallback* callback = reinterpret_cast<SelectorReadyCallback*>(info);
+ switch(event)
+ {
+ case kCFStreamEventOpenCompleted:
+ callback->readyCallback(static_cast<SocketOperation>(SocketOperationConnect | SocketOperationRead));
+ break;
+ case kCFStreamEventHasBytesAvailable:
+ callback->readyCallback(SocketOperationRead);
+ break;
+ default:
+ callback->readyCallback(SocketOperationRead, -1); // Error
+ break;
+ }
+}
+
+void selectorWriteCallback(CFWriteStreamRef, CFStreamEventType event, void* info)
+{
+ SelectorReadyCallback* callback = reinterpret_cast<SelectorReadyCallback*>(info);
+ switch(event)
+ {
+ case kCFStreamEventOpenCompleted:
+ callback->readyCallback(static_cast<SocketOperation>(SocketOperationConnect | SocketOperationWrite));
+ break;
+ case kCFStreamEventCanAcceptBytes:
+ callback->readyCallback(SocketOperationWrite);
+ break;
+ default:
+ callback->readyCallback(SocketOperationWrite, -1); // Error
+ break;
+ }
+}
+
+}
+
+static inline string
+fromCFString(CFStringRef ref)
+{
+ const char* s = CFStringGetCStringPtr(ref, kCFStringEncodingUTF8);
+ if(s)
+ {
+ return string(s);
+ }
+
+ // Not great, but is good enough for this purpose.
+ char buf[1024];
+ CFStringGetCString(ref, buf, sizeof(buf), kCFStringEncodingUTF8);
+ return string(buf);
+}
+
+IceInternal::NativeInfoPtr
+IceObjC::StreamTransceiver::getNativeInfo()
+{
+ return this;
+}
+
+void
+IceObjC::StreamTransceiver::initStreams(SelectorReadyCallback* callback)
+{
+ CFOptionFlags events;
+ CFStreamClientContext ctx = { 0, callback, 0, 0, 0 };
+ events = kCFStreamEventOpenCompleted | kCFStreamEventCanAcceptBytes | kCFStreamEventErrorOccurred |
+ kCFStreamEventEndEncountered;
+ CFWriteStreamSetClient(_writeStream, events, selectorWriteCallback, &ctx);
+
+ events = kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable | kCFStreamEventErrorOccurred |
+ kCFStreamEventEndEncountered;
+ CFReadStreamSetClient(_readStream, events, selectorReadCallback, &ctx);
+}
+
+SocketOperation
+IceObjC::StreamTransceiver::registerWithRunLoop(SocketOperation op)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ SocketOperation readyOp = SocketOperationNone;
+ if(op & SocketOperationConnect)
+ {
+ if(CFWriteStreamGetStatus(_writeStream) != kCFStreamStatusNotOpen ||
+ CFReadStreamGetStatus(_readStream) != kCFStreamStatusNotOpen)
+ {
+ return SocketOperationConnect;
+ }
+
+ _opening = true;
+
+ CFWriteStreamScheduleWithRunLoop(_writeStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ CFReadStreamScheduleWithRunLoop(_readStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+
+ _writeStreamRegistered = true; // Note: this must be set after the schedule call
+ _readStreamRegistered = true; // Note: this must be set after the schedule call
+
+ CFReadStreamOpen(_readStream);
+ CFWriteStreamOpen(_writeStream);
+ }
+ else
+ {
+ if(op & SocketOperationWrite)
+ {
+ if(CFWriteStreamCanAcceptBytes(_writeStream))
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationWrite);
+ }
+ else if(!_writeStreamRegistered)
+ {
+ CFWriteStreamScheduleWithRunLoop(_writeStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ _writeStreamRegistered = true; // Note: this must be set after the schedule call
+ if(CFWriteStreamCanAcceptBytes(_writeStream))
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationWrite);
+ }
+ }
+ }
+
+ if(op & SocketOperationRead)
+ {
+ if(CFReadStreamHasBytesAvailable(_readStream))
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationRead);
+ }
+ else if(!_readStreamRegistered)
+ {
+ CFReadStreamScheduleWithRunLoop(_readStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ _readStreamRegistered = true; // Note: this must be set after the schedule call
+ if(CFReadStreamHasBytesAvailable(_readStream))
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationRead);
+ }
+ }
+ }
+ }
+ return readyOp;
+}
+
+SocketOperation
+IceObjC::StreamTransceiver::unregisterFromRunLoop(SocketOperation op, bool error)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ _error |= error;
+
+ if(_opening)
+ {
+ // Wait for the stream to be ready for write
+ if(op == SocketOperationWrite)
+ {
+ _writeStreamRegistered = false;
+ }
+
+ //
+ // We don't wait for the stream to be ready for read (even if
+ // it's a client connection) because there's no guarantees that
+ // the server might actually send data right away. If we use
+ // the WebSocket transport, the server actually waits for the
+ // client to write the HTTP upgrade request.
+ //
+ //if(op & SocketOperationRead && (_fd != INVALID_SOCKET || !(op & SocketOperationConnect)))
+ if(op == (SocketOperationRead | SocketOperationConnect))
+ {
+ _readStreamRegistered = false;
+ }
+
+ if(error || (!_readStreamRegistered && !_writeStreamRegistered))
+ {
+ CFWriteStreamUnscheduleFromRunLoop(_writeStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ CFReadStreamUnscheduleFromRunLoop(_readStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ _opening = false;
+ return SocketOperationConnect;
+ }
+ else
+ {
+ return SocketOperationNone;
+ }
+ }
+ else
+ {
+ if(op & SocketOperationWrite && _writeStreamRegistered)
+ {
+ CFWriteStreamUnscheduleFromRunLoop(_writeStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ _writeStreamRegistered = false;
+ }
+
+ if(op & SocketOperationRead && _readStreamRegistered)
+ {
+ CFReadStreamUnscheduleFromRunLoop(_readStream, CFRunLoopGetCurrent(), kCFRunLoopDefaultMode);
+ _readStreamRegistered = false;
+ }
+ }
+ return op;
+}
+
+void
+IceObjC::StreamTransceiver::closeStreams()
+{
+ CFReadStreamSetClient(_readStream, kCFStreamEventNone, 0, 0);
+ CFWriteStreamSetClient(_writeStream, kCFStreamEventNone, 0, 0);
+
+ CFReadStreamClose(_readStream);
+ CFWriteStreamClose(_writeStream);
+}
+
+SocketOperation
+IceObjC::StreamTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_state == StateNeedConnect)
+ {
+ _state = StateConnectPending;
+ return SocketOperationConnect;
+ }
+
+ if(_state <= StateConnectPending)
+ {
+ if(_error)
+ {
+ CFErrorRef err = NULL;
+ if(CFWriteStreamGetStatus(_writeStream) == kCFStreamStatusError)
+ {
+ err = CFWriteStreamCopyError(_writeStream);
+ }
+ else if(CFReadStreamGetStatus(_readStream) == kCFStreamStatusError)
+ {
+ err = CFReadStreamCopyError(_readStream);
+ }
+ checkError(err, __FILE__, __LINE__);
+ }
+
+ _state = StateConnected;
+
+ if(_fd == INVALID_SOCKET)
+ {
+ if(!CFReadStreamSetProperty(_readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse) ||
+ !CFWriteStreamSetProperty(_writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse))
+ {
+ throw Ice::SocketException(__FILE__, __LINE__, 0);
+ }
+
+ CFDataRef d = (CFDataRef)CFReadStreamCopyProperty(_readStream, kCFStreamPropertySocketNativeHandle);
+ CFDataGetBytes(d, CFRangeMake(0, sizeof(SOCKET)), reinterpret_cast<UInt8*>(&_fd));
+ CFRelease(d);
+ }
+
+ ostringstream s;
+ Address localAddr;
+ fdToLocalAddress(_fd, localAddr);
+ s << "local address = " << addrToString(localAddr);
+ string proxyHost = _instance->proxyHost();
+ if(!proxyHost.empty())
+ {
+ s << "\nSOCKS proxy address = " << proxyHost << ":" << _instance->proxyPort();
+ }
+ Address remoteAddr;
+ bool peerConnected = fdToRemoteAddress(_fd, remoteAddr);
+ if(peerConnected)
+ {
+ s << "\nremote address = " << addrToString(remoteAddr);
+ }
+ else
+ {
+ s << "\nremote address = " << _host << ":" << _port;
+ }
+ _desc = s.str();
+
+ setBlock(_fd, false);
+ setTcpBufSize(_fd, _instance);
+
+ //
+ // Limit the size of packets passed to SSLWrite/SSLRead to avoid
+ // blocking and holding too much memory.
+ //
+ _maxSendPacketSize = std::max(512, getSendBufferSize(_fd));
+ _maxRecvPacketSize = std::max(512, getRecvBufferSize(_fd));
+ }
+ assert(_state == StateConnected);
+ return SocketOperationNone;
+}
+
+SocketOperation
+#ifdef ICE_CPP11_MAPPING
+IceObjC::StreamTransceiver::closing(bool initiator, exception_ptr)
+#else
+IceObjC::StreamTransceiver::closing(bool initiator, const Ice::LocalException&)
+#endif
+{
+ // If we are initiating the connection closure, wait for the peer
+ // to close the TCP/IP connection. Otherwise, close immediately.
+ return initiator ? SocketOperationRead : SocketOperationNone;
+}
+
+void
+IceObjC::StreamTransceiver::close()
+{
+ if(_fd != INVALID_SOCKET)
+ {
+ try
+ {
+ closeSocket(_fd);
+ _fd = INVALID_SOCKET;
+ }
+ catch(const SocketException&)
+ {
+ _fd = INVALID_SOCKET;
+ throw;
+ }
+ }
+}
+
+SocketOperation
+IceObjC::StreamTransceiver::write(Buffer& buf)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_error)
+ {
+ assert(CFWriteStreamGetStatus(_writeStream) == kCFStreamStatusError);
+ checkError(CFWriteStreamCopyError(_writeStream), __FILE__, __LINE__);
+ }
+
+ // Its impossible for the packetSize to be more than an Int.
+ size_t packetSize = std::min(static_cast<size_t>(buf.b.end() - buf.i), _maxSendPacketSize);
+ while(buf.i != buf.b.end())
+ {
+ if(!CFWriteStreamCanAcceptBytes(_writeStream))
+ {
+ return SocketOperationWrite;
+ }
+
+ if(_checkCertificates)
+ {
+ _checkCertificates = false;
+ checkCertificates();
+ }
+
+ assert(_fd != INVALID_SOCKET);
+ CFIndex ret = CFWriteStreamWrite(_writeStream, reinterpret_cast<const UInt8*>(&*buf.i), packetSize);
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(CFWriteStreamGetStatus(_writeStream) == kCFStreamStatusAtEnd)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ assert(CFWriteStreamGetStatus(_writeStream) == kCFStreamStatusError);
+ checkError(CFWriteStreamCopyError(_writeStream), __FILE__, __LINE__);
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ }
+ continue;
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
+ }
+ }
+ return SocketOperationNone;
+}
+
+SocketOperation
+IceObjC::StreamTransceiver::read(Buffer& buf)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_error)
+ {
+ assert(CFReadStreamGetStatus(_readStream) == kCFStreamStatusError);
+ checkError(CFReadStreamCopyError(_readStream), __FILE__, __LINE__);
+ }
+
+ // Its impossible for the packetSize to be more than an Int.
+ size_t packetSize = std::min(static_cast<size_t>(buf.b.end() - buf.i), _maxRecvPacketSize);
+ while(buf.i != buf.b.end())
+ {
+ if(!CFReadStreamHasBytesAvailable(_readStream))
+ {
+ return SocketOperationRead;
+ }
+
+ if(_checkCertificates)
+ {
+ _checkCertificates = false;
+ checkCertificates();
+ }
+
+ assert(_fd != INVALID_SOCKET);
+ CFIndex ret = CFReadStreamRead(_readStream, reinterpret_cast<UInt8*>(&*buf.i), packetSize);
+
+ if(ret == 0)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if(CFReadStreamGetStatus(_readStream) == kCFStreamStatusAtEnd)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ assert(CFReadStreamGetStatus(_readStream) == kCFStreamStatusError);
+ checkError(CFReadStreamCopyError(_readStream), __FILE__, __LINE__);
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ }
+ continue;
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
+ }
+ }
+
+ return SocketOperationNone;
+}
+
+string
+IceObjC::StreamTransceiver::protocol() const
+{
+ return _instance->protocol();
+}
+
+string
+IceObjC::StreamTransceiver::toString() const
+{
+ return _desc;
+}
+
+string
+IceObjC::StreamTransceiver::toDetailedString() const
+{
+ return _desc;
+}
+
+Ice::ConnectionInfoPtr
+IceObjC::StreamTransceiver::getInfo() const
+{
+ if(_instance->secure())
+ {
+ IceSSL::ConnectionInfoPtr info = ICE_MAKE_SHARED(IceSSL::ConnectionInfo);
+ fillConnectionInfo(info);
+ info->verified = _state == StateConnected;
+ return info;
+ }
+ else
+ {
+ Ice::TCPConnectionInfoPtr info = ICE_MAKE_SHARED(Ice::TCPConnectionInfo);
+ fillConnectionInfo(info);
+ return info;
+ }
+}
+
+Ice::ConnectionInfoPtr
+IceObjC::StreamTransceiver::getWSInfo(const Ice::HeaderDict& headers) const
+{
+ if(_instance->secure())
+ {
+ IceSSL::WSSConnectionInfoPtr info = ICE_MAKE_SHARED(IceSSL::WSSConnectionInfo);
+ fillConnectionInfo(info);
+ info->verified = _state == StateConnected;
+ info->headers = headers;
+ return info;
+ }
+ else
+ {
+ Ice::WSConnectionInfoPtr info = ICE_MAKE_SHARED(Ice::WSConnectionInfo);
+ fillConnectionInfo(info);
+ info->headers = headers;
+ return info;
+ }
+}
+
+void
+IceObjC::StreamTransceiver::checkSendSize(const Buffer& buf)
+{
+}
+
+void
+IceObjC::StreamTransceiver::setBufferSize(int rcvSize, int sndSize)
+{
+ setTcpBufSize(_fd, rcvSize, sndSize, _instance);
+}
+
+IceObjC::StreamTransceiver::StreamTransceiver(const InstancePtr& instance,
+ CFReadStreamRef readStream,
+ CFWriteStreamRef writeStream,
+ const string& host,
+ Ice::Int port) :
+ StreamNativeInfo(INVALID_SOCKET),
+ _instance(instance),
+ _host(host),
+ _port(port),
+ _readStream(readStream),
+ _writeStream(writeStream),
+ _readStreamRegistered(false),
+ _writeStreamRegistered(false),
+ _opening(false),
+ _checkCertificates(instance->secure()),
+ _error(false),
+ _state(StateNeedConnect)
+{
+ ostringstream s;
+ s << "local address = <not available>";
+ string proxyHost = instance->proxyHost();
+ if(!proxyHost.empty())
+ {
+ s << "\nSOCKS proxy address = " << proxyHost << ":" << instance->proxyPort();
+ }
+ s << "\nremote address = " << host << ":" << port;
+ _desc = s.str();
+}
+
+IceObjC::StreamTransceiver::StreamTransceiver(const InstancePtr& instance,
+ CFReadStreamRef readStream,
+ CFWriteStreamRef writeStream,
+ SOCKET fd) :
+ StreamNativeInfo(fd),
+ _instance(instance),
+ _port(0),
+ _readStream(readStream),
+ _writeStream(writeStream),
+ _readStreamRegistered(false),
+ _writeStreamRegistered(false),
+ _opening(false),
+ _checkCertificates(false),
+ _error(false),
+ _state(StateNeedConnect),
+ _desc(fdToString(fd))
+{
+}
+
+IceObjC::StreamTransceiver::~StreamTransceiver()
+{
+ assert(_fd == INVALID_SOCKET);
+ CFRelease(_readStream);
+ CFRelease(_writeStream);
+}
+
+void
+IceObjC::StreamTransceiver::checkCertificates()
+{
+ SecTrustRef trust = (SecTrustRef)CFWriteStreamCopyProperty(_writeStream, kCFStreamPropertySSLPeerTrust);
+ if(!trust)
+ {
+ throw Ice::SecurityException(__FILE__, __LINE__, "unable to obtain trust object");
+ }
+
+ try
+ {
+ SecPolicyRef policy = 0;
+ if(_host.empty() || _instance->properties()->getPropertyAsIntWithDefault("IceSSL.CheckCertName", 1) == 0)
+ {
+ policy = SecPolicyCreateBasicX509();
+ }
+ else
+ {
+ CFStringRef h = CFStringCreateWithCString(NULL, _host.c_str(), kCFStringEncodingUTF8);
+ policy = SecPolicyCreateSSL(false, h);
+ CFRelease(h);
+ }
+
+ OSStatus err = SecTrustSetPolicies(trust, policy);
+ CFRelease(policy);
+ if(err != noErr)
+ {
+ ostringstream os;
+ os << "unable to set trust object policy (error = " << err << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+
+ //
+ // If IceSSL.CertAuthFile is set, we use the certificate authorities from this file
+ // instead of the ones from the keychain.
+ //
+ if((err = SecTrustSetAnchorCertificates(trust, _instance->certificateAuthorities())) != noErr)
+ {
+ ostringstream os;
+ os << "couldn't set root CA certificates with trust object (error = " << err << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+
+ SecTrustResultType result = kSecTrustResultInvalid;
+ if((err = SecTrustEvaluate(trust, &result)) != noErr)
+ {
+ ostringstream os;
+ os << "unable to evaluate the peer certificate trust (error = " << err << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+
+ //
+ // The kSecTrustResultUnspecified result indicates that the user didn't set any trust
+ // settings for the root CA. This is expected if the root CA is provided by the user
+ // with IceSSL.CertAuthFile or if the user didn't explicitly set any trust settings
+ // for the certificate.
+ //
+ if(result != kSecTrustResultProceed && result != kSecTrustResultUnspecified)
+ {
+ ostringstream os;
+ os << "certificate validation failed (result = " << result << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+
+ if(_instance->trustOnlyKeyID())
+ {
+ if(SecTrustGetCertificateCount(trust) < 0)
+ {
+ throw Ice::SecurityException(__FILE__, __LINE__, "unable to obtain peer certificate");
+ }
+
+ SecCertificateRef cert = SecTrustGetCertificateAtIndex(trust, 0);
+
+ //
+ // To check the subject key ID, we add the peer certificate to the keychain with SetItemAdd,
+ // then we lookup for the cert using the kSecAttrSubjectKeyID. Then we remove the cert from
+ // the keychain. NOTE: according to the Apple documentation, it should in theory be possible
+ // to not add/remove the item to the keychain by specifying the kSecMatchItemList key (or
+ // kSecUseItemList?) when calling SecItemCopyMatching. Unfortunately this doesn't appear to
+ // work. Similarly, it should be possible to get back the attributes of the certificate
+ // once it added by setting kSecReturnAttributes in the add query, again this doesn't seem
+ // to work.
+ //
+ CFMutableDictionaryRef query;
+ query = CFDictionaryCreateMutable(0, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionarySetValue(query, kSecClass, kSecClassCertificate);
+ CFDictionarySetValue(query, kSecValueRef, cert);
+ err = SecItemAdd(query, 0);
+ if(err != noErr && err != errSecDuplicateItem)
+ {
+ CFRelease(query);
+ ostringstream os;
+ os << "unable to add peer certificate to keychain (error = " << err << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+ CFRelease(query);
+
+ query = CFDictionaryCreateMutable(0, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionarySetValue(query, kSecClass, kSecClassCertificate);
+ CFDictionarySetValue(query, kSecValueRef, cert);
+ CFDictionarySetValue(query, kSecAttrSubjectKeyID, _instance->trustOnlyKeyID());
+ err = SecItemCopyMatching(query, 0);
+ OSStatus foundErr = err;
+ CFRelease(query);
+
+ query = CFDictionaryCreateMutable(0, 1, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks);
+ CFDictionarySetValue(query, kSecClass, kSecClassCertificate);
+ CFDictionarySetValue(query, kSecValueRef, cert);
+ err = SecItemDelete(query);
+ if(err != noErr)
+ {
+ CFRelease(query);
+ ostringstream os;
+ os << "unable to remove peer certificate from keychain (error = " << err << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+ CFRelease(query);
+
+ if(foundErr != noErr)
+ {
+ ostringstream os;
+ os << "the certificate subject key ID doesn't match the `IceSSL.TrustOnly.Client' property ";
+ os << "(error = " << foundErr << ")";
+ throw Ice::SecurityException(__FILE__, __LINE__, os.str());
+ }
+ }
+ CFRelease(trust);
+ }
+ catch(...)
+ {
+ if(trust)
+ {
+ CFRelease(trust);
+ }
+ throw;
+ }
+}
+
+void
+IceObjC::StreamTransceiver::checkError(CFErrorRef err, const char* file, int line)
+{
+ assert(err);
+ CFStringRef domain = CFErrorGetDomain(err);
+ if(CFStringCompare(domain, kCFErrorDomainPOSIX, 0) == kCFCompareEqualTo)
+ {
+ errno = CFErrorGetCode(err);
+ CFRelease(err);
+ if(interrupted() || noBuffers())
+ {
+ return;
+ }
+
+ if(connectionLost())
+ {
+ ConnectionLostException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectionRefused())
+ {
+ ConnectionRefusedException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ int error = CFErrorGetCode(err);
+ if(error == kCFHostErrorHostNotFound || error == kCFHostErrorUnknown)
+ {
+ int rs = 0;
+ if(error == kCFHostErrorUnknown)
+ {
+ CFDictionaryRef dict = CFErrorCopyUserInfo(err);
+ CFNumberRef d = (CFNumberRef)CFDictionaryGetValue(dict, kCFGetAddrInfoFailureKey);
+ if(d != 0)
+ {
+ CFNumberGetValue(d, kCFNumberSInt32Type, &rs);
+ }
+ CFRelease(dict);
+ }
+
+ CFRelease(err);
+
+ DNSException ex(file, line);
+ ex.error = rs;
+ ex.host = _host;
+ throw ex;
+ }
+
+ CFNetworkException ex(file, line);
+ ex.domain = fromCFString(domain);
+ ex.error = CFErrorGetCode(err);
+ CFRelease(err);
+ throw ex;
+}
+
+void
+IceObjC::StreamTransceiver::fillConnectionInfo(const Ice::IPConnectionInfoPtr& info) const
+{
+ fdToAddressAndPort(_fd, info->localAddress, info->localPort, info->remoteAddress, info->remotePort);
+ info->rcvSize = getRecvBufferSize(_fd);
+ info->sndSize = getSendBufferSize(_fd);
+}
diff --git a/cpp/src/Ice/ios/StreamTransceiver.h b/cpp/src/Ice/ios/StreamTransceiver.h
new file mode 100644
index 00000000000..088001887e2
--- /dev/null
+++ b/cpp/src/Ice/ios/StreamTransceiver.h
@@ -0,0 +1,102 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_STREAM_TRANSCEIVER_H
+#define ICE_STREAM_TRANSCEIVER_H
+
+#include <Ice/WSTransceiver.h>
+#include <Ice/Network.h>
+#include <Ice/Selector.h>
+
+struct __CFError;
+typedef struct __CFError * CFErrorRef;
+
+struct __CFWriteStream;
+typedef struct __CFWriteStream * CFWriteStreamRef;
+
+struct __CFReadStream;
+typedef struct __CFReadStream * CFReadStreamRef;
+
+namespace IceObjC
+{
+
+class Instance;
+typedef IceUtil::Handle<Instance> InstancePtr;
+
+class StreamTransceiver : public IceInternal::Transceiver, public IceInternal::StreamNativeInfo,
+ public IceInternal::WSTransceiverDelegate
+{
+ enum State
+ {
+ StateNeedConnect,
+ StateConnectPending,
+ StateConnected
+ };
+
+public:
+
+ StreamTransceiver(const InstancePtr&, CFReadStreamRef, CFWriteStreamRef, const std::string&, Ice::Int);
+ StreamTransceiver(const InstancePtr&, CFReadStreamRef, CFWriteStreamRef, SOCKET);
+ virtual ~StreamTransceiver();
+
+ virtual IceInternal::NativeInfoPtr getNativeInfo();
+
+ virtual void initStreams(IceInternal::SelectorReadyCallback*);
+ virtual IceInternal::SocketOperation registerWithRunLoop(IceInternal::SocketOperation);
+ virtual IceInternal::SocketOperation unregisterFromRunLoop(IceInternal::SocketOperation, bool);
+ virtual void closeStreams();
+
+ virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
+#ifdef ICE_CPP11_MAPPING
+ virtual IceInternal::SocketOperation closing(bool initiator, std::exception_ptr);
+#else
+ virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
+#endif
+ virtual void close();
+
+ virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
+ virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
+
+ virtual std::string protocol() const;
+ virtual std::string toString() const;
+ virtual std::string toDetailedString() const;
+ virtual Ice::ConnectionInfoPtr getInfo() const;
+ virtual Ice::ConnectionInfoPtr getWSInfo(const Ice::HeaderDict&) const;
+ virtual void checkSendSize(const IceInternal::Buffer&);
+ virtual void setBufferSize(int, int);
+
+private:
+
+ void checkCertificates();
+ void checkError(CFErrorRef, const char*, int);
+ void fillConnectionInfo(const Ice::IPConnectionInfoPtr&) const;
+
+ const InstancePtr _instance;
+ const std::string _host;
+ const Ice::Int _port;
+ CFReadStreamRef _readStream;
+ CFWriteStreamRef _writeStream;
+ bool _readStreamRegistered;
+ bool _writeStreamRegistered;
+ bool _opening;
+ bool _checkCertificates;
+
+ IceUtil::Mutex _mutex;
+ bool _error;
+
+ State _state;
+ std::string _desc;
+
+ size_t _maxSendPacketSize;
+ size_t _maxRecvPacketSize;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/iAPConnector.h b/cpp/src/Ice/ios/iAPConnector.h
new file mode 100644
index 00000000000..42fe9f9029e
--- /dev/null
+++ b/cpp/src/Ice/ios/iAPConnector.h
@@ -0,0 +1,58 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_TOUCH_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_IAP_CONNECTOR_H
+#define ICE_IAP_CONNECTOR_H
+
+#include <Ice/TransceiverF.h>
+#include <Ice/ProtocolInstanceF.h>
+#include <Ice/TraceLevelsF.h>
+#include <Ice/LoggerF.h>
+#include <Ice/Connector.h>
+
+#import <Foundation/Foundation.h>
+#import <ExternalAccessory/ExternalAccessory.h>
+
+namespace IceObjC
+{
+
+class iAPEndpointI;
+
+class Instance;
+typedef IceUtil::Handle<Instance> InstancePtr;
+
+class iAPConnector : public IceInternal::Connector
+{
+public:
+
+ virtual IceInternal::TransceiverPtr connect();
+
+ virtual Ice::Short type() const;
+ virtual std::string toString() const;
+
+ virtual bool operator==(const IceInternal::Connector&) const;
+ virtual bool operator!=(const IceInternal::Connector&) const;
+ virtual bool operator<(const IceInternal::Connector&) const;
+
+private:
+
+ iAPConnector(const IceInternal::ProtocolInstancePtr&, Ice::Int, const std::string&, NSString*, EAAccessory*);
+ virtual ~iAPConnector();
+ friend class iAPEndpointI;
+
+ const IceInternal::ProtocolInstancePtr _instance;
+ const Ice::Int _timeout;
+ const std::string _connectionId;
+ NSString* _protocol;
+ EAAccessory* _accessory;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/iAPConnector.mm b/cpp/src/Ice/ios/iAPConnector.mm
new file mode 100644
index 00000000000..37b2b7fc2dc
--- /dev/null
+++ b/cpp/src/Ice/ios/iAPConnector.mm
@@ -0,0 +1,153 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_TOUCH_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "iAPTransceiver.h"
+#include "iAPEndpointI.h"
+#include "iAPConnector.h"
+
+#include <Ice/ProtocolInstance.h>
+#include <Ice/Exception.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+TransceiverPtr
+IceObjC::iAPConnector::connect()
+{
+ EASession* session = [[EASession alloc] initWithAccessory:_accessory forProtocol:_protocol];
+ if(!session)
+ {
+ throw Ice::ConnectFailedException(__FILE__, __LINE__, 0);
+ }
+ return new iAPTransceiver(_instance, session);
+}
+
+Short
+IceObjC::iAPConnector::type() const
+{
+ return _instance->type();
+}
+
+string
+IceObjC::iAPConnector::toString() const
+{
+ ostringstream os;
+ os << [_accessory.name UTF8String];
+ os << " model `" << [_accessory.modelNumber UTF8String] << "'";
+ os << " made by `" << [_accessory.manufacturer UTF8String] << "'";
+ os << " protocol `" << [_protocol UTF8String] << "'";
+ return os.str();
+}
+
+bool
+IceObjC::iAPConnector::operator==(const IceInternal::Connector& r) const
+{
+ const iAPConnector* p = dynamic_cast<const iAPConnector*>(&r);
+ if(!p)
+ {
+ return false;
+ }
+
+ if(_timeout != p->_timeout)
+ {
+ return false;
+ }
+
+ if(_connectionId != p->_connectionId)
+ {
+ return false;
+ }
+
+ if(![_accessory isEqual:p->_accessory])
+ {
+ return false;
+ }
+
+ if(![_protocol isEqual:p->_protocol])
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+IceObjC::iAPConnector::operator!=(const IceInternal::Connector& r) const
+{
+ return !operator==(r);
+}
+
+bool
+IceObjC::iAPConnector::operator<(const IceInternal::Connector& r) const
+{
+ const iAPConnector* p = dynamic_cast<const iAPConnector*>(&r);
+ if(!p)
+ {
+ return type() < r.type();
+ }
+
+ if(_timeout < p->_timeout)
+ {
+ return true;
+ }
+ else if(p->_timeout < _timeout)
+ {
+ return false;
+ }
+
+ if(_connectionId < p->_connectionId)
+ {
+ return true;
+ }
+ else if(p->_connectionId < _connectionId)
+ {
+ return false;
+ }
+
+ if([_accessory hash] < [p->_accessory hash])
+ {
+ return true;
+ }
+ else if([p->_accessory hash] < [_accessory hash])
+ {
+ return false;
+ }
+
+ NSInteger order = [_protocol compare:p->_protocol];
+ if(order == NSOrderedAscending)
+ {
+ return true;
+ }
+ else if(order == NSOrderedDescending)
+ {
+ return false;
+ }
+
+ return false;
+}
+
+IceObjC::iAPConnector::iAPConnector(const ProtocolInstancePtr& instance,
+ Ice::Int timeout,
+ const string& connectionId,
+ NSString* protocol,
+ EAAccessory* accessory) :
+ _instance(instance),
+ _timeout(timeout),
+ _connectionId(connectionId),
+ _protocol([protocol retain]),
+ _accessory([accessory retain])
+{
+}
+
+IceObjC::iAPConnector::~iAPConnector()
+{
+ [_protocol release];
+ [_accessory release];
+}
diff --git a/cpp/src/Ice/ios/iAPEndpointI.h b/cpp/src/Ice/ios/iAPEndpointI.h
new file mode 100644
index 00000000000..242574d0edb
--- /dev/null
+++ b/cpp/src/Ice/ios/iAPEndpointI.h
@@ -0,0 +1,109 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_TOUCH_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_IAP_ENDPOINT_I_H
+#define ICE_IAP_ENDPOINT_I_H
+
+#include <Ice/ProtocolInstanceF.h>
+#include <Ice/EndpointI.h>
+#include <Ice/EndpointFactory.h>
+
+namespace IceObjC
+{
+
+class iAPEndpointI;
+#ifdef ICE_CPP11_MAPPING // C++11 mapping
+typedef ::std::shared_ptr<iAPEndpointI> iAPEndpointIPtr;
+#else
+typedef IceUtil::Handle<iAPEndpointI> iAPEndpointIPtr;
+#endif
+
+class iAPEndpointI : public IceInternal::EndpointI, public Ice::EnableSharedFromThis<iAPEndpointI>
+{
+public:
+
+ iAPEndpointI(const IceInternal::ProtocolInstancePtr&, const std::string&, const std::string&, const std::string&,
+ const std::string&, Ice::Int, const std::string&, bool);
+ iAPEndpointI(const IceInternal::ProtocolInstancePtr&);
+ iAPEndpointI(const IceInternal::ProtocolInstancePtr&, Ice::InputStream*);
+
+ virtual void streamWrite(Ice::OutputStream*) const;
+
+ virtual Ice::EndpointInfoPtr getInfo() const;
+ virtual Ice::Short type() const;
+ virtual const std::string& protocol() const;
+ virtual bool datagram() const;
+ virtual bool secure() const;
+
+ virtual Ice::Int timeout() const;
+ virtual IceInternal::EndpointIPtr timeout(Ice::Int) const;
+ virtual const std::string& connectionId() const;
+ virtual IceInternal::EndpointIPtr connectionId(const std::string&) const;
+ virtual bool compress() const;
+ virtual IceInternal::EndpointIPtr compress(bool) const;
+
+ virtual IceInternal::TransceiverPtr transceiver() const;
+ virtual void connectors_async(Ice::EndpointSelectionType, const IceInternal::EndpointI_connectorsPtr&) const;
+ virtual IceInternal::AcceptorPtr acceptor(const std::string&) const;
+
+ virtual std::vector<IceInternal::EndpointIPtr> expand() const;
+ virtual bool equivalent(const IceInternal::EndpointIPtr&) const;
+
+#ifdef ICE_CPP11_MAPPING
+ virtual bool operator==(const Ice::Endpoint&) const;
+ virtual bool operator<(const Ice::Endpoint&) const;
+#else
+ virtual bool operator==(const Ice::LocalObject&) const;
+ virtual bool operator<(const Ice::LocalObject&) const;
+#endif
+
+ virtual std::string options() const;
+ virtual ::Ice::Int hash() const;
+
+private:
+
+ virtual bool checkOption(const std::string&, const std::string&, const std::string&);
+
+ //
+ // All members are const, because endpoints are immutable.
+ //
+ const IceInternal::ProtocolInstancePtr _instance;
+ const std::string _manufacturer;
+ const std::string _modelNumber;
+ const std::string _name;
+ const std::string _protocol;
+ const Ice::Int _timeout;
+ const std::string _connectionId;
+ const bool _compress;
+};
+
+class iAPEndpointFactory : public IceInternal::EndpointFactory
+{
+public:
+
+ iAPEndpointFactory(const IceInternal::ProtocolInstancePtr&);
+
+ virtual ~iAPEndpointFactory();
+
+ virtual Ice::Short type() const;
+ virtual std::string protocol() const;
+ virtual IceInternal::EndpointIPtr create(std::vector<std::string>&, bool) const;
+ virtual IceInternal::EndpointIPtr read(Ice::InputStream*) const;
+ virtual void destroy();
+
+ virtual IceInternal::EndpointFactoryPtr clone(const IceInternal::ProtocolInstancePtr&) const;
+
+private:
+
+ IceInternal::ProtocolInstancePtr _instance;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/iAPEndpointI.mm b/cpp/src/Ice/ios/iAPEndpointI.mm
new file mode 100644
index 00000000000..c6bc8dc66fb
--- /dev/null
+++ b/cpp/src/Ice/ios/iAPEndpointI.mm
@@ -0,0 +1,640 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "iAPEndpointI.h"
+#include "iAPConnector.h"
+
+#include <Ice/Network.h>
+#include <Ice/InputStream.h>
+#include <Ice/OutputStream.h>
+#include <Ice/LocalException.h>
+#include <Ice/ProtocolInstance.h>
+#include <Ice/DefaultsAndOverrides.h>
+#include <Ice/Initialize.h>
+#include <Ice/EndpointFactoryManager.h>
+#include <Ice/Properties.h>
+#include <Ice/HashUtil.h>
+
+#include <CoreFoundation/CoreFoundation.h>
+
+#include <fstream>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+extern "C"
+{
+
+Plugin*
+createIceIAP(const CommunicatorPtr& com, const string&, const StringSeq&)
+{
+ ProtocolInstancePtr instance = new ProtocolInstance(com, iAPEndpointType, "iap", false);
+ return new EndpointFactoryPlugin(com, new IceObjC::iAPEndpointFactory(instance));
+}
+
+}
+
+IceObjC::iAPEndpointI::iAPEndpointI(const ProtocolInstancePtr& instance, const string& m,
+ const string& o, const string& n, const string& p, Int ti,
+ const string& conId, bool co) :
+ _instance(instance),
+ _manufacturer(m),
+ _modelNumber(o),
+ _name(n),
+ _protocol(p),
+ _timeout(ti),
+ _connectionId(conId),
+ _compress(co)
+{
+}
+
+IceObjC::iAPEndpointI::iAPEndpointI(const ProtocolInstancePtr& instance) :
+ _instance(instance),
+ _timeout(-1),
+ _compress(false)
+{
+}
+
+IceObjC::iAPEndpointI::iAPEndpointI(const ProtocolInstancePtr& instance, InputStream* s) :
+ _instance(instance),
+ _timeout(-1),
+ _compress(false)
+{
+ s->read(const_cast<string&>(_manufacturer), false);
+ s->read(const_cast<string&>(_modelNumber), false);
+ s->read(const_cast<string&>(_name), false);
+ s->read(const_cast<Int&>(_timeout));
+ s->read(const_cast<bool&>(_compress));
+}
+
+void
+IceObjC::iAPEndpointI::streamWrite(OutputStream* s) const
+{
+ s->startEncapsulation();
+ s->write(_manufacturer, false);
+ s->write(_modelNumber, false);
+ s->write(_name, false);
+ s->write(_timeout);
+ s->write(_compress);
+ s->endEncapsulation();
+}
+
+EndpointInfoPtr
+IceObjC::iAPEndpointI::getInfo() const
+{
+ return 0;
+}
+
+Short
+IceObjC::iAPEndpointI::type() const
+{
+ return _instance->type();
+}
+
+const string&
+IceObjC::iAPEndpointI::protocol() const
+{
+ return _instance->protocol();
+}
+
+bool
+IceObjC::iAPEndpointI::datagram() const
+{
+ return false;
+}
+
+bool
+IceObjC::iAPEndpointI::secure() const
+{
+ return _instance->secure();
+}
+
+Int
+IceObjC::iAPEndpointI::timeout() const
+{
+ return _timeout;
+}
+
+EndpointIPtr
+IceObjC::iAPEndpointI::timeout(Int t) const
+{
+ if(t == _timeout)
+ {
+ return shared_from_this();
+ }
+ else
+ {
+ return ICE_MAKE_SHARED(iAPEndpointI, _instance, _manufacturer, _modelNumber, _name, _protocol, t, _connectionId, _compress);
+ }
+}
+
+const string&
+IceObjC::iAPEndpointI::connectionId() const
+{
+ return _connectionId;
+}
+
+EndpointIPtr
+IceObjC::iAPEndpointI::connectionId(const string& cId) const
+{
+ if(cId == _connectionId)
+ {
+ return shared_from_this();
+ }
+ else
+ {
+ return ICE_MAKE_SHARED(iAPEndpointI, _instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, cId, _compress);
+ }
+}
+
+bool
+IceObjC::iAPEndpointI::compress() const
+{
+ return _compress;
+}
+
+EndpointIPtr
+IceObjC::iAPEndpointI::compress(bool c) const
+{
+ if(c == _compress)
+ {
+ return shared_from_this();
+ }
+ else
+ {
+ return ICE_MAKE_SHARED(iAPEndpointI, _instance, _manufacturer, _modelNumber, _name, _protocol, _timeout, _connectionId, c);
+ }
+}
+
+TransceiverPtr
+IceObjC::iAPEndpointI::transceiver() const
+{
+ return 0;
+}
+
+void
+IceObjC::iAPEndpointI::connectors_async(Ice::EndpointSelectionType selType,
+ const EndpointI_connectorsPtr& callback) const
+{
+ try
+ {
+ vector<ConnectorPtr> c;
+
+ EAAccessoryManager* manager = [EAAccessoryManager sharedAccessoryManager];
+ if(manager == nil)
+ {
+ throw Ice::ConnectFailedException(__FILE__, __LINE__, 0);
+ }
+
+ NSString* protocol = _protocol.empty() ? @"com.zeroc.ice" : [[NSString alloc] initWithUTF8String:_protocol.c_str()];
+ NSArray* array = [manager connectedAccessories];
+ NSEnumerator* enumerator = [array objectEnumerator];
+ EAAccessory* accessory = nil;
+ int lastError = 0;
+ while((accessory = [enumerator nextObject]))
+ {
+ if(!accessory.connected)
+ {
+ lastError = 1;
+ continue;
+ }
+
+ if(!_manufacturer.empty() && _manufacturer != [accessory.manufacturer UTF8String])
+ {
+ lastError = 2;
+ continue;
+ }
+ if(!_modelNumber.empty() && _modelNumber != [accessory.modelNumber UTF8String])
+ {
+ lastError = 3;
+ continue;
+ }
+ if(!_name.empty() && _name != [accessory.name UTF8String])
+ {
+ lastError = 4;
+ continue;
+ }
+
+ if(![accessory.protocolStrings containsObject:protocol])
+ {
+ lastError = 5;
+ continue;
+ }
+
+ c.push_back(new iAPConnector(_instance, _timeout, _connectionId, protocol, accessory));
+ }
+ [protocol release];
+ if(c.empty())
+ {
+ throw Ice::ConnectFailedException(__FILE__, __LINE__, 0);
+ }
+ callback->connectors(c);
+ }
+ catch(const Ice::LocalException& ex)
+ {
+ callback->exception(ex);
+ }
+}
+
+AcceptorPtr
+IceObjC::iAPEndpointI::acceptor(const string&) const
+{
+ assert(false);
+ return 0;
+}
+
+vector<EndpointIPtr>
+IceObjC::iAPEndpointI::expand() const
+{
+ vector<EndpointIPtr> endps;
+ endps.push_back(shared_from_this());
+ return endps;
+}
+
+bool
+IceObjC::iAPEndpointI::equivalent(const EndpointIPtr& endpoint) const
+{
+ const iAPEndpointI* endpointI = dynamic_cast<const iAPEndpointI*>(endpoint.get());
+ if(!endpointI)
+ {
+ return false;
+ }
+ return endpointI->_manufacturer == _manufacturer &&
+ endpointI->_modelNumber == _modelNumber &&
+ endpointI->_name == _name;
+}
+
+bool
+#ifdef ICE_CPP11_MAPPING
+IceObjC::iAPEndpointI::operator==(const Ice::Endpoint& r) const
+#else
+IceObjC::iAPEndpointI::operator==(const Ice::LocalObject& r) const
+#endif
+{
+ const iAPEndpointI* p = dynamic_cast<const iAPEndpointI*>(&r);
+ if(!p)
+ {
+ return false;
+ }
+
+ if(this == p)
+ {
+ return true;
+ }
+
+ if(_manufacturer != p->_manufacturer)
+ {
+ return false;
+ }
+
+ if(_modelNumber != p->_modelNumber)
+ {
+ return false;
+ }
+
+ if(_name != p->_name)
+ {
+ return false;
+ }
+
+ if(_timeout != p->_timeout)
+ {
+ return false;
+ }
+
+ if(_connectionId != p->_connectionId)
+ {
+ return false;
+ }
+
+ if(_compress != p->_compress)
+ {
+ return false;
+ }
+
+ return true;
+}
+
+bool
+#ifdef ICE_CPP11_MAPPING
+IceObjC::iAPEndpointI::operator<(const Ice::Endpoint& r) const
+#else
+IceObjC::iAPEndpointI::operator<(const Ice::LocalObject& r) const
+#endif
+{
+ const iAPEndpointI* p = dynamic_cast<const iAPEndpointI*>(&r);
+ if(!p)
+ {
+ const IceInternal::EndpointI* e = dynamic_cast<const IceInternal::EndpointI*>(&r);
+ if(!e)
+ {
+ return false;
+ }
+ return type() < e->type();
+ }
+
+ if(this == p)
+ {
+ return false;
+ }
+
+ if(_manufacturer < p->_manufacturer)
+ {
+ return true;
+ }
+ else if(p->_manufacturer < _manufacturer)
+ {
+ return false;
+ }
+
+ if(_modelNumber < p->_modelNumber)
+ {
+ return true;
+ }
+ else if(p->_modelNumber < _modelNumber)
+ {
+ return false;
+ }
+
+ if(_name < p->_name)
+ {
+ return true;
+ }
+ else if(p->_name < _name)
+ {
+ return false;
+ }
+
+ if(_timeout < p->_timeout)
+ {
+ return true;
+ }
+ else if(p->_timeout < _timeout)
+ {
+ return false;
+ }
+
+ if(_connectionId < p->_connectionId)
+ {
+ return true;
+ }
+ else if(p->_connectionId < _connectionId)
+ {
+ return false;
+ }
+
+ if(!_compress && p->_compress)
+ {
+ return true;
+ }
+ else if(p->_compress < _compress)
+ {
+ return false;
+ }
+
+ return false;
+}
+
+string
+IceObjC::iAPEndpointI::options() const
+{
+ //
+ // WARNING: Certain features, such as proxy validation in Glacier2,
+ // depend on the format of proxy strings. Changes to toString() and
+ // methods called to generate parts of the reference string could break
+ // these features. Please review for all features that depend on the
+ // format of proxyToString() before changing this and related code.
+ //
+ ostringstream s;
+ if(!_manufacturer.empty())
+ {
+ s << " -m ";
+ bool addQuote = _manufacturer.find(':') != string::npos;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ s << _manufacturer;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ }
+
+ if(!_modelNumber.empty())
+ {
+ s << " -o ";
+ bool addQuote = _modelNumber.find(':') != string::npos;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ s << _modelNumber;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ }
+
+ if(!_name.empty())
+ {
+ s << " -n ";
+ bool addQuote = _name.find(':') != string::npos;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ s << _name;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ }
+
+ if(!_protocol.empty())
+ {
+ s << " -p ";
+ bool addQuote = _protocol.find(':') != string::npos;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ s << _protocol;
+ if(addQuote)
+ {
+ s << "\"";
+ }
+ }
+
+ if(_timeout != -1)
+ {
+ s << " -t " << _timeout;
+ }
+ if(_compress)
+ {
+ s << " -z";
+ }
+ return s.str();
+}
+
+Ice::Int
+IceObjC::iAPEndpointI::hash() const
+{
+ Ice::Int h = 5381;
+ hashAdd(h, _manufacturer);
+ hashAdd(h, _modelNumber);
+ hashAdd(h, _name);
+ hashAdd(h, _timeout);
+ hashAdd(h, _connectionId);
+ return h;
+}
+
+bool
+IceObjC::iAPEndpointI::checkOption(const string& option, const string& argument, const string& endpoint)
+{
+ switch(option[1])
+ {
+ case 'm':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "no argument provided for -h option in endpoint " + endpoint;
+ throw ex;
+ }
+ const_cast<string&>(_manufacturer) = argument;
+ break;
+ }
+
+ case 'o':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "no argument provided for -h option in endpoint " + endpoint;
+ throw ex;
+ }
+ const_cast<string&>(_modelNumber) = argument;
+ break;
+ }
+
+ case 'n':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "no argument provided for -h option in endpoint " + endpoint;
+ throw ex;
+ }
+ const_cast<string&>(_name) = argument;
+ break;
+ }
+
+ case 'p':
+ {
+ if(argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "no argument provided for -h option in endpoint " + endpoint;
+ throw ex;
+ }
+ const_cast<string&>(_protocol) = argument;
+ break;
+ }
+
+ case 't':
+ {
+ if(argument == "infinite")
+ {
+ const_cast<Int&>(_timeout) = -1;
+ }
+ else
+ {
+ istringstream t(argument);
+ if(!(t >> const_cast<Int&>(_timeout)) || !t.eof() || _timeout < 1)
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "invalid timeout value `" + argument + "' in endpoint " + endpoint;
+ throw ex;
+ }
+ }
+ break;
+ }
+
+ case 'z':
+ {
+ if(!argument.empty())
+ {
+ EndpointParseException ex(__FILE__, __LINE__);
+ ex.str = "no argument provided for -h option in endpoint " + endpoint;
+ throw ex;
+ }
+ const_cast<bool&>(_compress) = true;
+ break;
+ }
+
+ default:
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+IceObjC::iAPEndpointFactory::iAPEndpointFactory(const ProtocolInstancePtr& instance) :
+ _instance(instance)
+{
+}
+
+IceObjC::iAPEndpointFactory::~iAPEndpointFactory()
+{
+}
+
+Short
+IceObjC::iAPEndpointFactory::type() const
+{
+ return _instance->type();
+}
+
+string
+IceObjC::iAPEndpointFactory::protocol() const
+{
+ return _instance->protocol();
+}
+
+EndpointIPtr
+IceObjC::iAPEndpointFactory::create(vector<string>& args, bool oaEndpoint) const
+{
+ if(oaEndpoint)
+ {
+ return 0;
+ }
+ EndpointIPtr endpt = ICE_MAKE_SHARED(iAPEndpointI, _instance);
+ endpt->initWithOptions(args);
+ return endpt;
+}
+
+EndpointIPtr
+IceObjC::iAPEndpointFactory::read(InputStream* s) const
+{
+ return ICE_MAKE_SHARED(iAPEndpointI, _instance, s);
+}
+
+void
+IceObjC::iAPEndpointFactory::destroy()
+{
+ _instance = 0;
+}
+
+EndpointFactoryPtr
+IceObjC::iAPEndpointFactory::clone(const ProtocolInstancePtr& instance) const
+{
+ return new iAPEndpointFactory(instance);
+}
diff --git a/cpp/src/Ice/ios/iAPTransceiver.h b/cpp/src/Ice/ios/iAPTransceiver.h
new file mode 100644
index 00000000000..b5e10c80f1e
--- /dev/null
+++ b/cpp/src/Ice/ios/iAPTransceiver.h
@@ -0,0 +1,85 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_TOUCH_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef ICE_IAP_TRANSCEIVER_H
+#define ICE_IAP_TRANSCEIVER_H
+
+#include <Ice/ProtocolInstanceF.h>
+#include <Ice/Transceiver.h>
+#include <Ice/Network.h>
+#include <Ice/Selector.h>
+
+#import <Foundation/Foundation.h>
+#import <ExternalAccessory/ExternalAccessory.h>
+
+@class iAPTransceiverCallback;
+
+namespace IceObjC
+{
+
+class iAPTransceiver : public IceInternal::Transceiver, public IceInternal::StreamNativeInfo
+{
+ enum State
+ {
+ StateNeedConnect,
+ StateConnectPending,
+ StateConnected
+ };
+
+public:
+
+ iAPTransceiver(const IceInternal::ProtocolInstancePtr&, EASession*);
+ virtual ~iAPTransceiver();
+
+ virtual void initStreams(IceInternal::SelectorReadyCallback*);
+ virtual IceInternal::SocketOperation registerWithRunLoop(IceInternal::SocketOperation);
+ virtual IceInternal::SocketOperation unregisterFromRunLoop(IceInternal::SocketOperation, bool);
+ virtual void closeStreams();
+
+ virtual IceInternal::NativeInfoPtr getNativeInfo();
+
+ virtual IceInternal::SocketOperation initialize(IceInternal::Buffer&, IceInternal::Buffer&);
+#ifdef ICE_CPP11_MAPPING
+ virtual IceInternal::SocketOperation closing(bool, std::exception_ptr);
+#else
+ virtual IceInternal::SocketOperation closing(bool, const Ice::LocalException&);
+#endif
+ virtual void close();
+ virtual IceInternal::SocketOperation write(IceInternal::Buffer&);
+ virtual IceInternal::SocketOperation read(IceInternal::Buffer&);
+
+ virtual std::string protocol() const;
+ virtual std::string toString() const;
+ virtual std::string toDetailedString() const;
+ virtual Ice::ConnectionInfoPtr getInfo() const;
+ virtual void checkSendSize(const IceInternal::Buffer&);
+ virtual void setBufferSize(int, int);
+
+private:
+
+ void checkError(NSError*, const char*, int);
+
+ IceInternal::ProtocolInstancePtr _instance;
+ NSInputStream* _readStream;
+ NSOutputStream* _writeStream;
+ iAPTransceiverCallback* _callback;
+ bool _readStreamRegistered;
+ bool _writeStreamRegistered;
+ bool _opening;
+
+ IceUtil::Mutex _mutex;
+ bool _error;
+
+ State _state;
+ std::string _desc;
+};
+
+}
+
+#endif
diff --git a/cpp/src/Ice/ios/iAPTransceiver.mm b/cpp/src/Ice/ios/iAPTransceiver.mm
new file mode 100644
index 00000000000..1e7b989f8e1
--- /dev/null
+++ b/cpp/src/Ice/ios/iAPTransceiver.mm
@@ -0,0 +1,490 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include "iAPTransceiver.h"
+#include "iAPEndpointI.h"
+
+#include <Ice/LocalException.h>
+#include <Ice/ProtocolInstance.h>
+#include <Ice/Buffer.h>
+
+#import <Foundation/NSRunLoop.h>
+#import <Foundation/NSError.h>
+#import <Foundation/NSString.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceInternal;
+
+@interface iAPTransceiverCallback : NSObject<NSStreamDelegate>
+{
+@private
+
+ SelectorReadyCallback* callback;
+}
+-(id) init:(SelectorReadyCallback*)cb;
+@end
+
+@implementation iAPTransceiverCallback
+-(id) init:(SelectorReadyCallback*)cb;
+{
+ if(![super init])
+ {
+ return nil;
+ }
+ callback = cb;
+ return self;
+}
+
+- (void)stream:(NSStream *)stream handleEvent:(NSStreamEvent)eventCode
+{
+ switch(eventCode)
+ {
+ case NSStreamEventHasBytesAvailable:
+ callback->readyCallback(SocketOperationRead);
+ break;
+ case NSStreamEventHasSpaceAvailable:
+ callback->readyCallback(SocketOperationWrite);
+ break;
+ case NSStreamEventOpenCompleted:
+ if([[stream class] isSubclassOfClass:[NSInputStream class]])
+ {
+ callback->readyCallback(static_cast<SocketOperation>(SocketOperationConnect | SocketOperationRead));
+ }
+ else
+ {
+ callback->readyCallback(static_cast<SocketOperation>(SocketOperationConnect | SocketOperationWrite));
+ }
+ break;
+ case NSStreamEventEndEncountered:
+ case NSStreamEventErrorOccurred:
+ if([[stream class] isSubclassOfClass:[NSInputStream class]])
+ {
+ callback->readyCallback(SocketOperationRead, -1); // Error
+ }
+ else
+ {
+ callback->readyCallback(SocketOperationWrite, -1); // Error
+ }
+ }
+}
+@end
+
+void
+IceObjC::iAPTransceiver::initStreams(SelectorReadyCallback* callback)
+{
+ _callback = [[iAPTransceiverCallback alloc] init:callback];
+ [_writeStream setDelegate:_callback];
+ [_readStream setDelegate:_callback];
+}
+
+SocketOperation
+IceObjC::iAPTransceiver::registerWithRunLoop(SocketOperation op)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+
+ SocketOperation readyOp = SocketOperationNone;
+ if(op & SocketOperationConnect)
+ {
+ if([_writeStream streamStatus] != NSStreamStatusNotOpen || [_readStream streamStatus] != NSStreamStatusNotOpen)
+ {
+ return SocketOperationConnect;
+ }
+
+ _opening = true;
+
+ [_writeStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ [_readStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+
+ _writeStreamRegistered = true; // Note: this must be set after the schedule call
+ _readStreamRegistered = true; // Note: this must be set after the schedule call
+
+ [_writeStream open];
+ [_readStream open];
+ }
+ else
+ {
+ if(op & SocketOperationWrite)
+ {
+ if([_writeStream hasSpaceAvailable])
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationWrite);
+ }
+ else if(!_writeStreamRegistered)
+ {
+ [_writeStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ _writeStreamRegistered = true; // Note: this must be set after the schedule call
+ if([_writeStream hasSpaceAvailable])
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationWrite);
+ }
+ }
+ }
+
+ if(op & SocketOperationRead)
+ {
+ if([_readStream hasBytesAvailable])
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationRead);
+ }
+ else if(!_readStreamRegistered)
+ {
+ [_readStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ _readStreamRegistered = true; // Note: this must be set after the schedule call
+ if([_readStream hasBytesAvailable])
+ {
+ readyOp = static_cast<SocketOperation>(readyOp | SocketOperationRead);
+ }
+ }
+ }
+ }
+ return readyOp;
+}
+
+SocketOperation
+IceObjC::iAPTransceiver::unregisterFromRunLoop(SocketOperation op, bool error)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ _error |= error;
+
+ if(_opening)
+ {
+ // Wait for the stream to be ready for write
+ if(op == SocketOperationWrite)
+ {
+ _writeStreamRegistered = false;
+ }
+
+ //
+ // We don't wait for the stream to be ready for read (even if
+ // it's a client connection) because there's no guarantees that
+ // the server might actually send data right away. If we use
+ // the WebSocket transport, the server actually waits for the
+ // client to write the HTTP upgrade request.
+ //
+ //if(op & SocketOperationRead && (_fd != INVALID_SOCKET || !(op & SocketOperationConnect)))
+ if(op == (SocketOperationRead | SocketOperationConnect))
+ {
+ _readStreamRegistered = false;
+ }
+
+ if(error || (!_readStreamRegistered && !_writeStreamRegistered))
+ {
+ [_writeStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ [_readStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ _opening = false;
+ return SocketOperationConnect;
+ }
+ else
+ {
+ return SocketOperationNone;
+ }
+ }
+ else
+ {
+ if(op & SocketOperationWrite && _writeStreamRegistered)
+ {
+ [_writeStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ _writeStreamRegistered = false;
+ }
+
+ if(op & SocketOperationRead && _readStreamRegistered)
+ {
+ [_readStream removeFromRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+ _readStreamRegistered = false;
+ }
+ }
+ return op;
+}
+
+void
+IceObjC::iAPTransceiver::closeStreams()
+{
+ [_writeStream setDelegate:nil];
+ [_readStream setDelegate:nil];
+
+ [_callback release];
+ _callback = 0;
+
+ [_writeStream close];
+ [_readStream close];
+}
+
+IceInternal::NativeInfoPtr
+IceObjC::iAPTransceiver::getNativeInfo()
+{
+ return this;
+}
+
+SocketOperation
+IceObjC::iAPTransceiver::initialize(Buffer& readBuffer, Buffer& writeBuffer)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_state == StateNeedConnect)
+ {
+ _state = StateConnectPending;
+ return SocketOperationConnect;
+ }
+
+ if(_state <= StateConnectPending)
+ {
+ if(_error)
+ {
+ assert([_writeStream streamStatus] == NSStreamStatusError);
+ NSError* err = [_writeStream streamError];
+ NSString* domain = [err domain];
+ if([domain compare:NSPOSIXErrorDomain] == NSOrderedSame)
+ {
+ errno = [err code];
+ [err release];
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ // Otherwise throw a generic exception.
+ CFNetworkException ex(__FILE__, __LINE__);
+ ex.domain = [domain UTF8String];
+ ex.error = [err code];
+ [err release];
+ throw ex;
+ }
+ _state = StateConnected;
+ }
+ assert(_state == StateConnected);
+ return SocketOperationNone;
+}
+
+SocketOperation
+#ifdef ICE_CPP11_MAPPING
+IceObjC::iAPTransceiver::closing(bool initiator, exception_ptr)
+#else
+IceObjC::iAPTransceiver::closing(bool initiator, const Ice::LocalException&)
+#endif
+{
+ // If we are initiating the connection closure, wait for the peer
+ // to close the TCP/IP connection. Otherwise, close immediately.
+ return initiator ? SocketOperationRead : SocketOperationNone;
+}
+
+void
+IceObjC::iAPTransceiver::close()
+{
+}
+
+SocketOperation
+IceObjC::iAPTransceiver::write(Buffer& buf)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_error)
+ {
+ assert([_writeStream streamStatus] == NSStreamStatusError);
+ checkError([_writeStream streamError], __FILE__, __LINE__);
+ }
+
+ // Its impossible for the packetSize to be more than an Int.
+ int packetSize = static_cast<int>(buf.b.end() - buf.i);
+ while(buf.i != buf.b.end())
+ {
+ if(![_writeStream hasSpaceAvailable])
+ {
+ return SocketOperationWrite;
+ }
+ assert([_writeStream streamStatus] >= NSStreamStatusOpen);
+
+ NSInteger ret = [_writeStream write:reinterpret_cast<const UInt8*>(&*buf.i) maxLength:packetSize];
+ if(ret == SOCKET_ERROR)
+ {
+ if([_writeStream streamStatus] == NSStreamStatusAtEnd)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ assert([_writeStream streamStatus] == NSStreamStatusError);
+ checkError([_writeStream streamError], __FILE__, __LINE__);
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ }
+ continue;
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
+ }
+ }
+
+ return SocketOperationNone;
+}
+
+SocketOperation
+IceObjC::iAPTransceiver::read(Buffer& buf)
+{
+ IceUtil::Mutex::Lock sync(_mutex);
+ if(_error)
+ {
+ assert([_readStream streamStatus] == NSStreamStatusError);
+ checkError([_readStream streamError], __FILE__, __LINE__);
+ }
+
+ // Its impossible for the packetSize to be more than an Int.
+ int packetSize = static_cast<int>(buf.b.end() - buf.i);
+ while(buf.i != buf.b.end())
+ {
+ if(![_readStream hasBytesAvailable] && [_readStream streamStatus] != NSStreamStatusError)
+ {
+ return SocketOperationRead;
+ }
+ assert([_readStream streamStatus] >= NSStreamStatusOpen);
+
+ NSInteger ret = [_readStream read:reinterpret_cast<UInt8*>(&*buf.i) maxLength:packetSize];
+ if(ret == 0)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = 0;
+ throw ex;
+ }
+
+ if(ret == SOCKET_ERROR)
+ {
+ if([_readStream streamStatus] == NSStreamStatusAtEnd)
+ {
+ ConnectionLostException ex(__FILE__, __LINE__);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+
+ assert([_readStream streamStatus] == NSStreamStatusError);
+ checkError([_readStream streamError], __FILE__, __LINE__);
+ if(noBuffers() && packetSize > 1024)
+ {
+ packetSize /= 2;
+ }
+ continue;
+ }
+
+ buf.i += ret;
+
+ if(packetSize > buf.b.end() - buf.i)
+ {
+ packetSize = static_cast<int>(buf.b.end() - buf.i);
+ }
+ }
+
+ return SocketOperationNone;
+}
+
+string
+IceObjC::iAPTransceiver::protocol() const
+{
+ return _instance->protocol();
+}
+
+string
+IceObjC::iAPTransceiver::toString() const
+{
+ return _desc;
+}
+
+string
+IceObjC::iAPTransceiver::toDetailedString() const
+{
+ return toString();
+}
+
+Ice::ConnectionInfoPtr
+IceObjC::iAPTransceiver::getInfo() const
+{
+ return 0;
+}
+
+void
+IceObjC::iAPTransceiver::checkSendSize(const Buffer& buf)
+{
+}
+
+void
+IceObjC::iAPTransceiver::setBufferSize(int, int)
+{
+}
+
+IceObjC::iAPTransceiver::iAPTransceiver(const ProtocolInstancePtr& instance, EASession* session) :
+ StreamNativeInfo(INVALID_SOCKET),
+ _instance(instance),
+ _readStream([[session inputStream] retain]),
+ _writeStream([[session outputStream] retain]),
+ _readStreamRegistered(false),
+ _writeStreamRegistered(false),
+ _error(false),
+ _state(StateNeedConnect)
+{
+ _desc = string("name = ") + [session.accessory.name UTF8String];
+}
+
+IceObjC::iAPTransceiver::~iAPTransceiver()
+{
+ [_readStream release];
+ [_writeStream release];
+}
+
+void
+IceObjC::iAPTransceiver::checkError(NSError* err, const char* file, int line)
+{
+ NSString* domain = [err domain];
+ if([domain compare:NSPOSIXErrorDomain] == NSOrderedSame)
+ {
+ errno = [err code];
+ [err release];
+ if(connectionRefused())
+ {
+ ConnectionRefusedException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else if(connectFailed())
+ {
+ ConnectFailedException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ else
+ {
+ SocketException ex(file, line);
+ ex.error = getSocketErrno();
+ throw ex;
+ }
+ }
+
+ // Otherwise throw a generic exception.
+ CFNetworkException ex(file, line);
+ ex.domain = [domain UTF8String];
+ ex.error = [err code];
+ [err release];
+ throw ex;
+}
diff --git a/cpp/src/IceBT/Makefile.mk b/cpp/src/IceBT/Makefile.mk
index d56d94486a7..20b06076caa 100644
--- a/cpp/src/IceBT/Makefile.mk
+++ b/cpp/src/IceBT/Makefile.mk
@@ -13,8 +13,8 @@ $(project)_libraries := IceBT
IceBT_targetdir := $(libdir)
IceBT_dependencies := IceXML Ice
-IceBT_cppflags := -DICEBT_API_EXPORTS `pkg-config --cflags dbus-1`
-IceBT_system_libs := $(SSL_OS_LIBS) `pkg-config --libs dbus-1`
+IceBT_cppflags := -DICEBT_API_EXPORTS $(shell pkg-config --cflags dbus-1)
+IceBT_system_libs = $(IceSSL_system_libs) $(shell pkg-config --libs dbus-1)
IceBT_sliceflags := --include-dir IceBT --dll-export ICESSL_API
projects += $(project)
diff --git a/cpp/src/IceSSL/Makefile.mk b/cpp/src/IceSSL/Makefile.mk
index d9616562624..69c0af65de7 100644
--- a/cpp/src/IceSSL/Makefile.mk
+++ b/cpp/src/IceSSL/Makefile.mk
@@ -12,7 +12,9 @@ $(project)_libraries := IceSSL
IceSSL_targetdir := $(libdir)
IceSSL_dependencies := Ice
IceSSL_cppflags := -DICESSL_API_EXPORTS
-IceSSL_system_libs := $(SSL_OS_LIBS)
IceSSL_sliceflags := --include-dir IceSSL --dll-export ICESSL_API
+IceSSL[iphoneos]_excludes := $(wildcard $(addprefix $(currentdir)/,*.cpp))
+IceSSL[iphonesimulator]_excludes = $(IceSSL[iphoneos]_excludes)
+
projects += $(project)
diff --git a/cpp/src/IceUtil/Makefile.mk b/cpp/src/IceUtil/Makefile.mk
index 613f66a2cd8..9953c73d8ad 100644
--- a/cpp/src/IceUtil/Makefile.mk
+++ b/cpp/src/IceUtil/Makefile.mk
@@ -10,13 +10,9 @@
$(project)_libraries = IceUtil
IceUtil_targetdir := $(libdir)
-IceUtil_system_libs := $(ICEUTIL_OS_LIBS)
+IceUtil_cppflags := $(if $(filter yes,$(libbacktrace)),-DICE_LIBBACKTRACE)
# Always enable the static configuration for the IceUtil library
IceUtil_always_enable_configs := static
-ifeq ($(libbacktrace),yes)
- IceUtil_cppflags += -DICE_LIBBACKTRACE
-endif
-
projects += $(project)
diff --git a/cpp/test/Common/Makefile.mk b/cpp/test/Common/Makefile.mk
index 6403a45309a..3afc960f5ba 100644
--- a/cpp/test/Common/Makefile.mk
+++ b/cpp/test/Common/Makefile.mk
@@ -10,7 +10,11 @@
$(project)_libraries = TestCommon
$(project)_noinstall := 1
-TestCommon_targetdir := lib
+#
+# Put the shared TestCommon library in the lib directory for convenience on platforms
+# which don't support something like @loader_path.
+#
+TestCommon[shared]_targetdir := lib
TestCommon_dependencies := Ice
TestCommon_sliceflags := --dll-export TEST_API
TestCommon_cppflags := -DTEST_API_EXPORTS -I$(includedir) -I$(project) -Itest/include
diff --git a/cpp/test/ios/BundleInfo.plist b/cpp/test/ios/BundleInfo.plist
new file mode 100644
index 00000000000..eefb65fecea
--- /dev/null
+++ b/cpp/test/ios/BundleInfo.plist
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>BuildMachineOSBuild</key>
+ <string>12C60</string>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>NAME.dylib</string>
+ <key>CFBundleIdentifier</key>
+ <string>com.zeroc.NAME</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>NAME</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>CFPlugInDynamicRegisterFunction</key>
+ <string></string>
+ <key>CFPlugInDynamicRegistration</key>
+ <string>NO</string>
+ <key>CFPlugInUnloadFunction</key>
+ <string></string>
+ <key>DTCompiler</key>
+ <string></string>
+ <key>DTPlatformBuild</key>
+ <string>4H127</string>
+ <key>DTPlatformVersion</key>
+ <string>GM</string>
+ <key>DTSDKBuild</key>
+ <string>12C37</string>
+ <key>DTSDKName</key>
+ <string>macosx10.8</string>
+ <key>DTXcode</key>
+ <string>0460</string>
+ <key>DTXcodeBuild</key>
+ <string>4H127</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2013 ZeroC. All rights reserved.</string>
+</dict>
+</plist>
diff --git a/cpp/test/ios/C++ Test Suite.xcodeproj/project.pbxproj b/cpp/test/ios/C++ Test Suite.xcodeproj/project.pbxproj
new file mode 100755
index 00000000000..497f4f097c9
--- /dev/null
+++ b/cpp/test/ios/C++ Test Suite.xcodeproj/project.pbxproj
@@ -0,0 +1,743 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 47;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 14103B101CFC5E0E0097DE5A /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
+ 14103B111CFC5E0E0097DE5A /* TestSelect.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34B7662B0E8D55FE00CE4701 /* TestSelect.xib */; };
+ 14103B121CFC5E0E0097DE5A /* server.p12 in Resources */ = {isa = PBXBuildFile; fileRef = 342EBA880E926E9F000051FA /* server.p12 */; };
+ 14103B131CFC5E0E0097DE5A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8842ED91BFF87E700A8B607 /* Images.xcassets */; };
+ 14103B141CFC5E0E0097DE5A /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D8842EDB1BFF885600A8B607 /* Default-568h@2x.png */; };
+ 14103B151CFC5E0E0097DE5A /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = 1450A10B1ABC5E9C00A71895 /* client.p12 */; };
+ 14103B161CFC5E0E0097DE5A /* cacert.der in Resources */ = {isa = PBXBuildFile; fileRef = 342EBA8A0E926F90000051FA /* cacert.der */; };
+ 14103B171CFC5E0E0097DE5A /* TestSelect-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34730A10122BF6C300D293CC /* TestSelect-iPad.xib */; };
+ 14103B181CFC5E0E0097DE5A /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34C618AE122C035000F60A28 /* MainWindow-iPad.xib */; };
+ 14103B191CFC5E0E0097DE5A /* TestView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82CD7277145795AA008B9128 /* TestView.xib */; };
+ 14103B1A1CFC5E0E0097DE5A /* TestView-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82F883221461D37000FC801E /* TestView-iPad.xib */; };
+ 14103B1C1CFC5E0E0097DE5A /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 820C84641455AC460091443F /* main.m */; };
+ 14103B1D1CFC5E0E0097DE5A /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82601FF314564F5500B09B8F /* AppDelegate.mm */; };
+ 14103B1E1CFC5E0E0097DE5A /* TestViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 827BCF99145778A5003AD3FA /* TestViewController.mm */; };
+ 14103B1F1CFC5E0E0097DE5A /* TestSelectController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8214397917024FDF0016E162 /* TestSelectController.m */; };
+ 14103B201CFC5E0E0097DE5A /* TestUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 821439B61704E6960016E162 /* TestUtil.mm */; };
+ 14103B221CFC5E0E0097DE5A /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 14103B231CFC5E0E0097DE5A /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 14103B241CFC5E0E0097DE5A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344126360FD8E8EA00C8D69C /* Security.framework */; };
+ 14103B251CFC5E0E0097DE5A /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344126370FD8E8EA00C8D69C /* CFNetwork.framework */; };
+ 14103B261CFC5E0E0097DE5A /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34E396620FF1D71400FBACD6 /* CoreGraphics.framework */; };
+ 142B83841B6BA7A600E28347 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
+ 142B83851B6BA7A600E28347 /* TestSelect.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34B7662B0E8D55FE00CE4701 /* TestSelect.xib */; };
+ 142B83871B6BA7A600E28347 /* server.p12 in Resources */ = {isa = PBXBuildFile; fileRef = 342EBA880E926E9F000051FA /* server.p12 */; };
+ 142B83881B6BA7A600E28347 /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = 1450A10B1ABC5E9C00A71895 /* client.p12 */; };
+ 142B83891B6BA7A600E28347 /* cacert.der in Resources */ = {isa = PBXBuildFile; fileRef = 342EBA8A0E926F90000051FA /* cacert.der */; };
+ 142B838A1B6BA7A600E28347 /* TestSelect-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34730A10122BF6C300D293CC /* TestSelect-iPad.xib */; };
+ 142B838B1B6BA7A600E28347 /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34C618AE122C035000F60A28 /* MainWindow-iPad.xib */; };
+ 142B838C1B6BA7A600E28347 /* TestView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82CD7277145795AA008B9128 /* TestView.xib */; };
+ 142B838D1B6BA7A600E28347 /* TestView-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82F883221461D37000FC801E /* TestView-iPad.xib */; };
+ 142B83911B6BA7A600E28347 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 820C84641455AC460091443F /* main.m */; };
+ 142B83921B6BA7A600E28347 /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82601FF314564F5500B09B8F /* AppDelegate.mm */; };
+ 142B83931B6BA7A600E28347 /* TestViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 827BCF99145778A5003AD3FA /* TestViewController.mm */; };
+ 142B83941B6BA7A600E28347 /* TestSelectController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8214397917024FDF0016E162 /* TestSelectController.m */; };
+ 142B83951B6BA7A600E28347 /* TestUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 821439B61704E6960016E162 /* TestUtil.mm */; };
+ 142B83971B6BA7A600E28347 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 142B83981B6BA7A600E28347 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 142B83991B6BA7A600E28347 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344126360FD8E8EA00C8D69C /* Security.framework */; };
+ 142B839A1B6BA7A600E28347 /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344126370FD8E8EA00C8D69C /* CFNetwork.framework */; };
+ 142B839B1B6BA7A600E28347 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34E396620FF1D71400FBACD6 /* CoreGraphics.framework */; };
+ 144B48261A78F71F00C0E06B /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; };
+ 144B48271A78F71F00C0E06B /* TestSelect.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34B7662B0E8D55FE00CE4701 /* TestSelect.xib */; };
+ 144B482A1A78F71F00C0E06B /* server.p12 in Resources */ = {isa = PBXBuildFile; fileRef = 342EBA880E926E9F000051FA /* server.p12 */; };
+ 144B482B1A78F71F00C0E06B /* cacert.der in Resources */ = {isa = PBXBuildFile; fileRef = 342EBA8A0E926F90000051FA /* cacert.der */; };
+ 144B482C1A78F71F00C0E06B /* TestSelect-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34730A10122BF6C300D293CC /* TestSelect-iPad.xib */; };
+ 144B482D1A78F71F00C0E06B /* MainWindow-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34C618AE122C035000F60A28 /* MainWindow-iPad.xib */; };
+ 144B482E1A78F71F00C0E06B /* TestView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82CD7277145795AA008B9128 /* TestView.xib */; };
+ 144B482F1A78F71F00C0E06B /* TestView-iPad.xib in Resources */ = {isa = PBXBuildFile; fileRef = 82F883221461D37000FC801E /* TestView-iPad.xib */; };
+ 144B48331A78F71F00C0E06B /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 820C84641455AC460091443F /* main.m */; };
+ 144B48341A78F71F00C0E06B /* AppDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 82601FF314564F5500B09B8F /* AppDelegate.mm */; };
+ 144B48351A78F71F00C0E06B /* TestViewController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 827BCF99145778A5003AD3FA /* TestViewController.mm */; };
+ 144B48361A78F71F00C0E06B /* TestSelectController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8214397917024FDF0016E162 /* TestSelectController.m */; };
+ 144B48371A78F71F00C0E06B /* TestUtil.mm in Sources */ = {isa = PBXBuildFile; fileRef = 821439B61704E6960016E162 /* TestUtil.mm */; };
+ 144B48391A78F71F00C0E06B /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
+ 144B483A1A78F71F00C0E06B /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; };
+ 144B483B1A78F71F00C0E06B /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344126360FD8E8EA00C8D69C /* Security.framework */; };
+ 144B483C1A78F71F00C0E06B /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 344126370FD8E8EA00C8D69C /* CFNetwork.framework */; };
+ 144B483D1A78F71F00C0E06B /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34E396620FF1D71400FBACD6 /* CoreGraphics.framework */; };
+ 1450A10C1ABC5E9C00A71895 /* client.p12 in Resources */ = {isa = PBXBuildFile; fileRef = 1450A10B1ABC5E9C00A71895 /* client.p12 */; };
+ D837179F1BFFC25C005D65BC /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8842ED91BFF87E700A8B607 /* Images.xcassets */; };
+ D8842EDA1BFF87E700A8B607 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = D8842ED91BFF87E700A8B607 /* Images.xcassets */; };
+ D8842EDC1BFF885600A8B607 /* Default-568h@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = D8842EDB1BFF885600A8B607 /* Default-568h@2x.png */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 14103B2B1CFC5E0E0097DE5A /* C++11 Test Suite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "C++11 Test Suite.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 14103B2C1CFC5E0E0097DE5A /* C++11 Test Suite.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "C++11 Test Suite.plist"; path = "/Users/benoit/Devel/GitHub/ice/cpp/test/ios/C++11 Test Suite.plist"; sourceTree = "<absolute>"; };
+ 142B83A01B6BA7A600E28347 /* C++ Test Suite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "C++ Test Suite.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 144B48931A78F71F00C0E06B /* C++ Test Suite.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "C++ Test Suite.app"; sourceTree = BUILT_PRODUCTS_DIR; };
+ 1450A10B1ABC5E9C00A71895 /* client.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; name = client.p12; path = ../../../../ice/certs/client.p12; sourceTree = "<group>"; };
+ 1477FACD1A652B7E00BC2890 /* C++98 Test Suite-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "C++98 Test Suite-Info.plist"; sourceTree = "<group>"; };
+ 148668D31B6BAFD300234C12 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = "<group>"; };
+ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
+ 342EBA880E926E9F000051FA /* server.p12 */ = {isa = PBXFileReference; lastKnownFileType = file; name = server.p12; path = ../../../certs/server.p12; sourceTree = SOURCE_ROOT; };
+ 342EBA8A0E926F90000051FA /* cacert.der */ = {isa = PBXFileReference; lastKnownFileType = file; name = cacert.der; path = ../../../certs/cacert.der; sourceTree = SOURCE_ROOT; };
+ 344126360FD8E8EA00C8D69C /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
+ 344126370FD8E8EA00C8D69C /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; };
+ 34730A10122BF6C300D293CC /* TestSelect-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "TestSelect-iPad.xib"; sourceTree = "<group>"; };
+ 34885BE11227F66E0060DE41 /* ExternalAccessory.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ExternalAccessory.framework; path = System/Library/Frameworks/ExternalAccessory.framework; sourceTree = SDKROOT; };
+ 34B7662B0E8D55FE00CE4701 /* TestSelect.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = TestSelect.xib; sourceTree = "<group>"; };
+ 34C618AE122C035000F60A28 /* MainWindow-iPad.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = "MainWindow-iPad.xib"; sourceTree = "<group>"; };
+ 34E396620FF1D71400FBACD6 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
+ 820C84641455AC460091443F /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 8214397917024FDF0016E162 /* TestSelectController.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; path = TestSelectController.m; sourceTree = "<group>"; };
+ 821439B51704E6950016E162 /* TestUtil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestUtil.h; sourceTree = "<group>"; };
+ 821439B61704E6960016E162 /* TestUtil.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestUtil.mm; sourceTree = "<group>"; };
+ 82601FE71456320100B09B8F /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 82601FEA14563AFE00B09B8F /* TestSelectController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestSelectController.h; sourceTree = "<group>"; };
+ 82601FEC14563AFF00B09B8F /* TestViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestViewController.h; sourceTree = "<group>"; };
+ 82601FF314564F5500B09B8F /* AppDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
+ 827BCF99145778A5003AD3FA /* TestViewController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TestViewController.mm; sourceTree = "<group>"; };
+ 82CD7277145795AA008B9128 /* TestView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = TestView.xib; sourceTree = "<group>"; };
+ 82F883221461D37000FC801E /* TestView-iPad.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "TestView-iPad.xib"; sourceTree = "<group>"; };
+ D8842ED91BFF87E700A8B607 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = "<group>"; };
+ D8842EDB1BFF885600A8B607 /* Default-568h@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-568h@2x.png"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 14103B211CFC5E0E0097DE5A /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 14103B221CFC5E0E0097DE5A /* Foundation.framework in Frameworks */,
+ 14103B231CFC5E0E0097DE5A /* UIKit.framework in Frameworks */,
+ 14103B241CFC5E0E0097DE5A /* Security.framework in Frameworks */,
+ 14103B251CFC5E0E0097DE5A /* CFNetwork.framework in Frameworks */,
+ 14103B261CFC5E0E0097DE5A /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 142B83961B6BA7A600E28347 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 142B83971B6BA7A600E28347 /* Foundation.framework in Frameworks */,
+ 142B83981B6BA7A600E28347 /* UIKit.framework in Frameworks */,
+ 142B83991B6BA7A600E28347 /* Security.framework in Frameworks */,
+ 142B839A1B6BA7A600E28347 /* CFNetwork.framework in Frameworks */,
+ 142B839B1B6BA7A600E28347 /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 144B48381A78F71F00C0E06B /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 144B48391A78F71F00C0E06B /* Foundation.framework in Frameworks */,
+ 144B483A1A78F71F00C0E06B /* UIKit.framework in Frameworks */,
+ 144B483B1A78F71F00C0E06B /* Security.framework in Frameworks */,
+ 144B483C1A78F71F00C0E06B /* CFNetwork.framework in Frameworks */,
+ 144B483D1A78F71F00C0E06B /* CoreGraphics.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 080E96DDFE201D6D7F000001 /* Classes */ = {
+ isa = PBXGroup;
+ children = (
+ 821439B51704E6950016E162 /* TestUtil.h */,
+ 821439B61704E6960016E162 /* TestUtil.mm */,
+ 8214397917024FDF0016E162 /* TestSelectController.m */,
+ 827BCF99145778A5003AD3FA /* TestViewController.mm */,
+ 82601FF314564F5500B09B8F /* AppDelegate.mm */,
+ 82601FEA14563AFE00B09B8F /* TestSelectController.h */,
+ 82601FEC14563AFF00B09B8F /* TestViewController.h */,
+ 82601FE71456320100B09B8F /* AppDelegate.h */,
+ );
+ path = Classes;
+ sourceTree = "<group>";
+ };
+ 19C28FACFE9D520D11CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 144B48931A78F71F00C0E06B /* C++ Test Suite.app */,
+ 142B83A01B6BA7A600E28347 /* C++ Test Suite.app */,
+ 14103B2B1CFC5E0E0097DE5A /* C++11 Test Suite.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = {
+ isa = PBXGroup;
+ children = (
+ 148668D31B6BAFD300234C12 /* README.md */,
+ 080E96DDFE201D6D7F000001 /* Classes */,
+ 29B97315FDCFA39411CA2CEA /* Other Sources */,
+ 29B97317FDCFA39411CA2CEA /* Resources */,
+ 34730A09122BF68100D293CC /* Resources-iPad */,
+ 29B97323FDCFA39411CA2CEA /* Frameworks */,
+ 19C28FACFE9D520D11CA2CBB /* Products */,
+ 1477FACD1A652B7E00BC2890 /* C++98 Test Suite-Info.plist */,
+ 14103B2C1CFC5E0E0097DE5A /* C++11 Test Suite.plist */,
+ );
+ name = CustomTemplate;
+ sourceTree = "<group>";
+ };
+ 29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+ isa = PBXGroup;
+ children = (
+ 820C84641455AC460091443F /* main.m */,
+ );
+ name = "Other Sources";
+ sourceTree = "<group>";
+ };
+ 29B97317FDCFA39411CA2CEA /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 342EBA8A0E926F90000051FA /* cacert.der */,
+ 1450A10B1ABC5E9C00A71895 /* client.p12 */,
+ D8842EDB1BFF885600A8B607 /* Default-568h@2x.png */,
+ D8842ED91BFF87E700A8B607 /* Images.xcassets */,
+ 28AD733E0D9D9553002E5188 /* MainWindow.xib */,
+ 342EBA880E926E9F000051FA /* server.p12 */,
+ 34B7662B0E8D55FE00CE4701 /* TestSelect.xib */,
+ 82CD7277145795AA008B9128 /* TestView.xib */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 34885BE11227F66E0060DE41 /* ExternalAccessory.framework */,
+ 34E396620FF1D71400FBACD6 /* CoreGraphics.framework */,
+ 344126360FD8E8EA00C8D69C /* Security.framework */,
+ 344126370FD8E8EA00C8D69C /* CFNetwork.framework */,
+ 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */,
+ 1D30AB110D05D00D00671497 /* Foundation.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 34730A09122BF68100D293CC /* Resources-iPad */ = {
+ isa = PBXGroup;
+ children = (
+ 82F883221461D37000FC801E /* TestView-iPad.xib */,
+ 34C618AE122C035000F60A28 /* MainWindow-iPad.xib */,
+ 34730A10122BF6C300D293CC /* TestSelect-iPad.xib */,
+ );
+ name = "Resources-iPad";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 14103B0E1CFC5E0E0097DE5A /* C++11 Test Suite */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 14103B281CFC5E0E0097DE5A /* Build configuration list for PBXNativeTarget "C++11 Test Suite" */;
+ buildPhases = (
+ 14103B0F1CFC5E0E0097DE5A /* Resources */,
+ 14103B1B1CFC5E0E0097DE5A /* Sources */,
+ 14103B211CFC5E0E0097DE5A /* Frameworks */,
+ 14103B271CFC5E0E0097DE5A /* Run Script */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "C++11 Test Suite";
+ productName = container;
+ productReference = 14103B2B1CFC5E0E0097DE5A /* C++11 Test Suite.app */;
+ productType = "com.apple.product-type.application";
+ };
+ 142B83821B6BA7A600E28347 /* C++98 Test Suite iOS 7 */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 142B839D1B6BA7A600E28347 /* Build configuration list for PBXNativeTarget "C++98 Test Suite iOS 7" */;
+ buildPhases = (
+ 142B83831B6BA7A600E28347 /* Resources */,
+ 142B83901B6BA7A600E28347 /* Sources */,
+ 142B83961B6BA7A600E28347 /* Frameworks */,
+ 142B839C1B6BA7A600E28347 /* Run Script */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "C++98 Test Suite iOS 7";
+ productName = container;
+ productReference = 142B83A01B6BA7A600E28347 /* C++ Test Suite.app */;
+ productType = "com.apple.product-type.application";
+ };
+ 144B48241A78F71F00C0E06B /* C++98 Test Suite */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 144B48901A78F71F00C0E06B /* Build configuration list for PBXNativeTarget "C++98 Test Suite" */;
+ buildPhases = (
+ 144B48251A78F71F00C0E06B /* Resources */,
+ 144B48321A78F71F00C0E06B /* Sources */,
+ 144B48381A78F71F00C0E06B /* Frameworks */,
+ 144B488F1A78F71F00C0E06B /* Run Script */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "C++98 Test Suite";
+ productName = container;
+ productReference = 144B48931A78F71F00C0E06B /* C++ Test Suite.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 29B97313FDCFA39411CA2CEA /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0710;
+ };
+ buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "C++ Test Suite" */;
+ compatibilityVersion = "Xcode 6.3";
+ developmentRegion = English;
+ hasScannedForEncodings = 1;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 144B48241A78F71F00C0E06B /* C++98 Test Suite */,
+ 142B83821B6BA7A600E28347 /* C++98 Test Suite iOS 7 */,
+ 14103B0E1CFC5E0E0097DE5A /* C++11 Test Suite */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 14103B0F1CFC5E0E0097DE5A /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 14103B101CFC5E0E0097DE5A /* MainWindow.xib in Resources */,
+ 14103B111CFC5E0E0097DE5A /* TestSelect.xib in Resources */,
+ 14103B121CFC5E0E0097DE5A /* server.p12 in Resources */,
+ 14103B131CFC5E0E0097DE5A /* Images.xcassets in Resources */,
+ 14103B141CFC5E0E0097DE5A /* Default-568h@2x.png in Resources */,
+ 14103B151CFC5E0E0097DE5A /* client.p12 in Resources */,
+ 14103B161CFC5E0E0097DE5A /* cacert.der in Resources */,
+ 14103B171CFC5E0E0097DE5A /* TestSelect-iPad.xib in Resources */,
+ 14103B181CFC5E0E0097DE5A /* MainWindow-iPad.xib in Resources */,
+ 14103B191CFC5E0E0097DE5A /* TestView.xib in Resources */,
+ 14103B1A1CFC5E0E0097DE5A /* TestView-iPad.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 142B83831B6BA7A600E28347 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 142B83841B6BA7A600E28347 /* MainWindow.xib in Resources */,
+ D837179F1BFFC25C005D65BC /* Images.xcassets in Resources */,
+ 142B83851B6BA7A600E28347 /* TestSelect.xib in Resources */,
+ 142B83871B6BA7A600E28347 /* server.p12 in Resources */,
+ 142B83881B6BA7A600E28347 /* client.p12 in Resources */,
+ 142B83891B6BA7A600E28347 /* cacert.der in Resources */,
+ 142B838A1B6BA7A600E28347 /* TestSelect-iPad.xib in Resources */,
+ 142B838B1B6BA7A600E28347 /* MainWindow-iPad.xib in Resources */,
+ 142B838C1B6BA7A600E28347 /* TestView.xib in Resources */,
+ 142B838D1B6BA7A600E28347 /* TestView-iPad.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 144B48251A78F71F00C0E06B /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 144B48261A78F71F00C0E06B /* MainWindow.xib in Resources */,
+ 144B48271A78F71F00C0E06B /* TestSelect.xib in Resources */,
+ 144B482A1A78F71F00C0E06B /* server.p12 in Resources */,
+ D8842EDA1BFF87E700A8B607 /* Images.xcassets in Resources */,
+ D8842EDC1BFF885600A8B607 /* Default-568h@2x.png in Resources */,
+ 1450A10C1ABC5E9C00A71895 /* client.p12 in Resources */,
+ 144B482B1A78F71F00C0E06B /* cacert.der in Resources */,
+ 144B482C1A78F71F00C0E06B /* TestSelect-iPad.xib in Resources */,
+ 144B482D1A78F71F00C0E06B /* MainWindow-iPad.xib in Resources */,
+ 144B482E1A78F71F00C0E06B /* TestView.xib in Resources */,
+ 144B482F1A78F71F00C0E06B /* TestView-iPad.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 14103B271CFC5E0E0097DE5A /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "#\n# We don't use a CopyFile build phase here to copy the test bundles because the test\n# bundles are located in different location depending on the platform. This script\n# copies the bundles if updated and sign them.\n#\n\nFRAMEWORKS_PATH=\"${TARGET_BUILD_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncd \"Bundles++11-${PLATFORM_NAME}\"\nif [ ! -d \"$FRAMEWORKS_PATH\" ]; then\n mkdir -p \"$FRAMEWORKS_PATH\"\nfi;\nfor i in `ls -d */*.bundle`;\ndo\n if [ ! -d \"$FRAMEWORKS_PATH/$i\" -o \"$i\" -nt \"$FRAMEWORKS_PATH/$i\" ]; then\n echo \"Copying $i\"\n mkdir -p \"$FRAMEWORKS_PATH/$(dirname $i)\"\n cp -rf $i \"$FRAMEWORKS_PATH/$(dirname $i)\"\n if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY_NAME}\" ]; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY}\" --preserve-metadata=identifier,entitlements \"${FRAMEWORKS_PATH}/$i\"\n fi;\n fi;\ndone\n\n";
+ };
+ 142B839C1B6BA7A600E28347 /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "#\n# We don't use a CopyFile build phase here to copy the test bundles because the test\n# bundles are located in different location depending on the platform. This script\n# copies the bundles if updated and sign them.\n#\nFRAMEWORKS_PATH=\"${TARGET_BUILD_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncd \"Bundles-${PLATFORM_NAME}\"\nif [ ! -d \"$FRAMEWORKS_PATH\" ]; then\n mkdir -p \"$FRAMEWORKS_PATH\"\nfi;\nfor i in `ls -d *.bundle`;\ndo\n if [ ! -d \"$FRAMEWORKS_PATH/$i\" -o \"$i\" -nt \"$FRAMEWORKS_PATH/$i\" ];\n then\n echo \"Copying $i\";\n cp -rf $i \"$FRAMEWORKS_PATH\"/;\n fi;\ndone\n\n";
+ };
+ 144B488F1A78F71F00C0E06B /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 12;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "#\n# We don't use a CopyFile build phase here to copy the test bundles because the test\n# bundles are located in different location depending on the platform. This script\n# copies the bundles if updated and sign them.\n#\n\nFRAMEWORKS_PATH=\"${TARGET_BUILD_DIR}\"/\"${FRAMEWORKS_FOLDER_PATH}\"\ncd \"Bundles-${PLATFORM_NAME}\"\nif [ ! -d \"$FRAMEWORKS_PATH\" ]; then\n mkdir -p \"$FRAMEWORKS_PATH\"\nfi;\nfor i in `ls -d */*.bundle`;\ndo\n if [ ! -d \"$FRAMEWORKS_PATH/$i\" -o \"$i\" -nt \"$FRAMEWORKS_PATH/$i\" ]; then\n echo \"Copying $i\"\n mkdir -p \"$FRAMEWORKS_PATH/$(dirname $i)\"\n cp -rf $i \"$FRAMEWORKS_PATH/$(dirname $i)\"\n if [ -n \"${EXPANDED_CODE_SIGN_IDENTITY_NAME}\" ]; then\n codesign --force --sign \"${EXPANDED_CODE_SIGN_IDENTITY}\" --preserve-metadata=identifier,entitlements \"${FRAMEWORKS_PATH}/$i\"\n fi;\n fi;\ndone\n\n";
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 14103B1B1CFC5E0E0097DE5A /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 14103B1C1CFC5E0E0097DE5A /* main.m in Sources */,
+ 14103B1D1CFC5E0E0097DE5A /* AppDelegate.mm in Sources */,
+ 14103B1E1CFC5E0E0097DE5A /* TestViewController.mm in Sources */,
+ 14103B1F1CFC5E0E0097DE5A /* TestSelectController.m in Sources */,
+ 14103B201CFC5E0E0097DE5A /* TestUtil.mm in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 142B83901B6BA7A600E28347 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 142B83911B6BA7A600E28347 /* main.m in Sources */,
+ 142B83921B6BA7A600E28347 /* AppDelegate.mm in Sources */,
+ 142B83931B6BA7A600E28347 /* TestViewController.mm in Sources */,
+ 142B83941B6BA7A600E28347 /* TestSelectController.m in Sources */,
+ 142B83951B6BA7A600E28347 /* TestUtil.mm in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 144B48321A78F71F00C0E06B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 144B48331A78F71F00C0E06B /* main.m in Sources */,
+ 144B48341A78F71F00C0E06B /* AppDelegate.mm in Sources */,
+ 144B48351A78F71F00C0E06B /* TestViewController.mm in Sources */,
+ 144B48361A78F71F00C0E06B /* TestSelectController.m in Sources */,
+ 144B48371A78F71F00C0E06B /* TestUtil.mm in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 14103B291CFC5E0E0097DE5A /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "C++ Test Suite_Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
+ HEADER_SEARCH_PATHS = (
+ ..,
+ Classes,
+ ../../../../ice/cpp/test/include/,
+ );
+ INFOPLIST_FILE = "$(SRCROOT)/C++11 Test Suite.plist";
+ OTHER_CFLAGS = "";
+ OTHER_CPLUSPLUSFLAGS = (
+ "-DICE_CPP11_MAPPING",
+ "$(OTHER_CFLAGS)",
+ );
+ OTHER_LDFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.zeroc.IceTouch-Cpp-Test-Suite";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ SLICE_CPP_FLAG = "";
+ SLICE_INCLUDE_PATH = "";
+ STRIP_STYLE = debugging;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 14103B2A1CFC5E0E0097DE5A /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "C++ Test Suite_Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
+ HEADER_SEARCH_PATHS = (
+ ..,
+ Classes,
+ ../../../../ice/cpp/test/include/,
+ );
+ INFOPLIST_FILE = "$(SRCROOT)/C++11 Test Suite.plist";
+ OTHER_CFLAGS = "";
+ OTHER_CPLUSPLUSFLAGS = (
+ "-DICE_CPP11_MAPPING",
+ "$(OTHER_CFLAGS)",
+ );
+ OTHER_LDFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.zeroc.IceTouch-Cpp-Test-Suite";
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ SLICE_CPP_FLAG = "";
+ SLICE_INCLUDE_PATH = "";
+ STRIP_STYLE = debugging;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+ 142B839E1B6BA7A600E28347 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "C++ Test Suite_Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
+ HEADER_SEARCH_PATHS = (
+ ..,
+ Classes,
+ ../../../../ice/cpp/test/include/,
+ );
+ INFOPLIST_FILE = "$(SRCROOT)/C++98 Test Suite-Info.plist";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.zeroc.IceTouch-Cpp-Test-Suite";
+ PRODUCT_NAME = "C++ Test Suite";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ SLICE_CPP_FLAG = "";
+ SLICE_INCLUDE_PATH = "";
+ STRIP_STYLE = debugging;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 142B839F1B6BA7A600E28347 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "C++ Test Suite_Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
+ HEADER_SEARCH_PATHS = (
+ ..,
+ Classes,
+ ../../../../ice/cpp/test/include/,
+ );
+ INFOPLIST_FILE = "$(SRCROOT)/C++98 Test Suite-Info.plist";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.zeroc.IceTouch-Cpp-Test-Suite";
+ PRODUCT_NAME = "C++ Test Suite";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ SLICE_CPP_FLAG = "";
+ SLICE_INCLUDE_PATH = "";
+ STRIP_STYLE = debugging;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+ 144B48911A78F71F00C0E06B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "C++ Test Suite_Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
+ HEADER_SEARCH_PATHS = (
+ ..,
+ Classes,
+ ../../../../ice/cpp/test/include/,
+ );
+ INFOPLIST_FILE = "$(SRCROOT)/C++98 Test Suite-Info.plist";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.zeroc.IceTouch-Cpp-Test-Suite";
+ PRODUCT_NAME = "C++ Test Suite";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ SLICE_CPP_FLAG = "";
+ SLICE_INCLUDE_PATH = "";
+ STRIP_STYLE = debugging;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 144B48921A78F71F00C0E06B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = YES;
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CODE_SIGN_IDENTITY = "iPhone Developer";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
+ GCC_PRECOMPILE_PREFIX_HEADER = YES;
+ GCC_PREFIX_HEADER = "C++ Test Suite_Prefix.pch";
+ GCC_PREPROCESSOR_DEFINITIONS = "";
+ GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
+ HEADER_SEARCH_PATHS = (
+ ..,
+ Classes,
+ ../../../../ice/cpp/test/include/,
+ );
+ INFOPLIST_FILE = "$(SRCROOT)/C++98 Test Suite-Info.plist";
+ OTHER_CFLAGS = "";
+ OTHER_LDFLAGS = "";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.zeroc.IceTouch-Cpp-Test-Suite";
+ PRODUCT_NAME = "C++ Test Suite";
+ "PROVISIONING_PROFILE[sdk=iphoneos*]" = "";
+ SDKROOT = iphoneos;
+ SLICE_CPP_FLAG = "";
+ SLICE_INCLUDE_PATH = "";
+ STRIP_STYLE = debugging;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Release;
+ };
+ C01FCF4F08A954540054247B /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$(IDENTIFIER)";
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ };
+ name = Debug;
+ };
+ C01FCF5008A954540054247B /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 7.0;
+ SDKROOT = iphoneos;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 14103B281CFC5E0E0097DE5A /* Build configuration list for PBXNativeTarget "C++11 Test Suite" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 14103B291CFC5E0E0097DE5A /* Debug */,
+ 14103B2A1CFC5E0E0097DE5A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 142B839D1B6BA7A600E28347 /* Build configuration list for PBXNativeTarget "C++98 Test Suite iOS 7" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 142B839E1B6BA7A600E28347 /* Debug */,
+ 142B839F1B6BA7A600E28347 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 144B48901A78F71F00C0E06B /* Build configuration list for PBXNativeTarget "C++98 Test Suite" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 144B48911A78F71F00C0E06B /* Debug */,
+ 144B48921A78F71F00C0E06B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ C01FCF4E08A954540054247B /* Build configuration list for PBXProject "C++ Test Suite" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ C01FCF4F08A954540054247B /* Debug */,
+ C01FCF5008A954540054247B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
diff --git a/cpp/test/ios/C++ Test Suite.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/cpp/test/ios/C++ Test Suite.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000000..0e7018e8c78
--- /dev/null
+++ b/cpp/test/ios/C++ Test Suite.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:/Users/benoit/Devel/GitHub/ice/cpp/test/ios/C++ Test Suite.xcodeproj">
+ </FileRef>
+</Workspace>
diff --git a/cpp/test/ios/C++11 Test Suite.plist b/cpp/test/ios/C++11 Test Suite.plist
new file mode 100644
index 00000000000..dd48f53e201
--- /dev/null
+++ b/cpp/test/ios/C++11 Test Suite.plist
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>Test Suite</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIcons</key>
+ <dict/>
+ <key>CFBundleIcons~ipad</key>
+ <dict/>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+ <key>NSMainNibFile~ipad</key>
+ <string>MainWindow-iPad</string>
+ <key>UIRequiresFullScreen</key>
+ <true/>
+</dict>
+</plist>
diff --git a/cpp/test/ios/C++98 Test Suite-Info.plist b/cpp/test/ios/C++98 Test Suite-Info.plist
new file mode 100644
index 00000000000..dd48f53e201
--- /dev/null
+++ b/cpp/test/ios/C++98 Test Suite-Info.plist
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleDisplayName</key>
+ <string>Test Suite</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIcons</key>
+ <dict/>
+ <key>CFBundleIcons~ipad</key>
+ <dict/>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>NSMainNibFile</key>
+ <string>MainWindow</string>
+ <key>NSMainNibFile~ipad</key>
+ <string>MainWindow-iPad</string>
+ <key>UIRequiresFullScreen</key>
+ <true/>
+</dict>
+</plist>
diff --git a/cpp/test/ios/Classes/AppDelegate.h b/cpp/test/ios/Classes/AppDelegate.h
new file mode 100644
index 00000000000..46a667b55c9
--- /dev/null
+++ b/cpp/test/ios/Classes/AppDelegate.h
@@ -0,0 +1,37 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <UIKit/UIKit.h>
+
+@class TestViewController;
+
+@interface AppDelegate : NSObject <UIApplicationDelegate>
+{
+@private
+ UIWindow *window;
+ IBOutlet UINavigationController *navigationController;
+ NSArray* tests;
+ NSInteger currentTest;
+ NSString* protocol;
+ BOOL loop;
+ BOOL runAll;
+}
+
+@property (nonatomic, retain) IBOutlet UIWindow *window;
+@property (nonatomic, retain) IBOutlet UINavigationController* navigationController;
+@property (nonatomic, readonly) NSArray* tests;
+@property (nonatomic) NSInteger currentTest;
+@property (nonatomic, retain) NSString* protocol;
+@property (nonatomic) BOOL loop;
+@property (readonly) BOOL runAll;
+
+-(BOOL)testCompleted:(BOOL)success;
+
+@end
+
diff --git a/cpp/test/ios/Classes/AppDelegate.mm b/cpp/test/ios/Classes/AppDelegate.mm
new file mode 100644
index 00000000000..e22648a6778
--- /dev/null
+++ b/cpp/test/ios/Classes/AppDelegate.mm
@@ -0,0 +1,216 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <AppDelegate.h>
+#import <TestViewController.h>
+#import <TestUtil.h>
+
+struct TestData
+{
+ NSString* name;
+ NSString* prefix;
+ NSString* client;
+ NSString* server;
+ NSString* serverAMD;
+ NSString* collocated;
+ bool sslSupport;
+ bool wsSupport;
+ bool runWithSlicedFormat;
+ bool runWith10Encoding;
+ bool cpp11Support;
+};
+
+static NSString* protocols[] = { @"tcp", @"ssl", @"ws", @"wss" };
+const int nProtocols = sizeof(protocols) / sizeof(NSString*);
+
+static const struct TestData alltests[] =
+{
+//
+// | Name | lib base name | client | server | amdserver | collocated | ssl support | ws support | sliced | encoding 1.0 | cpp11 |
+//
+{ @"proxy", @"Ice_proxy", @"client.bundle", @"server.bundle", @"serveramd.bundle", @"collocated.bundle", true, true, false, false, true },
+{ @"operations", @"Ice_operations", @"client.bundle", @"server.bundle", @"serveramd.bundle", @"collocated.bundle", true, true, false, false, true },
+{ @"exceptions", @"Ice_exceptions", @"client.bundle", @"server.bundle", @"serveramd.bundle", @"collocated.bundle", true, true, true, true, true },
+{ @"ami", @"Ice_ami", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"info", @"Ice_info", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"inheritance", @"Ice_inheritance", @"client.bundle", @"server.bundle", 0, @"collocated.bundle", true, true, false, false, true},
+{ @"facets", @"Ice_facets", @"client.bundle", @"server.bundle", 0, @"collocated.bundle", true, true, false, false, true },
+{ @"objects", @"Ice_objects", @"client.bundle", @"server.bundle", 0, @"collocated.bundle", true, true, true, true, true },
+{ @"optional", @"Ice_optional", @"client.bundle", @"server.bundle", 0, 0, true, true, true, false, false },
+{ @"binding", @"Ice_binding", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"location", @"Ice_location", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"adapterDeactivation", @"Ice_adapterDeactivation", @"client.bundle", @"server.bundle", 0, @"collocated.bundle", true, true, false, false, true },
+{ @"slicing/exceptions", @"Ice_slicing_exceptions", @"client.bundle", @"server.bundle", @"serveramd.bundle", 0, true, true, false, true, true },
+{ @"slicing/objects", @"Ice_slicing_objects", @"client.bundle", @"server.bundle", @"serveramd.bundle", 0, true, true, false, true, true },
+{ @"dispatcher", @"Ice_dispatcher", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"stream", @"Ice_stream", @"client.bundle", 0, 0, 0, true, true, false, false, true },
+{ @"hold", @"Ice_hold", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"custom", @"Ice_custom", @"client.bundle", @"server.bundle", @"serveramd.bundle", @"collocated.bundle", true, true, false, false, false },
+{ @"retry", @"Ice_retry", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"timeout", @"Ice_timeout", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"interceptor", @"Ice_interceptor", @"client.bundle", 0, 0, 0, true, true, false, false, true },
+{ @"udp", @"Ice_udp", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"defaultServant", @"Ice_defaultServant", @"client.bundle", 0, 0, 0, true, true, false, false, true },
+{ @"defaultValue", @"Ice_defaultValue", @"client.bundle", 0, 0, 0, true, true, false, false, true },
+{ @"servantLocator", @"Ice_servantLocator", @"client.bundle", @"server.bundle", @"serveramd.bundle", @"collocated.bundle", true, true, false, false, true },
+{ @"invoke", @"Ice_invoke", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"hash", @"Ice_hash", @"client.bundle", 0, 0, 0, true, true, false, false, true },
+{ @"admin", @"Ice_admin", @"client.bundle", @"server.bundle", 0, 0, true, true, false, false, true },
+{ @"metrics", @"Ice_metrics", @"client.bundle", @"server.bundle", 0, 0, false, false, false, false, true },
+{ @"enums", @"Ice_enums", @"client.bundle", @"server.bundle", 0, 0, true, true, false, true, true },
+{ @"services", @"Ice_services", @"client.bundle", 0, 0, 0, true, true, false, false, true },
+};
+
+@implementation AppDelegate
+
+@synthesize window;
+@synthesize navigationController;
+@synthesize tests;
+@synthesize currentTest;
+@synthesize loop;
+@synthesize runAll;
+
+static NSString* currentTestKey = @"currentTestKey";
+static NSString* protocolKey = @"protocolKey";
+
++(void)initialize
+{
+ NSDictionary* appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
+ @"0", currentTestKey,
+ @"tcp", protocolKey,
+ nil];
+ [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
+}
+
+-(id)init
+{
+ if(self = [super init])
+ {
+ self->runAll = getenv("RUNALL") != NULL;
+
+ NSMutableArray* theTests = [NSMutableArray array];
+ for(int i = 0; i < sizeof(alltests)/sizeof(alltests[0]); ++i)
+ {
+ TestCase* test = [TestCase testWithName:alltests[i].name
+ prefix:alltests[i].prefix
+ client:alltests[i].client
+ server:alltests[i].server
+ serveramd:alltests[i].serverAMD
+ collocated:alltests[i].collocated
+ sslSupport:alltests[i].sslSupport
+ wsSupport:alltests[i].wsSupport
+ runWithSlicedFormat:alltests[i].runWithSlicedFormat
+ runWith10Encoding:alltests[i].runWith10Encoding
+ cpp11Support:alltests[i].cpp11Support];
+ [theTests addObject:test];
+ }
+ tests = [[theTests copy] retain];
+
+ // Initialize the application defaults.
+ currentTest = [[NSUserDefaults standardUserDefaults] integerForKey:currentTestKey];
+ if(runAll || currentTest < 0 || currentTest > tests.count)
+ {
+ currentTest = 0;
+ }
+
+ protocol = [[NSUserDefaults standardUserDefaults] stringForKey:protocolKey];
+ int i = 0;
+ for(; i < nProtocols; ++i)
+ {
+ if([protocols[i] isEqualToString:protocol])
+ {
+ break;
+ }
+ }
+ if(i == nProtocols)
+ {
+ protocol = @"tcp";
+ }
+
+ loop = NO;
+ }
+ return self;
+}
+
+- (void)applicationDidFinishLaunching:(UIApplication *)application
+{
+
+ // Override point for customization after app launch
+ [window setRootViewController:navigationController];
+ [window makeKeyAndVisible];
+}
+
+- (void)dealloc
+{
+ [tests release];
+ [protocol release];
+ [navigationController release];
+ [window release];
+ [super dealloc];
+}
+
+-(NSInteger)currentTest
+{
+ return currentTest;
+}
+
+-(void)setCurrentTest:(NSInteger)test
+{
+ currentTest = test;
+
+ [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:currentTest] forKey:currentTestKey];
+}
+
+-(NSString*)protocol
+{
+ return protocol;
+}
+
+-(void)setProtocol:(NSString*)v
+{
+ protocol = [v retain];
+ [[NSUserDefaults standardUserDefaults] setObject:v forKey:protocolKey];
+}
+
+-(BOOL)testCompleted:(BOOL)success
+{
+ if(success)
+ {
+ self.currentTest = (currentTest+1) % tests.count;
+ if(runAll || loop)
+ {
+ if(self.currentTest == 0)
+ {
+ int i = 0;
+ for(; i < nProtocols; ++i)
+ {
+ if([protocols[i] isEqualToString:protocol])
+ {
+ break;
+ }
+ }
+
+ if(++i == nProtocols && !loop)
+ {
+ std::cout << "\n*** Finished running all tests" << std::endl;
+ return NO;
+ }
+ else
+ {
+ protocol = protocols[i % nProtocols];
+ return YES;
+ }
+ }
+ return YES;
+ }
+ }
+ return NO;
+}
+
+@end
diff --git a/cpp/test/ios/Classes/TestSelectController.h b/cpp/test/ios/Classes/TestSelectController.h
new file mode 100644
index 00000000000..97aac1a8fc3
--- /dev/null
+++ b/cpp/test/ios/Classes/TestSelectController.h
@@ -0,0 +1,26 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <UIKit/UIKit.h>
+
+@class TestViewController;
+
+@interface TestSelectController : UIViewController<UIPickerViewDataSource, UIPickerViewDelegate>
+{
+@private
+ IBOutlet UIPickerView* pickerView;
+ IBOutlet UISegmentedControl* protocol;
+ IBOutlet UISwitch* loopSwitch;
+ NSArray* tests;
+ TestViewController *testViewController;
+}
+
+-(IBAction)runTest:(id)sender;
+
+@end
diff --git a/cpp/test/ios/Classes/TestSelectController.m b/cpp/test/ios/Classes/TestSelectController.m
new file mode 100644
index 00000000000..1213096b0ec
--- /dev/null
+++ b/cpp/test/ios/Classes/TestSelectController.m
@@ -0,0 +1,130 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <TestSelectController.h>
+#import <TestUtil.h>
+#import <AppDelegate.h>
+#import <TestViewController.h>
+
+@interface TestSelectController()
+
+@property (nonatomic, retain) NSArray* tests;
+@property (nonatomic, retain) UIPickerView* pickerView;
+@property (nonatomic, retain) UISegmentedControl* protocol;
+@property (nonatomic, retain) TestViewController* testViewController;
+
+@end
+
+@implementation TestSelectController
+
+@synthesize tests;
+@synthesize pickerView;
+@synthesize protocol;
+@synthesize testViewController;
+
+- (void)viewDidLoad
+{
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ self.tests = appDelegate.tests;
+ [super viewDidLoad];
+}
+
+-(void)viewWillAppear:(BOOL)animated
+{
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ [pickerView selectRow:appDelegate.currentTest inComponent:0 animated:NO];
+ for (int i = 0; i != [self.protocol numberOfSegments]; ++i) {
+ if([[self.protocol titleForSegmentAtIndex:i] isEqualToString:[appDelegate.protocol uppercaseString]])
+ {
+ self.protocol.selectedSegmentIndex = i;
+ break;
+ }
+ }
+ if(appDelegate.runAll)
+ {
+ [self.navigationController pushViewController:self.testViewController animated:YES];
+ }
+ }
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
+ // Release anything that's not essential, such as cached data
+}
+
+- (void)dealloc
+{
+ [tests release];
+ [pickerView release];
+ [protocol release];
+ [loopSwitch release];
+ [testViewController release];
+
+ [super dealloc];
+}
+
+-(TestViewController*)testViewController
+{
+ // Instantiate the test view controller if necessary.
+ if (testViewController == nil)
+ {
+ NSString* nib;
+ if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
+ {
+ nib = @"TestView-iPad";
+ }
+ else
+ {
+ nib = @"TestView";
+ }
+ testViewController = [[TestViewController alloc] initWithNibName:nib bundle:nil];
+ }
+ return testViewController;
+}
+
+#pragma mark -
+
+-(IBAction)runTest:(id)sender
+{
+ NSInteger row = [pickerView selectedRowInComponent:0];
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ appDelegate.currentTest = row;
+ appDelegate.protocol = [[protocol titleForSegmentAtIndex:[protocol selectedSegmentIndex]] lowercaseString];
+ appDelegate.loop = loopSwitch.isOn;
+
+ TestViewController* controller = self.testViewController;
+ [self.navigationController pushViewController:controller animated:YES];
+}
+
+#pragma mark UIPickerViewDelegate
+
+- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
+{
+ TestCase* test = (TestCase*)[tests objectAtIndex:row];
+ return test.name;
+}
+
+#pragma mark UIPickerViewDataSource
+
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
+{
+ return 1;
+}
+
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)componen
+{
+ return tests.count;
+}
+@end
diff --git a/cpp/test/ios/Classes/TestUtil.h b/cpp/test/ios/Classes/TestUtil.h
new file mode 100644
index 00000000000..07052aef28f
--- /dev/null
+++ b/cpp/test/ios/Classes/TestUtil.h
@@ -0,0 +1,138 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#ifndef TEST_UTIL_H
+#define TEST_UTIL_H
+
+#include <TestHelper.h>
+#include <UIKit/UIKit.h>
+#include <Foundation/NSString.h>
+
+@interface TestCase : NSObject
+{
+@private
+
+ NSString* name;
+ NSString* prefix;
+ NSString* client;
+ NSString* server;
+ NSString* serveramd;
+ NSString* collocated;
+ BOOL sslSupport;
+ BOOL wsSupport;
+ BOOL runWithSlicedFormat;
+ BOOL runWith10Encoding;
+ BOOL cpp11Support;
+}
+
++(id) testWithName:(NSString*)name
+ prefix:(NSString*) prefix
+ client:(NSString*) client
+ server:(NSString*) server
+ serveramd:(NSString*) serveramd
+ collocated:(NSString*) collocated
+ sslSupport:(BOOL) sslSupport
+ wsSupport:(BOOL) wsSupport
+ runWithSlicedFormat:(BOOL)runWithSlicedFormat
+ runWith10Encoding:(BOOL)runWith10Encoding
+ cpp11Support:(BOOL)cpp11Support;
+
+-(BOOL)hasServer;
+-(BOOL)hasAMDServer;
+-(BOOL)hasCollocated;
+-(BOOL)isProtocolSupported:(NSString*)protocol;
+
+@property (readonly) NSString* name;
+@property (readonly) NSString* prefix;
+@property (readonly) NSString* client;
+@property (readonly) NSString* server;
+@property (readonly) NSString* serveramd;
+@property (readonly) NSString* collocated;
+@property (readonly) BOOL sslSupport;
+@property (readonly) BOOL wsSupport;
+@property (readonly) BOOL runWithSlicedFormat;
+@property (readonly) BOOL runWith10Encoding;
+@property (readonly) BOOL cpp11Support;
+
+@end
+
+typedef int (*MAIN_ENTRY_POINT)(int argc, char** argv, Test::MainHelper* helper);
+typedef int (*SHUTDOWN_ENTRY_POINT)();
+
+enum TestConfigType { TestConfigTypeClient, TestConfigTypeServer, TestConfigTypeColloc };
+enum TestConfigOption {TestConfigOptionDefault, TestConfigOptionSliced, TestConfigOptionEncoding10 };
+
+struct TestConfig
+{
+ TestConfigType type;
+ TestConfigOption option;
+ std::string protocol;
+ bool hasServer;
+};
+
+class MainHelperI : public Test::MainHelper
+{
+public:
+
+ MainHelperI(const std::string& test, const std::string& libName, TestConfig config,
+ id target, SEL output, SEL ready) :
+ _test(test),
+ _libName(libName),
+ _config(config),
+ _completed(false),
+ _status(0),
+ _target(target),
+ _output(output),
+ _ready(ready)
+ {
+ }
+
+ virtual ~MainHelperI();
+
+ virtual void run();
+
+ virtual void serverReady();
+
+ virtual void shutdown();
+
+ virtual void waitForCompleted(){};
+
+ virtual bool redirect();
+
+ virtual void print(const std::string&);
+
+ int
+ status()
+ {
+ return _status;
+ }
+
+private:
+
+ void
+ completed(int status)
+ {
+ _completed = true;
+ _status = status;
+ }
+
+ std::string _test;
+ std::string _libName;
+ TestConfig _config;
+ CFBundleRef _handle;
+ SHUTDOWN_ENTRY_POINT _dllTestShutdown;
+ bool _completed;
+ int _status;
+
+ id _target;
+ SEL _ready;
+ SEL _output;
+};
+
+#endif
diff --git a/cpp/test/ios/Classes/TestUtil.mm b/cpp/test/ios/Classes/TestUtil.mm
new file mode 100644
index 00000000000..d94fc1ce62b
--- /dev/null
+++ b/cpp/test/ios/Classes/TestUtil.mm
@@ -0,0 +1,296 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <TestUtil.h>
+#include <dlfcn.h>
+#include <stdarg.h>
+#include <stdlib.h>
+
+#include <vector>
+#include <string>
+
+#import <Foundation/NSString.h>
+#import <Foundation/NSObject.h>
+#import <Foundation/NSThread.h>
+
+@implementation TestCase
+
+@synthesize name;
+@synthesize prefix;
+@synthesize server;
+@synthesize client;
+@synthesize serveramd;
+@synthesize collocated;
+@synthesize sslSupport;
+@synthesize wsSupport;
+@synthesize runWithSlicedFormat;
+@synthesize runWith10Encoding;
+@synthesize cpp11Support;
+
++(id)testWithName:(NSString*)name
+ prefix:(NSString*) prefix
+ client:(NSString*) client
+ server:(NSString*) server
+ serveramd:(NSString*) serveramd
+ collocated:(NSString*) collocated
+ sslSupport:(BOOL) sslSupport
+ wsSupport:(BOOL) wsSupport
+ runWithSlicedFormat:(BOOL)runWithSlicedFormat
+ runWith10Encoding:(BOOL)runWith10Encoding
+ cpp11Support:(BOOL)cpp11Support
+{
+ TestCase* t = [[TestCase alloc] init];
+ if(t != nil)
+ {
+ t->name = name;
+ t->prefix = prefix;
+ t->client = client;
+ t->server = server;
+ t->serveramd = serveramd;
+ t->collocated = collocated;
+ t->sslSupport = sslSupport;
+ t->wsSupport = wsSupport;
+ t->runWithSlicedFormat = runWithSlicedFormat;
+ t->runWith10Encoding = runWith10Encoding;
+ t->cpp11Support = cpp11Support;
+ }
+ return [t autorelease];
+}
+
+-(BOOL) hasServer
+{
+ return server != 0;
+}
+
+-(BOOL) hasAMDServer
+{
+ return serveramd != 0;
+}
+
+-(BOOL) hasCollocated
+{
+ return collocated != 0;
+}
+
+-(BOOL)isProtocolSupported:(NSString*)protocol
+{
+ BOOL supported = YES;
+ if(!sslSupport)
+ {
+ supported &= [protocol isEqualToString:@"tcp"] || [protocol isEqualToString:@"ws"];
+ }
+ if(!wsSupport)
+ {
+ supported &= [protocol isEqualToString:@"tcp"] || [protocol isEqualToString:@"ssl"];
+ }
+ return supported;
+}
+-(void)dealloc
+{
+ [name release];
+ [prefix release];
+ [client release];
+ [server release];
+ [serveramd release];
+ [collocated release];
+ [super dealloc];
+}
+
+@end
+
+MainHelperI::~MainHelperI()
+{
+ if(_handle)
+ {
+ CFBundleUnloadExecutable(_handle);
+ }
+}
+
+void
+MainHelperI::run()
+{
+ //
+ // Compose the path of the Test.bundle resources folder
+ //
+ NSString* bundlePath = [[NSBundle mainBundle] privateFrameworksPath];
+
+ bundlePath = [bundlePath stringByAppendingPathComponent:[NSString stringWithUTF8String:_libName.c_str()]];
+
+ NSURL* bundleURL = [NSURL fileURLWithPath:bundlePath];
+ _handle = CFBundleCreate(NULL, (CFURLRef)bundleURL);
+
+ int status = EXIT_FAILURE;
+ NSError* error = nil;
+ Boolean loaded = CFBundleLoadExecutableAndReturnError(_handle, (CFErrorRef*)&error);
+ if(error != nil || !loaded)
+ {
+ print([[error description] UTF8String]);
+ completed(status);
+ return;
+ }
+
+ void* sym = dlsym(_handle, "dllTestShutdown");
+ sym = CFBundleGetFunctionPointerForName(_handle, CFSTR("dllTestShutdown"));
+ if(sym == 0)
+ {
+ NSString* err = [NSString stringWithFormat:@"Could not get function pointer dllTestShutdown from bundle %@",
+ bundlePath];
+ print([err UTF8String]);
+ completed(status);
+ return;
+ }
+ _dllTestShutdown = (SHUTDOWN_ENTRY_POINT)sym;
+
+ sym = CFBundleGetFunctionPointerForName(_handle, CFSTR("dllMain"));
+ if(sym == 0)
+ {
+ NSString* err = [NSString stringWithFormat:@"Could not get function pointer dllMain from bundle %@",
+ bundlePath];
+ print([err UTF8String]);
+ completed(status);
+ return;
+ }
+
+ MAIN_ENTRY_POINT dllMain = (MAIN_ENTRY_POINT)sym;
+
+ std::vector<std::string> args;
+ if(_config.type == TestConfigTypeServer)
+ {
+ args.push_back("server");
+ }
+ else
+ {
+ args.push_back("client");
+ }
+ args.push_back("--Ice.NullHandleAbort=1");
+ args.push_back("--Ice.Warn.Connections=1");
+ args.push_back("--Ice.Default.Host=127.0.0.1");
+ args.push_back("--Ice.Trace.Network=0");
+ args.push_back("--Ice.Trace.Protocol=0");
+
+ if(_config.type == TestConfigTypeServer)
+ {
+ args.push_back("--Ice.ThreadPool.Server.Size=1");
+ args.push_back("--Ice.ThreadPool.Server.SizeMax=3");
+ args.push_back("--Ice.ThreadPool.Server.SizeWarn=0");
+ //args.push_back("--Ice.PrintAdapterReady=1");
+ args.push_back("--Ice.ServerIdleTime=30");
+ }
+
+ args.push_back("--Ice.Default.Protocol=" + _config.protocol);
+ if(_config.protocol == "ssl" || _config.protocol == "wss")
+ {
+ args.push_back("--IceSSL.CAs=cacert.der");
+ args.push_back("--IceSSL.CheckCertName=0");
+ if(_config.type == TestConfigTypeServer)
+ {
+ args.push_back("--IceSSL.CertFile=server.p12");
+ }
+ else
+ {
+ args.push_back("--IceSSL.CertFile=client.p12");
+ }
+ args.push_back("--IceSSL.Password=password");
+ args.push_back("--Ice.Override.ConnectTimeout=10000"); // COMPILERFIX: Workaround for SSL hang on iOS devices
+ }
+
+ if(_config.option == TestConfigOptionSliced)
+ {
+ args.push_back("--Ice.Default.SlicedFormat");
+ }
+ else if(_config.option == TestConfigOptionEncoding10)
+ {
+ args.push_back("--Ice.Default.EncodingVersion=1.0");
+ }
+
+ if(_config.type == TestConfigTypeServer)
+ {
+ if(_libName.find("serveramd") != std::string::npos)
+ {
+ print("Running test with AMD server & ");
+ }
+ else
+ {
+ print("Running test with ");
+ }
+ }
+ else if(_config.type == TestConfigTypeClient || _config.type == TestConfigTypeColloc)
+ {
+ if(_config.type == TestConfigTypeColloc)
+ {
+ print("Running collocated test with ");
+ }
+ else if(!_config.hasServer)
+ {
+ print("Running test with ");
+ }
+ print(_config.protocol + " and ");
+ if(_config.option == TestConfigOptionDefault)
+ {
+ print("default format.\n");
+ }
+ else if(_config.option == TestConfigOptionSliced)
+ {
+ print("sliced format.\n");
+ }
+ else if(_config.option == TestConfigOptionEncoding10)
+ {
+ print("1.0 encoding.\n");
+ }
+ }
+
+ char** argv = new char*[args.size() + 1];
+ for(unsigned int i = 0; i < args.size(); ++i)
+ {
+ argv[i] = const_cast<char*>(args[i].c_str());
+ }
+ argv[args.size()] = 0;
+ try
+ {
+ status = dllMain(static_cast<int>(args.size()), argv, this);
+ }
+ catch(const std::exception& ex)
+ {
+ print("unexpected exception while running `" + _test + "':\n" + ex.what());
+ }
+ catch(...)
+ {
+ print("unexpected unknown exception while running `" + _test + "'");
+ }
+ completed(status);
+ delete[] argv;
+}
+
+void
+MainHelperI::serverReady()
+{
+ [_target performSelectorOnMainThread:_ready withObject:nil waitUntilDone:NO];
+}
+
+void
+MainHelperI::shutdown()
+{
+ if(_dllTestShutdown)
+ {
+ _dllTestShutdown();
+ }
+}
+
+bool
+MainHelperI::redirect()
+{
+ return _config.type == TestConfigTypeClient || _config.type == TestConfigTypeColloc;
+}
+
+void
+MainHelperI::print(const std::string& msg)
+{
+ [_target performSelectorOnMainThread:_output withObject:[NSString stringWithUTF8String: msg.c_str()]
+ waitUntilDone:NO];
+}
diff --git a/cpp/test/ios/Classes/TestViewController.h b/cpp/test/ios/Classes/TestViewController.h
new file mode 100644
index 00000000000..697e274f583
--- /dev/null
+++ b/cpp/test/ios/Classes/TestViewController.h
@@ -0,0 +1,30 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <UIKit/UIKit.h>
+#import <TestUtil.h>
+
+@interface TestViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>
+{
+@private
+ IBOutlet UITableView* output;
+ IBOutlet UIActivityIndicatorView* activity;
+ IBOutlet UIButton* nextButton;
+
+ NSMutableString* currentMessage;
+ NSMutableArray* messages;
+ NSOperationQueue* queue;
+ TestCase* test;
+ NSEnumerator* testRunEnumator;
+ bool reloadScheduled;
+}
+-(IBAction)next:(id)sender;
+-(NSOperationQueue*) queue;
+@end
+
diff --git a/cpp/test/ios/Classes/TestViewController.mm b/cpp/test/ios/Classes/TestViewController.mm
new file mode 100644
index 00000000000..d6e68e06ef1
--- /dev/null
+++ b/cpp/test/ios/Classes/TestViewController.mm
@@ -0,0 +1,580 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <TestViewController.h>
+#import <TestUtil.h>
+#import <AppDelegate.h>
+//
+// Avoid warning for undocumented method.
+//
+@interface UIApplication(UndocumentedAPI)
+-(void)launchApplicationWithIdentifier:(NSString*)id suspended:(BOOL)flag;
+@end
+
+// TODO: Would be nice to have a red font for fatal, and error messages.
+@interface MessageCell : UITableViewCell
+{
+@private
+ UILabel* body;
+}
+
+@property (nonatomic, retain) UILabel* body;
+
++(CGFloat)heightForMessage:(NSString*)messsage;
+
+@end
+
+@implementation MessageCell
+@synthesize body;
+
+- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
+{
+ if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
+ {
+ body = [[UILabel alloc] initWithFrame:CGRectZero];
+ body.textColor = [UIColor blackColor];
+ body.font = [UIFont boldSystemFontOfSize:14];
+ body.numberOfLines = 0;
+
+ [self.contentView addSubview:self.body];
+ }
+
+ return self;
+}
+
++(CGFloat)heightForMessage:(NSString*)text
+{
+ // The header is always one line, the body is multiple lines.
+ // The width of the table is 320 - 20px of left & right padding. We don't want to let the body
+ // text go past 200px.
+ CGRect body = [text boundingRectWithSize:CGSizeMake(300.f, 200.0f) options:NSStringDrawingUsesLineFragmentOrigin|NSStringDrawingUsesFontLeading attributes:@{NSFontAttributeName:[UIFont boldSystemFontOfSize:14] } context:nil];
+ return body.size.height + 20.f;
+}
+
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+
+ CGRect contentRect = self.contentView.bounds;
+
+ CGRect bodyFrame = CGRectMake(10.f, 0.f, CGRectGetWidth(contentRect)-20.f, CGRectGetHeight(contentRect));
+
+ self.body.frame = bodyFrame;
+}
+
+- (void)dealloc
+{
+ [body release];
+ [super dealloc];
+}
+
+-(void)setMessage:(NSString*)m
+{
+ self.body.text = m;
+}
+
+@end
+
+@interface TestViewController()
+
+@property (nonatomic, retain) UITableView* output;
+@property (nonatomic, retain) UIActivityIndicatorView* activity;
+@property (nonatomic, retain) UIButton* nextButton;
+
+@property (nonatomic, retain) NSMutableString* currentMessage;
+@property (nonatomic, retain) NSMutableArray* messages;
+@property (nonatomic, retain) NSOperationQueue* queue;
+@property (retain) TestCase* test;
+
+-(void)add:(NSString*)d;
+-(void)startTest;
+@end
+
+@interface TestRun : NSObject
+{
+ TestConfigOption option;
+ TestCase* test;
+ NSString* server;
+ NSString* client;
+ BOOL collocated;
+
+ int completed;
+ int running;
+ int error;
+ MainHelperI* clientHelper;
+ MainHelperI* serverHelper;
+ TestViewController* viewController;
+}
+
++(id) testRunClient:(TestCase*)test;
++(id) testRunCollocated:(TestCase*)test;
++(id) testRunClientAMDServer:(TestCase*)test;
++(id) testRunClientServer:(TestCase*)test;
++(id) testRunClientServerWithConfigOption:(TestCase*)test option:(TestConfigOption)option;
++(id) testRunClientAMDServerWithConfigOption:(TestCase*)test option:(TestConfigOption)option;
+
+-(NSInvocationOperation*) runInvocation:(TestViewController*)callback;
+@end
+
+@implementation TestViewController
+
+@synthesize output;
+@synthesize activity;
+@synthesize nextButton;
+@synthesize currentMessage;
+@synthesize messages;
+@synthesize queue;
+@synthesize test;
+
+- (void)viewDidLoad
+{
+ self.currentMessage = [NSMutableString string];
+ self.messages = [NSMutableArray array];
+ queue = [[NSOperationQueue alloc] init];
+ self.queue.maxConcurrentOperationCount = 2; // We need at least 2 concurrent operations.
+
+ [super viewDidLoad];
+}
+
+-(void)viewWillAppear:(BOOL)animated
+{
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ self.test = (TestCase*)[appDelegate.tests objectAtIndex:appDelegate.currentTest];
+ [self startTest];
+}
+
+-(void)viewWillDisappear:(BOOL)animated
+{
+ // TODO: Waiting isn't possible until the tests periodically find out whether
+ // they should terminate.
+ // Wait until the tests are complete.
+ //[queue waitUntilAllOperationsAreFinished];
+}
+
+- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
+{
+ // Return YES for supported orientations
+ return (interfaceOrientation == UIInterfaceOrientationPortrait);
+}
+
+- (void)didReceiveMemoryWarning
+{
+ [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview
+ // Release anything that's not essential, such as cached data
+}
+
+- (void)dealloc
+{
+ [output release];
+ [activity release];
+ [nextButton release];
+
+ [currentMessage release];
+ [messages release];
+ [queue release];
+ [test release];
+
+ [super dealloc];
+}
+
+#pragma mark -
+
+-(void)startTest
+{
+ self.title = test.name;
+ [self.navigationItem setHidesBackButton:YES animated:YES];
+
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ if(appDelegate.loop)
+ {
+ [nextButton setTitle:@"Stop running" forState:UIControlStateNormal];
+ }
+ else
+ {
+ nextButton.enabled = NO;
+ [nextButton setAlpha:0.5];
+ [nextButton setTitle:@"Test is running" forState:UIControlStateDisabled];
+ }
+
+ [currentMessage deleteCharactersInRange:NSMakeRange(0, currentMessage.length)];
+ [messages removeAllObjects];
+ [output reloadData];
+
+ [activity startAnimating];
+ if(![test isProtocolSupported:appDelegate.protocol])
+ {
+ [self testComplete:YES];
+ return;
+ }
+#ifdef ICE_CPP11_MAPPING
+ if(!test.cpp11Support)
+ {
+ [self add:@"C++11 not supported by this test\n"];
+ [self testComplete:YES];
+ return;
+ }
+#endif
+
+ NSMutableArray* testRuns = [NSMutableArray array];
+ if([test hasServer])
+ {
+ [testRuns addObject:[TestRun testRunClientServer:test]];
+ if([test hasAMDServer])
+ {
+ [testRuns addObject:[TestRun testRunClientAMDServer:test]];
+ }
+ if(test.runWithSlicedFormat)
+ {
+ [testRuns addObject:[TestRun testRunClientServerWithConfigOption:test option:TestConfigOptionSliced]];
+ if([test hasAMDServer])
+ {
+ [testRuns addObject:[TestRun testRunClientAMDServerWithConfigOption:test option:TestConfigOptionSliced]];
+ }
+ }
+ if(test.runWith10Encoding)
+ {
+ [testRuns addObject:[TestRun testRunClientServerWithConfigOption:test option:TestConfigOptionEncoding10]];
+ if([test hasAMDServer])
+ {
+ [testRuns addObject:[TestRun testRunClientAMDServerWithConfigOption:test option:TestConfigOptionEncoding10]];
+ }
+ }
+ }
+ else
+ {
+ [testRuns addObject:[TestRun testRunClient:test]];
+ }
+ if([test hasCollocated])
+ {
+ [testRuns addObject:[TestRun testRunCollocated:test]];
+ }
+
+ testRunEnumator = [[testRuns objectEnumerator] retain];
+ id testRun = [testRunEnumator nextObject];
+ [queue addOperation:[testRun runInvocation:self]];
+}
+-(void)testRunComplete:(BOOL)success
+{
+ if(!success)
+ {
+ [self testComplete:NO];
+ return;
+ }
+
+ id testRun = [testRunEnumator nextObject];
+ if(testRun == nil)
+ {
+ [self testComplete:YES];
+ }
+ else
+ {
+ [queue addOperation:[testRun runInvocation:self]];
+ }
+}
+
+-(void)testComplete:(BOOL)success
+{
+ [activity stopAnimating];
+
+ nextButton.enabled = YES;
+ [nextButton setAlpha:1.0];
+ [self.navigationItem setHidesBackButton:NO animated:YES];
+
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ TestCase* nextTest = (TestCase*)[appDelegate.tests objectAtIndex:(appDelegate.currentTest+1)%(appDelegate.tests.count)];
+ NSString* buttonTitle = [NSString stringWithFormat:@"Run %@", nextTest.name];
+ [nextButton setTitle:buttonTitle forState:UIControlStateNormal];
+ self.test = nil;
+ [testRunEnumator release];
+ testRunEnumator = nil;
+
+ if([appDelegate testCompleted:success])
+ {
+ NSAssert(test == nil, @"test == nil");
+ self.test = (TestCase*)[appDelegate.tests objectAtIndex:appDelegate.currentTest];
+ [self startTest];
+ }
+}
+
+-(IBAction)next:(id)sender
+{
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ if(appDelegate.loop)
+ {
+ appDelegate.loop = NO;
+ nextButton.enabled = NO;
+ [nextButton setAlpha:0.5];
+ [nextButton setTitle:@"Waiting..." forState:UIControlStateDisabled];
+ }
+ else
+ {
+ NSAssert(test == nil, @"test == nil");
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ self.test = (TestCase*)[appDelegate.tests objectAtIndex:appDelegate.currentTest];
+ [self startTest];
+ }
+}
+-(NSOperationQueue*) queue
+{
+ return queue;
+}
+-(void)add:(NSString*)s
+{
+ AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
+ if(appDelegate.runAll)
+ {
+ printf("%s", [s UTF8String]);
+ }
+
+ [currentMessage appendString:s];
+ NSRange range = [currentMessage rangeOfString:@"\n" options:NSBackwardsSearch];
+ if(range.location != NSNotFound)
+ {
+ [messages addObject:[[currentMessage copy] autorelease]];
+ [currentMessage deleteCharactersInRange:NSMakeRange(0, currentMessage.length)];
+
+ // reloadData hangs if called too rapidly... we call at most every 100ms.
+ if(!reloadScheduled) {
+ reloadScheduled = TRUE;
+ [self performSelector:@selector(reloadOutput) withObject:nil afterDelay:0.1];
+ }
+ }
+}
+-(void) reloadOutput
+{
+ reloadScheduled = FALSE;
+ [output reloadData];
+
+ if(messages.count == 0)
+ {
+ return;
+ }
+
+ NSUInteger path[] = {0, messages.count -1};
+ [output scrollToRowAtIndexPath:[NSIndexPath indexPathWithIndexes:path length:2]
+ atScrollPosition:UITableViewScrollPositionBottom
+ animated:NO];
+
+}
+
+#pragma mark <UITableViewDelegate, UITableViewDataSource> Methods
+
+-(NSInteger)numberOfSectionsInTableView:(UITableView *)tv
+{
+ return 1;
+}
+
+-(NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section
+{
+ return messages.count;
+}
+
+-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ if([messages count] <= indexPath.row)
+ {
+ return [MessageCell heightForMessage:@""];
+ }
+ return [MessageCell heightForMessage:[messages objectAtIndex:indexPath.row]];
+}
+
+-(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ MessageCell *cell = (MessageCell*)[output dequeueReusableCellWithIdentifier:@"MessageCell"];
+ if(cell == nil)
+ {
+ cell = [[[MessageCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MessageCell"] autorelease];
+ }
+ [cell setMessage:[messages objectAtIndex:indexPath.row]];
+ return cell;
+}
+
+-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
+{
+ return nil;
+}
+
+@end
+
+@implementation TestRun
+-(id) init:(TestCase*)t client:(NSString*)cl server:(NSString*)srv option:(TestConfigOption)opt
+{
+ self = [super init];
+ if(!self)
+ {
+ return nil;
+ }
+ self->test = t;
+ self->client = cl;
+ self->server = srv;
+ self->option = opt;
+ self->clientHelper = 0;
+ self->serverHelper = 0;
+ self->completed = 0;
+ self->error = 0;
+ self->running = 0;
+ self->collocated = NO;
+ return self;
+}
+
++(id) testRunCollocated:(TestCase*)test
+{
+ TestRun* r;
+ r = [[[TestRun alloc] init:test client:test.collocated server:nil option:TestConfigOptionDefault] autorelease];
+ r->collocated = YES;
+ return r;
+}
++(id) testRunClient:(TestCase*)test
+{
+ return [[[TestRun alloc] init:test client:test.client server:nil option:TestConfigOptionDefault] autorelease];
+}
++(id) testRunClientServer:(TestCase*)test
+{
+ return [[[TestRun alloc] init:test client:test.client server:test.server option:TestConfigOptionDefault] autorelease];
+}
++(id) testRunClientAMDServer:(TestCase*)test
+{
+ return [[[TestRun alloc] init:test client:test.client server:test.serveramd option:TestConfigOptionDefault] autorelease];
+}
++(id) testRunClientServerWithConfigOption:(TestCase*)test option:(TestConfigOption)option
+{
+ return [[[TestRun alloc] init:test client:test.client server:test.server option:option] autorelease];
+}
++(id) testRunClientAMDServerWithConfigOption:(TestCase*)test option:(TestConfigOption)option
+{
+ return [[[TestRun alloc] init:test client:test.client server:test.serveramd option:option] autorelease];
+}
+
+-(NSInvocationOperation*) runInvocation:(TestViewController*)ctl
+{
+ viewController = ctl;
+ return [[[NSInvocationOperation alloc] initWithTarget:self selector:@selector(run) object:nil] autorelease];
+}
+-(void)run
+{
+ AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+ if(appDelegate.runAll)
+ {
+ printf("\n*** running %s test %ld/%lu ...\n", [test.name UTF8String], (long)appDelegate.currentTest + 1,
+ (unsigned long)[appDelegate.tests count]);
+ printf("*** protocol: %s\n", [appDelegate.protocol UTF8String]);
+ fflush(stdout);
+ }
+ if(server)
+ {
+ [self runServer];
+ }
+ else
+ {
+ [self runClient];
+ }
+}
+-(void)add:(NSString*)s
+{
+ [viewController add:s];
+}
+
+-(void)clientComplete:(NSNumber*)rc
+{
+ if(clientHelper)
+ {
+ delete clientHelper;
+ clientHelper = 0;
+ }
+
+ if([rc intValue] != 0)
+ {
+ [viewController add:[NSString stringWithFormat:@"client error: %@!\n", rc]];
+ if(serverHelper)
+ {
+ serverHelper->shutdown();
+ }
+ ++error;
+ }
+
+ completed++;
+ if(!server || completed == 2)
+ {
+ [viewController testRunComplete:error == 0];
+ }
+}
+
+// Run in a separate thread.
+-(void)runClient
+{
+ AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+ running++;
+
+ std::string name = [[test name] UTF8String];
+ std::string prefix = std::string("test_") + [[test prefix] UTF8String];
+ std::string clt = [client UTF8String];
+
+ TestConfig config;
+ config.protocol = [[appDelegate protocol] UTF8String];
+ config.type = collocated ? TestConfigTypeColloc : TestConfigTypeClient;
+ config.option = option;
+ config.hasServer = [test hasServer];
+
+ clientHelper = new MainHelperI(name, prefix + "/" + clt, config, self, @selector(add:), @selector(serverReady));
+ clientHelper->run();
+ int rc = clientHelper->status();
+ [self performSelectorOnMainThread:@selector(clientComplete:) withObject:[NSNumber numberWithInt:rc] waitUntilDone:NO];
+}
+
+-(void)serverComplete:(NSNumber*)rc
+{
+ if(serverHelper)
+ {
+ delete serverHelper;
+ serverHelper = 0;
+ }
+
+ if([rc intValue] != 0)
+ {
+ [viewController add:[NSString stringWithFormat:@"server error: %@!\n", rc]];
+ ++error;
+ }
+ completed++;
+ if(completed == 2)
+ {
+ [viewController testRunComplete:error == 0];
+ }
+}
+
+// Run in a separate thread.
+-(void)runServer
+{
+ AppDelegate* appDelegate = (AppDelegate*)[[UIApplication sharedApplication] delegate];
+ running++;
+ std::string name = [[test name] UTF8String];
+ std::string prefix = std::string("test_") + [[test prefix] UTF8String];
+ std::string srv = [server UTF8String];
+
+ TestConfig config;
+ config.protocol = [[appDelegate protocol] UTF8String];
+ config.type = TestConfigTypeServer;
+ config.option = option;
+ config.hasServer = true;
+
+ serverHelper = new MainHelperI(name, prefix + "/" + srv, config, self, @selector(add:), @selector(serverReady));
+ serverHelper->run();
+ int rc = serverHelper->status();
+ [self performSelectorOnMainThread:@selector(serverComplete:) withObject:[NSNumber numberWithInt:rc] waitUntilDone:NO];
+}
+
+// Kick off the client.
+-(void)serverReady
+{
+ [[viewController queue] addOperation:[[[NSInvocationOperation alloc]
+ initWithTarget:self
+ selector:@selector(runClient)
+ object:nil] autorelease]];
+}
+
+@end
diff --git a/cpp/test/ios/Default-568h@2x.png b/cpp/test/ios/Default-568h@2x.png
new file mode 100644
index 00000000000..0891b7aabfc
--- /dev/null
+++ b/cpp/test/ios/Default-568h@2x.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/Contents.json b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 00000000000..93f4f1ff22c
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,80 @@
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "test_suite-Small@2x-1.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "test_suite-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "test_suite-Small-40@2x-1.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "test_suite-Small-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "test_suite-Small-40@3x-1.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "New icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "test_suite-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "test_suite-Small@2x-2.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "test_suite-Small-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "test_suite-Small-40@2x-2.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "test_suite-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "test_suite-76@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+} \ No newline at end of file
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/New icon-60@3x.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/New icon-60@3x.png
new file mode 100644
index 00000000000..a37f851e642
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/New icon-60@3x.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76.png
new file mode 100644
index 00000000000..2855a8b674b
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76@2x.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76@2x.png
new file mode 100644
index 00000000000..29047dc5a52
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-76@2x.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40.png
new file mode 100644
index 00000000000..e76086fb3d6
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-1.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-1.png
new file mode 100644
index 00000000000..7615d3255bc
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-1.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-2.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-2.png
new file mode 100644
index 00000000000..7615d3255bc
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@2x-2.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x-1.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x-1.png
new file mode 100644
index 00000000000..f04f442176a
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x-1.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x.png
new file mode 100644
index 00000000000..f04f442176a
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small-40@3x.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small.png
new file mode 100644
index 00000000000..d57695edc28
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-1.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-1.png
new file mode 100644
index 00000000000..79edc547e2c
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-1.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-2.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-2.png
new file mode 100644
index 00000000000..79edc547e2c
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@2x-2.png
Binary files differ
diff --git a/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@3x.png b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@3x.png
new file mode 100644
index 00000000000..49cdc033096
--- /dev/null
+++ b/cpp/test/ios/Images.xcassets/AppIcon.appiconset/test_suite-Small@3x.png
Binary files differ
diff --git a/cpp/test/ios/MainWindow-iPad.xib b/cpp/test/ios/MainWindow-iPad.xib
new file mode 100644
index 00000000000..1313995e567
--- /dev/null
+++ b/cpp/test/ios/MainWindow-iPad.xib
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIApplication">
+ <connections>
+ <outlet property="delegate" destination="3" id="4"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <customObject id="3" userLabel="container App Delegate" customClass="AppDelegate">
+ <connections>
+ <outlet property="navigationController" destination="17" id="21"/>
+ <outlet property="window" destination="12" id="14"/>
+ </connections>
+ </customObject>
+ <navigationController id="17">
+ <extendedEdge key="edgesForExtendedLayout"/>
+ <navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="19">
+ <autoresizingMask key="autoresizingMask"/>
+ <animations/>
+ </navigationBar>
+ <viewControllers>
+ <viewController nibName="TestSelect-iPad" id="18" customClass="TestSelectController">
+ <extendedEdge key="edgesForExtendedLayout"/>
+ <navigationItem key="navigationItem" title="Ice Test Suite" id="20"/>
+ </viewController>
+ </viewControllers>
+ <metadata/>
+ </navigationController>
+ <window opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="12">
+ <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ <metadata/>
+ </window>
+ </objects>
+</document>
diff --git a/cpp/test/ios/MainWindow.xib b/cpp/test/ios/MainWindow.xib
new file mode 100644
index 00000000000..c555914dca2
--- /dev/null
+++ b/cpp/test/ios/MainWindow.xib
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="UIApplication">
+ <connections>
+ <outlet property="delegate" destination="3" id="4"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <customObject id="3" userLabel="container App Delegate" customClass="AppDelegate">
+ <connections>
+ <outlet property="navigationController" destination="17" id="21"/>
+ <outlet property="window" destination="12" id="14"/>
+ </connections>
+ </customObject>
+ <navigationController id="17">
+ <extendedEdge key="edgesForExtendedLayout"/>
+ <navigationBar key="navigationBar" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="19">
+ <autoresizingMask key="autoresizingMask"/>
+ <animations/>
+ </navigationBar>
+ <viewControllers>
+ <viewController nibName="TestSelect" wantsFullScreenLayout="YES" id="18" customClass="TestSelectController">
+ <extendedEdge key="edgesForExtendedLayout"/>
+ <navigationItem key="navigationItem" title="Ice C++ Test Suite" id="20"/>
+ </viewController>
+ </viewControllers>
+ </navigationController>
+ <window opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="12">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ </window>
+ </objects>
+</document>
diff --git a/cpp/test/ios/README.md b/cpp/test/ios/README.md
new file mode 100644
index 00000000000..32aa3ae9232
--- /dev/null
+++ b/cpp/test/ios/README.md
@@ -0,0 +1,6 @@
+This project builds the IceTouch C++ Test Suite application for running tests with the
+iOS simulator or on an iOS device.
+
+You should use the "IceTouch C++ Test Suite iOS 7" target if you plan to run the tests on
+an iOS 7.x device, use the "IceTouch C++ Test Suite" target otherwise. Bundles are not signed
+with the iOS 7 target (iOS 7.x doesn't support loading signed bundles).
diff --git a/cpp/test/ios/TestSelect-iPad.xib b/cpp/test/ios/TestSelect-iPad.xib
new file mode 100644
index 00000000000..77817e380d6
--- /dev/null
+++ b/cpp/test/ios/TestSelect-iPad.xib
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TestSelectController">
+ <connections>
+ <outlet property="loopSwitch" destination="13" id="15"/>
+ <outlet property="pickerView" destination="3" id="9"/>
+ <outlet property="protocol" destination="18" id="19"/>
+ <outlet property="view" destination="1" id="8"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="1">
+ <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <pickerView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="3">
+ <rect key="frame" x="20" y="20" width="728" height="216"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <connections>
+ <outlet property="dataSource" destination="-1" id="5"/>
+ <outlet property="delegate" destination="-1" id="6"/>
+ </connections>
+ </pickerView>
+ <button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="4">
+ <rect key="frame" x="326" y="373" width="117" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
+ <state key="normal" title="Execute Test">
+ <color key="titleShadowColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="disabled" title="Execute Test"/>
+ <state key="selected" title="Execute Test"/>
+ <state key="highlighted" title="Execute Test">
+ <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
+ <connections>
+ <action selector="runTest:" destination="-1" eventType="touchUpInside" id="7"/>
+ </connections>
+ </button>
+ <switch opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="13">
+ <rect key="frame" x="381" y="321" width="51" height="31"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ </switch>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Loop" lineBreakMode="tailTruncation" minimumFontSize="10" id="14">
+ <rect key="frame" x="310" y="324" width="42" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" id="18">
+ <rect key="frame" x="279" y="256" width="210" height="29"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <segments>
+ <segment title="TCP"/>
+ <segment title="SSL"/>
+ <segment title="WS"/>
+ <segment title="WSS"/>
+ </segments>
+ </segmentedControl>
+ </subviews>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <nil key="simulatedStatusBarMetrics"/>
+ </view>
+ </objects>
+</document>
diff --git a/cpp/test/ios/TestSelect.xib b/cpp/test/ios/TestSelect.xib
new file mode 100644
index 00000000000..1db89250692
--- /dev/null
+++ b/cpp/test/ios/TestSelect.xib
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TestSelectController">
+ <connections>
+ <outlet property="loopSwitch" destination="13" id="15"/>
+ <outlet property="pickerView" destination="3" id="9"/>
+ <outlet property="protocol" destination="16" id="18"/>
+ <outlet property="view" destination="1" id="19"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view contentMode="scaleToFill" id="1">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <pickerView opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" id="3">
+ <rect key="frame" x="-1" y="0.0" width="320" height="216"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <connections>
+ <outlet property="dataSource" destination="-1" id="5"/>
+ <outlet property="delegate" destination="-1" id="6"/>
+ </connections>
+ </pickerView>
+ <button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="4">
+ <rect key="frame" x="100" y="368" width="117" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
+ <state key="normal" title="Execute Test">
+ <color key="titleShadowColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="disabled" title="Execute Test"/>
+ <state key="selected" title="Execute Test"/>
+ <state key="highlighted" title="Execute Test">
+ <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
+ <connections>
+ <action selector="runTest:" destination="-1" eventType="touchUpInside" id="7"/>
+ </connections>
+ </button>
+ <switch opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" id="13">
+ <rect key="frame" x="154" y="293" width="51" height="31"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ </switch>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Loop" lineBreakMode="tailTruncation" minimumFontSize="10" id="14">
+ <rect key="frame" x="83" y="296" width="42" height="21"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <fontDescription key="fontDescription" type="system" pointSize="17"/>
+ <color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" id="16">
+ <rect key="frame" x="53" y="233" width="210" height="29"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <animations/>
+ <segments>
+ <segment title="TCP"/>
+ <segment title="SSL"/>
+ <segment title="WS"/>
+ <segment title="WSS"/>
+ </segments>
+ </segmentedControl>
+ </subviews>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <nil key="simulatedStatusBarMetrics"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ </view>
+ </objects>
+</document>
diff --git a/cpp/test/ios/TestView-iPad.xib b/cpp/test/ios/TestView-iPad.xib
new file mode 100644
index 00000000000..309191a0c2a
--- /dev/null
+++ b/cpp/test/ios/TestView-iPad.xib
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.iPad.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch.iPad" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TestViewController">
+ <connections>
+ <outlet property="activity" destination="16" id="18"/>
+ <outlet property="nextButton" destination="17" id="20"/>
+ <outlet property="output" destination="9" id="12"/>
+ <outlet property="view" destination="6" id="8"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="6">
+ <rect key="frame" x="0.0" y="0.0" width="768" height="1024"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="27" sectionFooterHeight="27" id="9">
+ <rect key="frame" x="20" y="20" width="728" height="939"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <outlet property="dataSource" destination="-1" id="10"/>
+ <outlet property="delegate" destination="-1" id="11"/>
+ </connections>
+ </tableView>
+ <activityIndicatorView hidden="YES" opaque="NO" clearsContextBeforeDrawing="NO" userInteractionEnabled="NO" contentMode="scaleToFill" hidesWhenStopped="YES" style="whiteLarge" id="16">
+ <rect key="frame" x="246" y="967" width="37" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <animations/>
+ </activityIndicatorView>
+ <button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="17">
+ <rect key="frame" x="20" y="967" width="214" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <animations/>
+ <fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
+ <state key="normal" title="Launch Next Test">
+ <color key="titleShadowColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="disabled" title="Launch Next Test"/>
+ <state key="selected" title="Launch Next Test"/>
+ <state key="highlighted" title="Launch Next Test">
+ <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
+ <connections>
+ <action selector="next:" destination="-1" eventType="touchUpInside" id="21"/>
+ </connections>
+ </button>
+ </subviews>
+ <animations/>
+ <color key="backgroundColor" white="0.75" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <simulatedStatusBarMetrics key="simulatedStatusBarMetrics" statusBarStyle="blackOpaque"/>
+ </view>
+ </objects>
+</document>
diff --git a/cpp/test/ios/TestView.xib b/cpp/test/ios/TestView.xib
new file mode 100644
index 00000000000..affe669bf13
--- /dev/null
+++ b/cpp/test/ios/TestView.xib
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9060" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
+ </dependencies>
+ <objects>
+ <placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="TestViewController">
+ <connections>
+ <outlet property="activity" destination="16" id="18"/>
+ <outlet property="nextButton" destination="17" id="20"/>
+ <outlet property="output" destination="9" id="12"/>
+ <outlet property="view" destination="6" id="8"/>
+ </connections>
+ </placeholder>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
+ <view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="6">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="460"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <tableView opaque="NO" clipsSubviews="YES" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" bouncesZoom="NO" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="27" sectionFooterHeight="27" id="9">
+ <rect key="frame" x="0.0" y="0.0" width="320" height="395"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <outlet property="dataSource" destination="-1" id="10"/>
+ <outlet property="delegate" destination="-1" id="11"/>
+ </connections>
+ </tableView>
+ <activityIndicatorView hidden="YES" opaque="NO" clearsContextBeforeDrawing="NO" userInteractionEnabled="NO" contentMode="scaleToFill" hidesWhenStopped="YES" style="whiteLarge" id="16">
+ <rect key="frame" x="242" y="408" width="37" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <animations/>
+ </activityIndicatorView>
+ <button opaque="NO" clearsContextBeforeDrawing="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" id="17">
+ <rect key="frame" x="20" y="409" width="214" height="37"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <animations/>
+ <fontDescription key="fontDescription" name="Helvetica-Bold" family="Helvetica" pointSize="15"/>
+ <state key="normal" title="Launch Next Test">
+ <color key="titleShadowColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <state key="disabled" title="Launch Next Test"/>
+ <state key="selected" title="Launch Next Test"/>
+ <state key="highlighted" title="Launch Next Test">
+ <color key="titleColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </state>
+ <connections>
+ <action selector="next:" destination="-1" eventType="touchUpInside" id="21"/>
+ </connections>
+ </button>
+ </subviews>
+ <animations/>
+ <color key="backgroundColor" white="0.75" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <freeformSimulatedSizeMetrics key="simulatedDestinationMetrics"/>
+ </view>
+ </objects>
+</document>
diff --git a/cpp/test/ios/dummy.ice b/cpp/test/ios/dummy.ice
new file mode 100644
index 00000000000..7f9b5ae69a3
--- /dev/null
+++ b/cpp/test/ios/dummy.ice
@@ -0,0 +1,3 @@
+//
+// Dummy Slice file to enable Slice Xcode Plug-in
+// \ No newline at end of file
diff --git a/cpp/test/ios/main.m b/cpp/test/ios/main.m
new file mode 100644
index 00000000000..d42c12f7206
--- /dev/null
+++ b/cpp/test/ios/main.m
@@ -0,0 +1,17 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2016 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice Touch is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#import <UIKit/UIKit.h>
+
+int main(int argc, char *argv[]) {
+ NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
+ int retVal = UIApplicationMain(argc, argv, nil, nil);
+ [pool release];
+ return retVal;
+}