summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/LocatorInfo.cpp52
-rw-r--r--cpp/src/Ice/LocatorInfo.h2
-rw-r--r--cpp/src/Ice/Network.cpp216
-rw-r--r--cpp/src/Ice/PropertyNames.cpp113
-rw-r--r--cpp/src/Ice/PropertyNames.h3
-rw-r--r--cpp/src/IceDiscovery/.depend5
-rw-r--r--cpp/src/IceDiscovery/.depend.mak5
-rw-r--r--cpp/src/IceDiscovery/.gitignore5
-rwxr-xr-xcpp/src/IceDiscovery/IceDiscovery.rc38
-rw-r--r--cpp/src/IceDiscovery/LocatorI.cpp208
-rw-r--r--cpp/src/IceDiscovery/LocatorI.h76
-rw-r--r--cpp/src/IceDiscovery/LookupI.cpp303
-rw-r--r--cpp/src/IceDiscovery/LookupI.h181
-rw-r--r--cpp/src/IceDiscovery/Makefile59
-rw-r--r--cpp/src/IceDiscovery/Makefile.mak68
-rw-r--r--cpp/src/IceDiscovery/PluginI.cpp146
-rw-r--r--cpp/src/IceDiscovery/PluginI.h35
-rw-r--r--cpp/src/Makefile1
-rw-r--r--cpp/src/Makefile.mak1
19 files changed, 1421 insertions, 96 deletions
diff --git a/cpp/src/Ice/LocatorInfo.cpp b/cpp/src/Ice/LocatorInfo.cpp
index 9493f5a220d..26ab0a30577 100644
--- a/cpp/src/Ice/LocatorInfo.cpp
+++ b/cpp/src/Ice/LocatorInfo.cpp
@@ -40,22 +40,15 @@ public:
assert(ref->isWellKnown());
}
- virtual void send(bool async)
+ virtual void send()
{
try
{
- if(async)
- {
- _locatorInfo->getLocator()->begin_findObjectById(
- _ref->getIdentity(),
- newCallback_Locator_findObjectById(static_cast<LocatorInfo::Request*>(this),
- &LocatorInfo::Request::response,
- &LocatorInfo::Request::exception));
- }
- else
- {
- response(_locatorInfo->getLocator()->findObjectById(_ref->getIdentity()));
- }
+ _locatorInfo->getLocator()->begin_findObjectById(
+ _ref->getIdentity(),
+ newCallback_Locator_findObjectById(static_cast<LocatorInfo::Request*>(this),
+ &LocatorInfo::Request::response,
+ &LocatorInfo::Request::exception));
}
catch(const Ice::Exception& ex)
{
@@ -73,22 +66,15 @@ public:
assert(ref->isIndirect() && !ref->isWellKnown());
}
- virtual void send(bool async)
+ virtual void send()
{
try
{
- if(async)
- {
- _locatorInfo->getLocator()->begin_findAdapterById(
- _ref->getAdapterId(),
- newCallback_Locator_findAdapterById(static_cast<LocatorInfo::Request*>(this),
- &LocatorInfo::Request::response,
- &LocatorInfo::Request::exception));
- }
- else
- {
- response(_locatorInfo->getLocator()->findAdapterById(_ref->getAdapterId()));
- }
+ _locatorInfo->getLocator()->begin_findAdapterById(
+ _ref->getAdapterId(),
+ newCallback_Locator_findAdapterById(static_cast<LocatorInfo::Request*>(this),
+ &LocatorInfo::Request::response,
+ &LocatorInfo::Request::exception));
}
catch(const Ice::Exception& ex)
{
@@ -406,7 +392,7 @@ IceInternal::LocatorInfo::Request::addCallback(const ReferencePtr& ref,
{
_sent = true;
sync.release();
- send(true); // send() might call exception() from this thread so we need to release the mutex.
+ send(); // send() might call exception() from this thread so we need to release the mutex.
}
}
}
@@ -428,7 +414,7 @@ IceInternal::LocatorInfo::Request::getEndpoints(const ReferencePtr& ref,
{
_sent = true;
sync.release();
- send(true); // send() might call exception() from this thread so we need to release the mutex.
+ send(); // send() might call exception() from this thread so we need to release the mutex.
sync.acquire();
}
@@ -493,12 +479,6 @@ IceInternal::LocatorInfo::Request::response(const Ice::ObjectPrx& proxy)
void
IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex)
{
- if(dynamic_cast<const Ice::CollocationOptimizationException*>(&ex))
- {
- send(false); // Use synchronous collocation optimized locator request instead.
- return;
- }
-
IceUtil::Monitor<IceUtil::Mutex>::Lock sync(_monitor);
_locatorInfo->finishRequest(_ref, _wellKnownRefs, 0, dynamic_cast<const Ice::UserException*>(&ex));
_exception.reset(ex.ice_clone());
@@ -510,7 +490,7 @@ IceInternal::LocatorInfo::Request::exception(const Ice::Exception& ex)
}
IceInternal::LocatorInfo::LocatorInfo(const LocatorPrx& locator, const LocatorTablePtr& table, bool background) :
- _locator(locator),
+ _locator(locator->ice_collocationOptimized(false)),
_table(table),
_background(background)
{
@@ -559,7 +539,7 @@ IceInternal::LocatorInfo::getLocatorRegistry()
//
// Do not make locator calls from within sync.
//
- LocatorRegistryPrx locatorRegistry = _locator->getRegistry();
+ LocatorRegistryPrx locatorRegistry = _locator->getRegistry()->ice_collocationOptimized(false);
{
IceUtil::Mutex::Lock sync(*this);
diff --git a/cpp/src/Ice/LocatorInfo.h b/cpp/src/Ice/LocatorInfo.h
index 2fc3576a26d..8515d40faf7 100644
--- a/cpp/src/Ice/LocatorInfo.h
+++ b/cpp/src/Ice/LocatorInfo.h
@@ -119,7 +119,7 @@ public:
Request(const LocatorInfoPtr&, const ReferencePtr&);
- virtual void send(bool) = 0;
+ virtual void send() = 0;
const LocatorInfoPtr _locatorInfo;
const ReferencePtr _ref;
diff --git a/cpp/src/Ice/Network.cpp b/cpp/src/Ice/Network.cpp
index ee614433586..9f7aae2debd 100644
--- a/cpp/src/Ice/Network.cpp
+++ b/cpp/src/Ice/Network.cpp
@@ -457,7 +457,29 @@ isWildcard(const string& host, ProtocolSupport protocol)
int
getInterfaceIndex(const string& name)
{
+ if(name.empty())
+ {
+ return 0;
+ }
+
int index = 0;
+
+ //
+ // First check if index
+ //
+ istringstream p(name);
+ if((p >> index) && p.eof())
+ {
+ return index;
+ }
+
+ //
+ // Then check if it's an IPv6 address. If it's an address we'll
+ // look for the interface index by address.
+ //
+ in6_addr addr;
+ bool isAddr = inet_pton(AF_INET6, name.c_str(), &addr) > 0;
+
#ifdef _WIN32
IP_ADAPTER_ADDRESSES addrs;
ULONG buflen = 0;
@@ -470,10 +492,35 @@ getInterfaceIndex(const string& name)
{
while(paddrs)
{
- if(IceUtil::wstringToString(paddrs->FriendlyName) == name)
+ if(isAddr)
{
- index = paddrs->Ipv6IfIndex;
- break;
+ PIP_ADAPTER_UNICAST_ADDRESS ipAddr = paddrs->FirstUnicastAddress;
+ while(ipAddr)
+ {
+ if(ipAddr->Address.lpSockaddr->sa_family == AF_INET6)
+ {
+ struct sockaddr_in6* ipv6Addr =
+ reinterpret_cast<struct sockaddr_in6*>(ipAddr->Address.lpSockaddr);
+ if(memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
+ {
+ break;
+ }
+ }
+ ipAddr = ipAddr->Next;
+ }
+ if(ipAddr)
+ {
+ index = paddrs->Ipv6IfIndex;
+ break;
+ }
+ }
+ else
+ {
+ if(IceUtil::wstringToString(paddrs->FriendlyName) == name)
+ {
+ index = paddrs->Ipv6IfIndex;
+ break;
+ }
}
paddrs = paddrs->Next;
}
@@ -481,8 +528,104 @@ getInterfaceIndex(const string& name)
delete[] buf;
}
#elif !defined(__hpux)
- index = if_nametoindex(name.c_str());
+
+ //
+ // Look for an interface with a matching IP address
+ //
+ if(isAddr)
+ {
+#if defined(__linux) || defined(__APPLE__) || defined(__FreeBSD__)
+ struct ifaddrs* ifap;
+ if(::getifaddrs(&ifap) != SOCKET_ERROR)
+ {
+ struct ifaddrs* curr = ifap;
+ while(curr != 0)
+ {
+ if(curr->ifa_addr && curr->ifa_addr->sa_family == AF_INET6)
+ {
+ struct sockaddr_in6* ipv6Addr = reinterpret_cast<struct sockaddr_in6*>(curr->ifa_addr);
+ if(memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
+ {
+ index = if_nametoindex(curr->ifa_name);
+ break;
+ }
+ }
+ curr = curr->ifa_next;
+ }
+ ::freeifaddrs(ifap);
+ }
+#else
+ SOCKET fd = createSocketImpl(false, AF_INET6);
+#ifdef _AIX
+ int cmd = CSIOCGIFCONF;
+#else
+ int cmd = SIOCGIFCONF;
#endif
+ struct ifconf ifc;
+ int numaddrs = 10;
+ int old_ifc_len = 0;
+
+ //
+ // Need to call ioctl multiple times since we do not know up front
+ // how many addresses there will be, and thus how large a buffer we need.
+ // We keep increasing the buffer size until subsequent calls return
+ // the same length, meaning we have all the addresses.
+ //
+ while(true)
+ {
+ int bufsize = numaddrs * static_cast<int>(sizeof(struct ifreq));
+ ifc.ifc_len = bufsize;
+ ifc.ifc_buf = (char*)malloc(bufsize);
+
+ int rs = ioctl(fd, cmd, &ifc);
+ if(rs == SOCKET_ERROR)
+ {
+ free(ifc.ifc_buf);
+ ifc.ifc_buf = 0;
+ break;
+ }
+ else if(ifc.ifc_len == old_ifc_len)
+ {
+ //
+ // Returned same length twice in a row, finished.
+ //
+ break;
+ }
+ else
+ {
+ old_ifc_len = ifc.ifc_len;
+ }
+ numaddrs += 10;
+ free(ifc.ifc_buf);
+ }
+ closeSocketNoThrow(fd);
+
+ if(ifc.ifc_buf)
+ {
+ numaddrs = ifc.ifc_len / static_cast<int>(sizeof(struct ifreq));
+ struct ifreq* ifr = ifc.ifc_req;
+ for(int i = 0; i < numaddrs; ++i)
+ {
+ if(ifr[i].ifr_addr.sa_family == AF_INET6)
+ {
+ struct sockaddr_in6* ipv6Addr = reinterpret_cast<struct sockaddr_in6*>(&ifr[i].ifr_addr);
+ if(memcmp(&addr, &ipv6Addr->sin6_addr, sizeof(in6_addr)) == 0)
+ {
+ index = if_nametoindex(ifr[i].ifr_name);
+ break;
+ }
+ }
+ }
+ free(ifc.ifc_buf);
+ }
+#endif
+ }
+ else // Look for an interface with the given name.
+ {
+ index = if_nametoindex(name.c_str());
+ }
+#endif
+
return index;
}
@@ -491,6 +634,16 @@ getInterfaceAddress(const string& name)
{
struct in_addr addr;
addr.s_addr = INADDR_ANY;
+ if(name.empty())
+ {
+ return addr;
+ }
+
+ if(inet_pton(AF_INET, name.c_str(), &addr) > 0)
+ {
+ return addr;
+ }
+
#ifdef _WIN32
IP_ADAPTER_ADDRESSES addrs;
ULONG buflen = 0;
@@ -1656,44 +1809,14 @@ IceInternal::setMcastGroup(SOCKET fd, const Address& group, const string& intf)
{
struct ip_mreq mreq;
mreq.imr_multiaddr = group.saIn.sin_addr;
- mreq.imr_interface.s_addr = INADDR_ANY;
- if(intf.size() > 0)
- {
- //
- // First see if it is the interface name. If not check if IP Address.
- //
- mreq.imr_interface = getInterfaceAddress(intf);
- if(mreq.imr_interface.s_addr == INADDR_ANY)
- {
- Address addr = getAddressForServer(intf, 0, EnableIPv4, false);
- mreq.imr_interface = addr.saIn.sin_addr;
- }
- }
+ mreq.imr_interface = getInterfaceAddress(intf);
rc = setsockopt(fd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char*)&mreq, int(sizeof(mreq)));
}
else
{
struct ipv6_mreq mreq;
mreq.ipv6mr_multiaddr = group.saIn6.sin6_addr;
- mreq.ipv6mr_interface = 0;
- if(intf.size() != 0)
- {
- //
- // First check if it is the interface name. If not check if index.
- //
- mreq.ipv6mr_interface = getInterfaceIndex(intf);
- if(mreq.ipv6mr_interface == 0)
- {
- istringstream p(intf);
- if(!(p >> mreq.ipv6mr_interface) || !p.eof())
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = 0;
- throw ex;
- }
- }
- }
+ mreq.ipv6mr_interface = getInterfaceIndex(intf);
rc = setsockopt(fd, IPPROTO_IPV6, IPV6_JOIN_GROUP, (char*)&mreq, int(sizeof(mreq)));
}
if(rc == SOCKET_ERROR)
@@ -1734,33 +1857,12 @@ IceInternal::setMcastInterface(SOCKET fd, const string& intf, const Address& add
int rc;
if(addr.saStorage.ss_family == AF_INET)
{
- //
- // First see if it is the interface name. If not check if IP Address.
- //
struct in_addr iface = getInterfaceAddress(intf);
- if(iface.s_addr == INADDR_ANY)
- {
- Address addr = getAddressForServer(intf, 0, EnableIPv4, false);
- iface = addr.saIn.sin_addr;
- }
rc = setsockopt(fd, IPPROTO_IP, IP_MULTICAST_IF, (char*)&iface, int(sizeof(iface)));
}
else
{
- //
- // First check if it is the interface name. If not check if index.
- //
int interfaceNum = getInterfaceIndex(intf);
- if(interfaceNum == 0)
- {
- istringstream p(intf);
- if(!(p >> interfaceNum) || !p.eof())
- {
- closeSocketNoThrow(fd);
- SocketException ex(__FILE__, __LINE__);
- ex.error = 0;
- }
- }
rc = setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_IF, (char*)&interfaceNum, int(sizeof(int)));
}
if(rc == SOCKET_ERROR)
diff --git a/cpp/src/Ice/PropertyNames.cpp b/cpp/src/Ice/PropertyNames.cpp
index 60fd316030c..fbfdb94d092 100644
--- a/cpp/src/Ice/PropertyNames.cpp
+++ b/cpp/src/Ice/PropertyNames.cpp
@@ -8,7 +8,7 @@
// **********************************************************************
///* jshint -W044*/
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Apr 7 14:21:14 2014
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Apr 22 17:39:32 2014
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -177,6 +177,115 @@ const IceInternal::PropertyArray
IceInternal::PropertyNames::IceMXProps(IceMXPropsData,
sizeof(IceMXPropsData)/sizeof(IceMXPropsData[0]));
+const IceInternal::Property IceDiscoveryPropsData[] =
+{
+ IceInternal::Property("IceDiscovery.Multicast.ACM", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.AdapterId", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Endpoints", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.EndpointSelection", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.ConnectionCached", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.PreferSecure", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.LocatorCacheTimeout", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.CollocationOptimized", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator.Context.*", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.PublishedEndpoints", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ReplicaGroupId", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.EndpointSelection", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.ConnectionCached", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.PreferSecure", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.LocatorCacheTimeout", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.CollocationOptimized", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router.Context.*", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ProxyOptions", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.Size", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.SizeMax", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.SizeWarn", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.StackSize", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.Serialize", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.ThreadIdleTime", false, 0),
+ IceInternal::Property("IceDiscovery.Multicast.ThreadPool.ThreadPriority", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ACM", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.AdapterId", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Endpoints", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.EndpointSelection", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.ConnectionCached", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.PreferSecure", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.LocatorCacheTimeout", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.CollocationOptimized", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator.Context.*", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.PublishedEndpoints", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ReplicaGroupId", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.EndpointSelection", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.ConnectionCached", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.PreferSecure", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.LocatorCacheTimeout", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.CollocationOptimized", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router.Context.*", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ProxyOptions", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.Size", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.SizeMax", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.SizeWarn", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.StackSize", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.Serialize", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.ThreadIdleTime", false, 0),
+ IceInternal::Property("IceDiscovery.Reply.ThreadPool.ThreadPriority", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ACM", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.AdapterId", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Endpoints", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.EndpointSelection", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.ConnectionCached", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.PreferSecure", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.LocatorCacheTimeout", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.CollocationOptimized", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator.Context.*", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.PublishedEndpoints", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ReplicaGroupId", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.EndpointSelection", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.ConnectionCached", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.PreferSecure", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.LocatorCacheTimeout", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.Locator", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.CollocationOptimized", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router.Context.*", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.Router", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ProxyOptions", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.Size", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.SizeMax", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.SizeWarn", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.StackSize", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.Serialize", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.ThreadIdleTime", false, 0),
+ IceInternal::Property("IceDiscovery.Locator.ThreadPool.ThreadPriority", false, 0),
+ IceInternal::Property("IceDiscovery.Lookup", false, 0),
+ IceInternal::Property("IceDiscovery.Timeout", false, 0),
+ IceInternal::Property("IceDiscovery.RetryCount", false, 0),
+ IceInternal::Property("IceDiscovery.LatencyMultiplier", false, 0),
+ IceInternal::Property("IceDiscovery.Address", false, 0),
+ IceInternal::Property("IceDiscovery.Port", false, 0),
+ IceInternal::Property("IceDiscovery.Interface", false, 0),
+ IceInternal::Property("IceDiscovery.DomainId", false, 0),
+};
+
+const IceInternal::PropertyArray
+ IceInternal::PropertyNames::IceDiscoveryProps(IceDiscoveryPropsData,
+ sizeof(IceDiscoveryPropsData)/sizeof(IceDiscoveryPropsData[0]));
+
const IceInternal::Property IceBoxPropsData[] =
{
IceInternal::Property("IceBox.InheritProperties", false, 0),
@@ -860,6 +969,7 @@ const IceInternal::PropertyArray IceInternal::PropertyNames::validProps[] =
{
IceProps,
IceMXProps,
+ IceDiscoveryProps,
IceBoxProps,
IceBoxAdminProps,
IceGridAdminProps,
@@ -878,6 +988,7 @@ const char* IceInternal::PropertyNames::clPropNames[] =
{
"Ice",
"IceMX",
+ "IceDiscovery",
"IceBox",
"IceBoxAdmin",
"IceGridAdmin",
diff --git a/cpp/src/Ice/PropertyNames.h b/cpp/src/Ice/PropertyNames.h
index d395f08f9a4..64a7655b887 100644
--- a/cpp/src/Ice/PropertyNames.h
+++ b/cpp/src/Ice/PropertyNames.h
@@ -8,7 +8,7 @@
// **********************************************************************
///* jshint -W044*/
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Apr 7 14:21:14 2014
+// Generated by makeprops.py from file ./config/PropertyNames.xml, Tue Apr 22 17:39:32 2014
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -60,6 +60,7 @@ public:
static const PropertyArray IceProps;
static const PropertyArray IceMXProps;
+ static const PropertyArray IceDiscoveryProps;
static const PropertyArray IceBoxProps;
static const PropertyArray IceBoxAdminProps;
static const PropertyArray IceGridAdminProps;
diff --git a/cpp/src/IceDiscovery/.depend b/cpp/src/IceDiscovery/.depend
new file mode 100644
index 00000000000..abd97f5ac3b
--- /dev/null
+++ b/cpp/src/IceDiscovery/.depend
@@ -0,0 +1,5 @@
+LocatorI$(OBJEXT): LocatorI.cpp ../IceDiscovery/LocatorI.h $(includedir)/Ice/Locator.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h ../IceDiscovery/LookupI.h ../IceDiscovery/Internal.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h
+LookupI$(OBJEXT): LookupI.cpp $(includedir)/Ice/Connection.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/Properties.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/LocalException.h ../IceDiscovery/LookupI.h ../IceDiscovery/Internal.h ../IceDiscovery/LocatorI.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h
+IceDiscovery$(OBJEXT): IceDiscovery.cpp ../IceDiscovery/IceDiscovery.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/Direct.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/Ice/ObjectFactory.h $(includedir)/IceUtil/DisableWarnings.h
+PluginI$(OBJEXT): PluginI.cpp $(includedir)/Ice/Ice.h $(includedir)/IceUtil/Config.h $(includedir)/Ice/Initialize.h $(includedir)/Ice/CommunicatorF.h $(includedir)/Ice/ProxyF.h $(includedir)/IceUtil/Shared.h $(includedir)/Ice/Config.h $(includedir)/Ice/ProxyHandle.h $(includedir)/IceUtil/Handle.h $(includedir)/IceUtil/Exception.h $(includedir)/Ice/ObjectF.h $(includedir)/Ice/Handle.h $(includedir)/Ice/Exception.h $(includedir)/Ice/Format.h $(includedir)/Ice/StreamF.h $(includedir)/Ice/LocalObject.h $(includedir)/Ice/LocalObjectF.h $(includedir)/Ice/StreamHelpers.h $(includedir)/IceUtil/ScopedArray.h $(includedir)/IceUtil/Iterator.h $(includedir)/IceUtil/Optional.h $(includedir)/Ice/UndefSysMacros.h $(includedir)/Ice/PropertiesF.h $(includedir)/Ice/Proxy.h $(includedir)/IceUtil/Mutex.h $(includedir)/IceUtil/Lock.h $(includedir)/IceUtil/ThreadException.h $(includedir)/IceUtil/Time.h $(includedir)/IceUtil/MutexProtocol.h $(includedir)/Ice/ProxyFactoryF.h $(includedir)/Ice/ConnectionIF.h $(includedir)/Ice/RequestHandlerF.h $(includedir)/Ice/EndpointIF.h $(includedir)/Ice/EndpointF.h $(includedir)/Ice/EndpointTypes.h $(includedir)/Ice/ObjectAdapterF.h $(includedir)/Ice/ReferenceF.h $(includedir)/Ice/OutgoingAsync.h $(includedir)/IceUtil/Monitor.h $(includedir)/IceUtil/Cond.h $(includedir)/IceUtil/Timer.h $(includedir)/IceUtil/Thread.h $(includedir)/IceUtil/UniquePtr.h $(includedir)/Ice/OutgoingAsyncF.h $(includedir)/Ice/InstanceF.h $(includedir)/Ice/Current.h $(includedir)/Ice/ConnectionF.h $(includedir)/Ice/Identity.h $(includedir)/Ice/Version.h $(includedir)/Ice/BasicStream.h $(includedir)/Ice/Object.h $(includedir)/Ice/GCShared.h $(includedir)/Ice/GCCountMap.h $(includedir)/Ice/IncomingAsyncF.h $(includedir)/Ice/ObjectFactoryF.h $(includedir)/Ice/ObjectFactoryManagerF.h $(includedir)/Ice/Buffer.h $(includedir)/Ice/Protocol.h $(includedir)/Ice/SlicedDataF.h $(includedir)/Ice/UserExceptionFactory.h $(includedir)/Ice/FactoryTable.h $(includedir)/Ice/ObserverHelper.h $(includedir)/Ice/Instrumentation.h $(includedir)/Ice/LoggerF.h $(includedir)/Ice/StatsF.h $(includedir)/Ice/InstrumentationF.h $(includedir)/Ice/Dispatcher.h $(includedir)/Ice/StringConverter.h $(includedir)/Ice/Plugin.h $(includedir)/Ice/BuiltinSequences.h $(includedir)/IceUtil/Unicode.h $(includedir)/Ice/LocalException.h $(includedir)/Ice/PropertiesAdmin.h $(includedir)/Ice/Outgoing.h $(includedir)/Ice/Incoming.h $(includedir)/Ice/ServantLocatorF.h $(includedir)/Ice/ServantManagerF.h $(includedir)/Ice/IncomingAsync.h $(includedir)/Ice/Direct.h $(includedir)/Ice/Properties.h $(includedir)/Ice/Logger.h $(includedir)/Ice/LoggerUtil.h $(includedir)/Ice/Stats.h $(includedir)/Ice/Communicator.h $(includedir)/Ice/RouterF.h $(includedir)/Ice/LocatorF.h $(includedir)/Ice/PluginF.h $(includedir)/Ice/ImplicitContextF.h $(includedir)/Ice/CommunicatorAsync.h $(includedir)/Ice/ObjectFactory.h $(includedir)/Ice/ObjectAdapter.h $(includedir)/Ice/FacetMap.h $(includedir)/Ice/Endpoint.h $(includedir)/Ice/ServantLocator.h $(includedir)/Ice/SlicedData.h $(includedir)/Ice/Process.h $(includedir)/Ice/Application.h $(includedir)/Ice/Connection.h $(includedir)/Ice/ConnectionAsync.h $(includedir)/Ice/Functional.h $(includedir)/IceUtil/Functional.h $(includedir)/Ice/Stream.h $(includedir)/Ice/ImplicitContext.h $(includedir)/Ice/Locator.h $(includedir)/Ice/FactoryTableInit.h $(includedir)/Ice/ProcessF.h $(includedir)/Ice/Router.h $(includedir)/Ice/DispatchInterceptor.h $(includedir)/Ice/NativePropertiesAdmin.h $(includedir)/Ice/Metrics.h $(includedir)/Ice/Service.h $(includedir)/Ice/IconvStringConverter.h ../IceDiscovery/PluginI.h ../IceDiscovery/LocatorI.h ../IceDiscovery/LookupI.h ../IceDiscovery/Internal.h
+IceDiscovery.h IceDiscovery.cpp: $(slicedir)/IceDiscovery/IceDiscovery.ice $(slicedir)/Ice/Identity.ice $(SLICE2CPP) $(SLICEPARSERLIB)
diff --git a/cpp/src/IceDiscovery/.depend.mak b/cpp/src/IceDiscovery/.depend.mak
new file mode 100644
index 00000000000..bfee476e4be
--- /dev/null
+++ b/cpp/src/IceDiscovery/.depend.mak
@@ -0,0 +1,5 @@
+LocatorI$(OBJEXT): LocatorI.cpp ../IceDiscovery/LocatorI.h "$(includedir)/Ice/Locator.h" "$(includedir)/Ice/ProxyF.h" "$(includedir)/IceUtil/Shared.h" "$(includedir)/IceUtil/Config.h" "$(includedir)/Ice/Config.h" "$(includedir)/Ice/ProxyHandle.h" "$(includedir)/IceUtil/Handle.h" "$(includedir)/IceUtil/Exception.h" "$(includedir)/Ice/ObjectF.h" "$(includedir)/Ice/Handle.h" "$(includedir)/Ice/Exception.h" "$(includedir)/Ice/Format.h" "$(includedir)/Ice/StreamF.h" "$(includedir)/Ice/LocalObject.h" "$(includedir)/Ice/LocalObjectF.h" "$(includedir)/Ice/StreamHelpers.h" "$(includedir)/IceUtil/ScopedArray.h" "$(includedir)/IceUtil/Iterator.h" "$(includedir)/Ice/Proxy.h" "$(includedir)/IceUtil/Mutex.h" "$(includedir)/IceUtil/Lock.h" "$(includedir)/IceUtil/ThreadException.h" "$(includedir)/IceUtil/Time.h" "$(includedir)/IceUtil/MutexProtocol.h" "$(includedir)/Ice/ProxyFactoryF.h" "$(includedir)/Ice/ConnectionIF.h" "$(includedir)/Ice/RequestHandlerF.h" "$(includedir)/Ice/EndpointIF.h" "$(includedir)/Ice/EndpointF.h" "$(includedir)/IceUtil/Optional.h" "$(includedir)/Ice/UndefSysMacros.h" "$(includedir)/Ice/EndpointTypes.h" "$(includedir)/Ice/ObjectAdapterF.h" "$(includedir)/Ice/ReferenceF.h" "$(includedir)/Ice/OutgoingAsync.h" "$(includedir)/IceUtil/Monitor.h" "$(includedir)/IceUtil/Cond.h" "$(includedir)/IceUtil/Timer.h" "$(includedir)/IceUtil/Thread.h" "$(includedir)/IceUtil/UniquePtr.h" "$(includedir)/Ice/OutgoingAsyncF.h" "$(includedir)/Ice/InstanceF.h" "$(includedir)/Ice/CommunicatorF.h" "$(includedir)/Ice/Current.h" "$(includedir)/Ice/ConnectionF.h" "$(includedir)/Ice/Identity.h" "$(includedir)/Ice/Version.h" "$(includedir)/Ice/BasicStream.h" "$(includedir)/Ice/Object.h" "$(includedir)/Ice/GCShared.h" "$(includedir)/Ice/GCCountMap.h" "$(includedir)/Ice/IncomingAsyncF.h" "$(includedir)/Ice/ObjectFactoryF.h" "$(includedir)/Ice/ObjectFactoryManagerF.h" "$(includedir)/Ice/Buffer.h" "$(includedir)/Ice/Protocol.h" "$(includedir)/Ice/SlicedDataF.h" "$(includedir)/Ice/UserExceptionFactory.h" "$(includedir)/Ice/FactoryTable.h" "$(includedir)/Ice/ObserverHelper.h" "$(includedir)/Ice/Instrumentation.h" "$(includedir)/Ice/Outgoing.h" "$(includedir)/Ice/Incoming.h" "$(includedir)/Ice/ServantLocatorF.h" "$(includedir)/Ice/ServantManagerF.h" "$(includedir)/Ice/IncomingAsync.h" "$(includedir)/Ice/Direct.h" "$(includedir)/Ice/FactoryTableInit.h" "$(includedir)/Ice/ProcessF.h" ../IceDiscovery/LookupI.h ../IceDiscovery/Internal.h "$(includedir)/Ice/Properties.h" "$(includedir)/Ice/PropertiesAdmin.h" "$(includedir)/Ice/BuiltinSequences.h" "$(includedir)/Ice/LocalException.h" "$(includedir)/Ice/Communicator.h" "$(includedir)/Ice/LoggerF.h" "$(includedir)/Ice/StatsF.h" "$(includedir)/Ice/InstrumentationF.h" "$(includedir)/Ice/RouterF.h" "$(includedir)/Ice/LocatorF.h" "$(includedir)/Ice/PluginF.h" "$(includedir)/Ice/ImplicitContextF.h" "$(includedir)/Ice/ObjectAdapter.h" "$(includedir)/Ice/FacetMap.h" "$(includedir)/Ice/Endpoint.h"
+LookupI$(OBJEXT): LookupI.cpp "$(includedir)/Ice/Connection.h" "$(includedir)/Ice/ProxyF.h" "$(includedir)/IceUtil/Shared.h" "$(includedir)/IceUtil/Config.h" "$(includedir)/Ice/Config.h" "$(includedir)/Ice/ProxyHandle.h" "$(includedir)/IceUtil/Handle.h" "$(includedir)/IceUtil/Exception.h" "$(includedir)/Ice/ObjectF.h" "$(includedir)/Ice/Handle.h" "$(includedir)/Ice/Exception.h" "$(includedir)/Ice/Format.h" "$(includedir)/Ice/StreamF.h" "$(includedir)/Ice/LocalObject.h" "$(includedir)/Ice/LocalObjectF.h" "$(includedir)/Ice/StreamHelpers.h" "$(includedir)/IceUtil/ScopedArray.h" "$(includedir)/IceUtil/Iterator.h" "$(includedir)/Ice/Proxy.h" "$(includedir)/IceUtil/Mutex.h" "$(includedir)/IceUtil/Lock.h" "$(includedir)/IceUtil/ThreadException.h" "$(includedir)/IceUtil/Time.h" "$(includedir)/IceUtil/MutexProtocol.h" "$(includedir)/Ice/ProxyFactoryF.h" "$(includedir)/Ice/ConnectionIF.h" "$(includedir)/Ice/RequestHandlerF.h" "$(includedir)/Ice/EndpointIF.h" "$(includedir)/Ice/EndpointF.h" "$(includedir)/IceUtil/Optional.h" "$(includedir)/Ice/UndefSysMacros.h" "$(includedir)/Ice/EndpointTypes.h" "$(includedir)/Ice/ObjectAdapterF.h" "$(includedir)/Ice/ReferenceF.h" "$(includedir)/Ice/OutgoingAsync.h" "$(includedir)/IceUtil/Monitor.h" "$(includedir)/IceUtil/Cond.h" "$(includedir)/IceUtil/Timer.h" "$(includedir)/IceUtil/Thread.h" "$(includedir)/IceUtil/UniquePtr.h" "$(includedir)/Ice/OutgoingAsyncF.h" "$(includedir)/Ice/InstanceF.h" "$(includedir)/Ice/CommunicatorF.h" "$(includedir)/Ice/Current.h" "$(includedir)/Ice/ConnectionF.h" "$(includedir)/Ice/Identity.h" "$(includedir)/Ice/Version.h" "$(includedir)/Ice/BasicStream.h" "$(includedir)/Ice/Object.h" "$(includedir)/Ice/GCShared.h" "$(includedir)/Ice/GCCountMap.h" "$(includedir)/Ice/IncomingAsyncF.h" "$(includedir)/Ice/ObjectFactoryF.h" "$(includedir)/Ice/ObjectFactoryManagerF.h" "$(includedir)/Ice/Buffer.h" "$(includedir)/Ice/Protocol.h" "$(includedir)/Ice/SlicedDataF.h" "$(includedir)/Ice/UserExceptionFactory.h" "$(includedir)/Ice/FactoryTable.h" "$(includedir)/Ice/ObserverHelper.h" "$(includedir)/Ice/Instrumentation.h" "$(includedir)/Ice/Endpoint.h" "$(includedir)/Ice/BuiltinSequences.h" "$(includedir)/Ice/ObjectAdapter.h" "$(includedir)/Ice/ServantLocatorF.h" "$(includedir)/Ice/LocatorF.h" "$(includedir)/Ice/FacetMap.h" "$(includedir)/Ice/Communicator.h" "$(includedir)/Ice/Outgoing.h" "$(includedir)/Ice/Incoming.h" "$(includedir)/Ice/ServantManagerF.h" "$(includedir)/Ice/IncomingAsync.h" "$(includedir)/Ice/Direct.h" "$(includedir)/Ice/LoggerF.h" "$(includedir)/Ice/StatsF.h" "$(includedir)/Ice/InstrumentationF.h" "$(includedir)/Ice/RouterF.h" "$(includedir)/Ice/PluginF.h" "$(includedir)/Ice/ImplicitContextF.h" "$(includedir)/Ice/Properties.h" "$(includedir)/Ice/PropertiesAdmin.h" "$(includedir)/Ice/LocalException.h" ../IceDiscovery/LookupI.h ../IceDiscovery/Internal.h ../IceDiscovery/LocatorI.h "$(includedir)/Ice/Locator.h" "$(includedir)/Ice/FactoryTableInit.h" "$(includedir)/Ice/ProcessF.h"
+IceDiscovery$(OBJEXT): IceDiscovery.cpp ../IceDiscovery/IceDiscovery.h "$(includedir)/Ice/ProxyF.h" "$(includedir)/IceUtil/Shared.h" "$(includedir)/IceUtil/Config.h" "$(includedir)/Ice/Config.h" "$(includedir)/Ice/ProxyHandle.h" "$(includedir)/IceUtil/Handle.h" "$(includedir)/IceUtil/Exception.h" "$(includedir)/Ice/ObjectF.h" "$(includedir)/Ice/Handle.h" "$(includedir)/Ice/Exception.h" "$(includedir)/Ice/Format.h" "$(includedir)/Ice/StreamF.h" "$(includedir)/Ice/LocalObject.h" "$(includedir)/Ice/LocalObjectF.h" "$(includedir)/Ice/StreamHelpers.h" "$(includedir)/IceUtil/ScopedArray.h" "$(includedir)/IceUtil/Iterator.h" "$(includedir)/Ice/Proxy.h" "$(includedir)/IceUtil/Mutex.h" "$(includedir)/IceUtil/Lock.h" "$(includedir)/IceUtil/ThreadException.h" "$(includedir)/IceUtil/Time.h" "$(includedir)/IceUtil/MutexProtocol.h" "$(includedir)/Ice/ProxyFactoryF.h" "$(includedir)/Ice/ConnectionIF.h" "$(includedir)/Ice/RequestHandlerF.h" "$(includedir)/Ice/EndpointIF.h" "$(includedir)/Ice/EndpointF.h" "$(includedir)/IceUtil/Optional.h" "$(includedir)/Ice/UndefSysMacros.h" "$(includedir)/Ice/EndpointTypes.h" "$(includedir)/Ice/ObjectAdapterF.h" "$(includedir)/Ice/ReferenceF.h" "$(includedir)/Ice/OutgoingAsync.h" "$(includedir)/IceUtil/Monitor.h" "$(includedir)/IceUtil/Cond.h" "$(includedir)/IceUtil/Timer.h" "$(includedir)/IceUtil/Thread.h" "$(includedir)/IceUtil/UniquePtr.h" "$(includedir)/Ice/OutgoingAsyncF.h" "$(includedir)/Ice/InstanceF.h" "$(includedir)/Ice/CommunicatorF.h" "$(includedir)/Ice/Current.h" "$(includedir)/Ice/ConnectionF.h" "$(includedir)/Ice/Identity.h" "$(includedir)/Ice/Version.h" "$(includedir)/Ice/BasicStream.h" "$(includedir)/Ice/Object.h" "$(includedir)/Ice/GCShared.h" "$(includedir)/Ice/GCCountMap.h" "$(includedir)/Ice/IncomingAsyncF.h" "$(includedir)/Ice/ObjectFactoryF.h" "$(includedir)/Ice/ObjectFactoryManagerF.h" "$(includedir)/Ice/Buffer.h" "$(includedir)/Ice/Protocol.h" "$(includedir)/Ice/SlicedDataF.h" "$(includedir)/Ice/UserExceptionFactory.h" "$(includedir)/Ice/FactoryTable.h" "$(includedir)/Ice/ObserverHelper.h" "$(includedir)/Ice/Instrumentation.h" "$(includedir)/Ice/Outgoing.h" "$(includedir)/Ice/Incoming.h" "$(includedir)/Ice/ServantLocatorF.h" "$(includedir)/Ice/ServantManagerF.h" "$(includedir)/Ice/Direct.h" "$(includedir)/Ice/LocalException.h" "$(includedir)/Ice/BuiltinSequences.h" "$(includedir)/Ice/ObjectFactory.h" "$(includedir)/IceUtil/DisableWarnings.h"
+PluginI$(OBJEXT): PluginI.cpp "$(includedir)/Ice/Ice.h" "$(includedir)/IceUtil/Config.h" "$(includedir)/Ice/Initialize.h" "$(includedir)/Ice/CommunicatorF.h" "$(includedir)/Ice/ProxyF.h" "$(includedir)/IceUtil/Shared.h" "$(includedir)/Ice/Config.h" "$(includedir)/Ice/ProxyHandle.h" "$(includedir)/IceUtil/Handle.h" "$(includedir)/IceUtil/Exception.h" "$(includedir)/Ice/ObjectF.h" "$(includedir)/Ice/Handle.h" "$(includedir)/Ice/Exception.h" "$(includedir)/Ice/Format.h" "$(includedir)/Ice/StreamF.h" "$(includedir)/Ice/LocalObject.h" "$(includedir)/Ice/LocalObjectF.h" "$(includedir)/Ice/StreamHelpers.h" "$(includedir)/IceUtil/ScopedArray.h" "$(includedir)/IceUtil/Iterator.h" "$(includedir)/IceUtil/Optional.h" "$(includedir)/Ice/UndefSysMacros.h" "$(includedir)/Ice/PropertiesF.h" "$(includedir)/Ice/Proxy.h" "$(includedir)/IceUtil/Mutex.h" "$(includedir)/IceUtil/Lock.h" "$(includedir)/IceUtil/ThreadException.h" "$(includedir)/IceUtil/Time.h" "$(includedir)/IceUtil/MutexProtocol.h" "$(includedir)/Ice/ProxyFactoryF.h" "$(includedir)/Ice/ConnectionIF.h" "$(includedir)/Ice/RequestHandlerF.h" "$(includedir)/Ice/EndpointIF.h" "$(includedir)/Ice/EndpointF.h" "$(includedir)/Ice/EndpointTypes.h" "$(includedir)/Ice/ObjectAdapterF.h" "$(includedir)/Ice/ReferenceF.h" "$(includedir)/Ice/OutgoingAsync.h" "$(includedir)/IceUtil/Monitor.h" "$(includedir)/IceUtil/Cond.h" "$(includedir)/IceUtil/Timer.h" "$(includedir)/IceUtil/Thread.h" "$(includedir)/IceUtil/UniquePtr.h" "$(includedir)/Ice/OutgoingAsyncF.h" "$(includedir)/Ice/InstanceF.h" "$(includedir)/Ice/Current.h" "$(includedir)/Ice/ConnectionF.h" "$(includedir)/Ice/Identity.h" "$(includedir)/Ice/Version.h" "$(includedir)/Ice/BasicStream.h" "$(includedir)/Ice/Object.h" "$(includedir)/Ice/GCShared.h" "$(includedir)/Ice/GCCountMap.h" "$(includedir)/Ice/IncomingAsyncF.h" "$(includedir)/Ice/ObjectFactoryF.h" "$(includedir)/Ice/ObjectFactoryManagerF.h" "$(includedir)/Ice/Buffer.h" "$(includedir)/Ice/Protocol.h" "$(includedir)/Ice/SlicedDataF.h" "$(includedir)/Ice/UserExceptionFactory.h" "$(includedir)/Ice/FactoryTable.h" "$(includedir)/Ice/ObserverHelper.h" "$(includedir)/Ice/Instrumentation.h" "$(includedir)/Ice/LoggerF.h" "$(includedir)/Ice/StatsF.h" "$(includedir)/Ice/InstrumentationF.h" "$(includedir)/Ice/Dispatcher.h" "$(includedir)/Ice/StringConverter.h" "$(includedir)/Ice/Plugin.h" "$(includedir)/Ice/BuiltinSequences.h" "$(includedir)/IceUtil/Unicode.h" "$(includedir)/Ice/LocalException.h" "$(includedir)/Ice/PropertiesAdmin.h" "$(includedir)/Ice/Outgoing.h" "$(includedir)/Ice/Incoming.h" "$(includedir)/Ice/ServantLocatorF.h" "$(includedir)/Ice/ServantManagerF.h" "$(includedir)/Ice/IncomingAsync.h" "$(includedir)/Ice/Direct.h" "$(includedir)/Ice/Properties.h" "$(includedir)/Ice/Logger.h" "$(includedir)/Ice/LoggerUtil.h" "$(includedir)/Ice/Stats.h" "$(includedir)/Ice/Communicator.h" "$(includedir)/Ice/RouterF.h" "$(includedir)/Ice/LocatorF.h" "$(includedir)/Ice/PluginF.h" "$(includedir)/Ice/ImplicitContextF.h" "$(includedir)/Ice/CommunicatorAsync.h" "$(includedir)/Ice/ObjectFactory.h" "$(includedir)/Ice/ObjectAdapter.h" "$(includedir)/Ice/FacetMap.h" "$(includedir)/Ice/Endpoint.h" "$(includedir)/Ice/ServantLocator.h" "$(includedir)/Ice/SlicedData.h" "$(includedir)/Ice/Process.h" "$(includedir)/Ice/Application.h" "$(includedir)/Ice/Connection.h" "$(includedir)/Ice/ConnectionAsync.h" "$(includedir)/Ice/Functional.h" "$(includedir)/IceUtil/Functional.h" "$(includedir)/Ice/Stream.h" "$(includedir)/Ice/ImplicitContext.h" "$(includedir)/Ice/Locator.h" "$(includedir)/Ice/FactoryTableInit.h" "$(includedir)/Ice/ProcessF.h" "$(includedir)/Ice/Router.h" "$(includedir)/Ice/DispatchInterceptor.h" "$(includedir)/Ice/NativePropertiesAdmin.h" "$(includedir)/Ice/Metrics.h" "$(includedir)/Ice/Service.h" "$(includedir)/Ice/IconvStringConverter.h" ../IceDiscovery/PluginI.h ../IceDiscovery/LocatorI.h ../IceDiscovery/LookupI.h ../IceDiscovery/Internal.h
+IceDiscovery.h IceDiscovery.cpp: "$(slicedir)/IceDiscovery/IceDiscovery.ice" "$(slicedir)/Ice/Identity.ice" "$(SLICE2CPP)" "$(SLICEPARSERLIB)"
diff --git a/cpp/src/IceDiscovery/.gitignore b/cpp/src/IceDiscovery/.gitignore
new file mode 100644
index 00000000000..9f2f43691cc
--- /dev/null
+++ b/cpp/src/IceDiscovery/.gitignore
@@ -0,0 +1,5 @@
+// Generated by makegitignore.py
+
+// IMPORTANT: Do not edit this file -- any edits made here will be lost!
+Internal.cpp
+Internal.h
diff --git a/cpp/src/IceDiscovery/IceDiscovery.rc b/cpp/src/IceDiscovery/IceDiscovery.rc
new file mode 100755
index 00000000000..5257c6e6dad
--- /dev/null
+++ b/cpp/src/IceDiscovery/IceDiscovery.rc
@@ -0,0 +1,38 @@
+#include "winver.h"
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 3,5,1,0
+ PRODUCTVERSION 3,5,1,0
+ FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
+#ifdef _DEBUG
+ FILEFLAGS VS_FF_DEBUG
+ #define INTERNALNAME "icediscovery35d\0"
+ #define ORIGINALFILENAME "icediscovery35d.dll\0"
+#else
+ FILEFLAGS 0x0L
+ #define INTERNALNAME "icediscovery35\0"
+ #define ORIGINALFILENAME "icediscovery35.dll\0"
+#endif
+ FILEOS 0x4L
+ FILETYPE VFT_DLL
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904e4"
+ BEGIN
+ VALUE "CompanyName", "ZeroC, Inc.\0"
+ VALUE "FileDescription", "Ice Discovery DLL\0"
+ VALUE "FileVersion", "3.5.1\0"
+ VALUE "InternalName", INTERNALNAME
+ VALUE "LegalCopyright", "Copyright (c) 2003-2013 ZeroC, Inc. All rights reserved.\0"
+ VALUE "OriginalFilename", ORIGINALFILENAME
+ VALUE "ProductName", "Ice\0"
+ VALUE "ProductVersion", "3.5.1\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1252
+ END
+END
diff --git a/cpp/src/IceDiscovery/LocatorI.cpp b/cpp/src/IceDiscovery/LocatorI.cpp
new file mode 100644
index 00000000000..f6bf951d331
--- /dev/null
+++ b/cpp/src/IceDiscovery/LocatorI.cpp
@@ -0,0 +1,208 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 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 <IceDiscovery/LocatorI.h>
+#include <IceDiscovery/LookupI.h>
+
+#include <Ice/LocalException.h>
+#include <Ice/Communicator.h>
+#include <Ice/ObjectAdapter.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceDiscovery;
+
+LocatorRegistryI::LocatorRegistryI(const Ice::CommunicatorPtr& com) :
+ _wellKnownProxy(com->stringToProxy("p")->ice_locator(0)->ice_router(0)->ice_collocationOptimized(true))
+{
+}
+
+void
+LocatorRegistryI::setAdapterDirectProxy_async(const AMD_LocatorRegistry_setAdapterDirectProxyPtr& cb,
+ const std::string& adapterId,
+ const ObjectPrx& proxy,
+ const Current&)
+{
+ Lock sync(*this);
+ if(proxy)
+ {
+ _adapters[adapterId] = proxy;
+ }
+ else
+ {
+ _adapters.erase(adapterId);
+ }
+ cb->ice_response();
+}
+
+void
+LocatorRegistryI::setReplicatedAdapterDirectProxy_async(
+ const AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr& cb,
+ const std::string& adapterId,
+ const std::string& replicaGroupId,
+ const ObjectPrx& proxy,
+ const Current&)
+{
+ Lock sync(*this);
+ if(proxy)
+ {
+ _adapters[adapterId] = proxy;
+ map<string, set<string> >::iterator p = _replicaGroups.find(replicaGroupId);
+ if(p == _replicaGroups.end())
+ {
+ p = _replicaGroups.insert(make_pair(replicaGroupId, set<string>())).first;
+ }
+ p->second.insert(adapterId);
+ }
+ else
+ {
+ _adapters.erase(adapterId);
+ map<string, set<string> >::iterator p = _replicaGroups.find(replicaGroupId);
+ if(p != _replicaGroups.end())
+ {
+ p->second.erase(adapterId);
+ if(p->second.empty())
+ {
+ _replicaGroups.erase(p);
+ }
+ }
+ }
+ cb->ice_response();
+}
+
+void
+LocatorRegistryI::setServerProcessProxy_async(const AMD_LocatorRegistry_setServerProcessProxyPtr& cb,
+ const std::string&,
+ const ProcessPrx&,
+ const Current&)
+{
+ cb->ice_response();
+}
+
+Ice::ObjectPrx
+LocatorRegistryI::findObject(const Ice::Identity& id) const
+{
+ Lock sync(*this);
+ if(id.name.empty())
+ {
+ return 0;
+ }
+
+ Ice::ObjectPrx prx = _wellKnownProxy->ice_identity(id);
+
+ vector<string> adapterIds;
+ for(map<string, set<string> >::const_iterator p = _replicaGroups.begin(); p != _replicaGroups.end(); ++p)
+ {
+ try
+ {
+ prx->ice_adapterId(p->first)->ice_ping();
+ adapterIds.push_back(p->first);
+ }
+ catch(const Ice::Exception&)
+ {
+ // Ignore
+ }
+ }
+
+ if(adapterIds.empty())
+ {
+ for(map<string, Ice::ObjectPrx>::const_iterator p = _adapters.begin(); p != _adapters.end(); ++p)
+ {
+ try
+ {
+ prx->ice_adapterId(p->first)->ice_ping();
+ adapterIds.push_back(p->first);
+ }
+ catch(const Ice::Exception&)
+ {
+ // Ignore
+ }
+ }
+ }
+
+ if(adapterIds.empty())
+ {
+ return 0;
+ }
+
+ random_shuffle(adapterIds.begin(), adapterIds.end());
+ return prx->ice_adapterId(adapterIds[0]);
+}
+
+Ice::ObjectPrx
+LocatorRegistryI::findAdapter(const string& adapterId, bool& isReplicaGroup) const
+{
+ Lock sync(*this);
+
+ map<string, Ice::ObjectPrx>::const_iterator p = _adapters.find(adapterId);
+ if(p != _adapters.end())
+ {
+ isReplicaGroup = false;
+ return p->second;
+ }
+
+ map<string, set<string> >::const_iterator q = _replicaGroups.find(adapterId);
+ if(q != _replicaGroups.end())
+ {
+ Ice::EndpointSeq endpoints;
+ Ice::ObjectPrx prx;
+ for(set<string>::const_iterator r = q->second.begin(); r != q->second.end(); ++r)
+ {
+ map<string, Ice::ObjectPrx>::const_iterator s = _adapters.find(*r);
+ if(s == _adapters.end())
+ {
+ continue; // TODO: Inconsistency
+ }
+
+ if(!prx)
+ {
+ prx = s->second;
+ }
+
+ Ice::EndpointSeq endpts = s->second->ice_getEndpoints();
+ copy(endpts.begin(), endpts.end(), back_inserter(endpoints));
+ }
+
+ if(prx)
+ {
+ isReplicaGroup = true;
+ return prx->ice_endpoints(endpoints);
+ }
+ }
+
+ isReplicaGroup = false;
+ return 0;
+}
+
+LocatorI::LocatorI(const LookupIPtr& lookup, const LocatorRegistryPrx& registry) : _lookup(lookup), _registry(registry)
+{
+}
+
+void
+LocatorI::findObjectById_async(const AMD_Locator_findObjectByIdPtr& cb,
+ const Identity& id,
+ const Current&) const
+{
+ _lookup->findObject(cb, id);
+}
+
+void
+LocatorI::findAdapterById_async(const AMD_Locator_findAdapterByIdPtr& cb,
+ const std::string& adapterId,
+ const Current&) const
+{
+ _lookup->findAdapter(cb, adapterId);
+}
+
+LocatorRegistryPrx
+LocatorI::getRegistry(const Current&) const
+{
+ return _registry;
+}
+
diff --git a/cpp/src/IceDiscovery/LocatorI.h b/cpp/src/IceDiscovery/LocatorI.h
new file mode 100644
index 00000000000..700f4305129
--- /dev/null
+++ b/cpp/src/IceDiscovery/LocatorI.h
@@ -0,0 +1,76 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 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.
+//
+// **********************************************************************
+
+#ifndef LOCATORI_H
+#define LOCATORI_H
+
+#include <Ice/Locator.h>
+#include <Ice/ProxyF.h>
+
+namespace IceDiscovery
+{
+
+class LocatorRegistryI : public Ice::LocatorRegistry, private IceUtil::Mutex
+{
+public:
+
+ LocatorRegistryI(const Ice::CommunicatorPtr&);
+
+ virtual void
+ setAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setAdapterDirectProxyPtr&, const std::string&,
+ const Ice::ObjectPrx&, const Ice::Current&);
+
+ virtual void
+ setReplicatedAdapterDirectProxy_async(const Ice::AMD_LocatorRegistry_setReplicatedAdapterDirectProxyPtr&,
+ const std::string&, const std::string&, const Ice::ObjectPrx&,
+ const Ice::Current&);
+
+ virtual void
+ setServerProcessProxy_async(const Ice::AMD_LocatorRegistry_setServerProcessProxyPtr&, const std::string&,
+ const Ice::ProcessPrx&, const Ice::Current&);
+
+ Ice::ObjectPrx findObject(const Ice::Identity&) const;
+ Ice::ObjectPrx findAdapter(const std::string&, bool&) const;
+
+private:
+
+ const Ice::ObjectPrx _wellKnownProxy;
+ std::map<std::string, Ice::ObjectPrx> _adapters;
+ std::map<std::string, std::set<std::string> > _replicaGroups;
+};
+typedef IceInternal::Handle<LocatorRegistryI> LocatorRegistryIPtr;
+
+class LookupI;
+typedef IceInternal::Handle<LookupI> LookupIPtr;
+
+class LocatorI : public Ice::Locator
+{
+public:
+
+ LocatorI(const LookupIPtr&, const Ice::LocatorRegistryPrx&);
+
+ virtual void
+ findObjectById_async(const Ice::AMD_Locator_findObjectByIdPtr&, const Ice::Identity&,
+ const Ice::Current&) const;
+
+ virtual void
+ findAdapterById_async(const Ice::AMD_Locator_findAdapterByIdPtr&, const std::string&,
+ const Ice::Current&) const;
+
+ virtual Ice::LocatorRegistryPrx getRegistry(const Ice::Current&) const;
+
+private:
+
+ LookupIPtr _lookup;
+ Ice::LocatorRegistryPrx _registry;
+};
+
+};
+
+#endif
diff --git a/cpp/src/IceDiscovery/LookupI.cpp b/cpp/src/IceDiscovery/LookupI.cpp
new file mode 100644
index 00000000000..01e33ca1a2b
--- /dev/null
+++ b/cpp/src/IceDiscovery/LookupI.cpp
@@ -0,0 +1,303 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 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/Connection.h>
+#include <Ice/ObjectAdapter.h>
+#include <Ice/Communicator.h>
+#include <Ice/LocalException.h>
+
+#include <IceDiscovery/LookupI.h>
+
+using namespace std;
+using namespace Ice;
+using namespace IceDiscovery;
+
+IceDiscovery::Request::Request(LookupI* lookup, int retryCount) : _lookup(lookup), _nRetry(retryCount)
+{
+}
+
+bool
+IceDiscovery::Request::retry()
+{
+ return --_nRetry >= 0;
+}
+
+bool
+AdapterRequest::retry()
+{
+ return _proxies.empty() && --_nRetry >= 0;
+}
+
+bool
+AdapterRequest::response(const Ice::ObjectPrx& proxy, bool isReplicaGroup)
+{
+ if(isReplicaGroup)
+ {
+ if(_latency == IceUtil::Time())
+ {
+ _latency = (IceUtil::Time::now() - _start) * _lookup->latencyMultiplier();
+ _lookup->timer()->cancel(this);
+ _lookup->timer()->schedule(this, _latency);
+ }
+ _proxies.push_back(proxy);
+ return false;
+ }
+ finished(proxy);
+ return true;
+}
+
+void
+AdapterRequest::finished(const Ice::ObjectPrx& proxy)
+{
+ if(proxy || _proxies.empty())
+ {
+ RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(proxy);
+ return;
+ }
+ else if(_proxies.size() == 1)
+ {
+ RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(_proxies[0]);
+ return;
+ }
+
+ Ice::EndpointSeq endpoints;
+ Ice::ObjectPrx prx;
+ for(vector<Ice::ObjectPrx>::const_iterator p = _proxies.begin(); p != _proxies.end(); ++p)
+ {
+ if(!prx)
+ {
+ prx = *p;
+ }
+ Ice::EndpointSeq endpts = (*p)->ice_getEndpoints();
+ copy(endpts.begin(), endpts.end(), back_inserter(endpoints));
+ }
+ RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>::finished(prx->ice_endpoints(endpoints));
+}
+
+void
+AdapterRequest::runTimerTask()
+{
+ _lookup->adapterRequestTimedOut(this);
+}
+
+void
+ObjectRequest::response(const Ice::ObjectPrx& proxy)
+{
+ finished(proxy);
+}
+
+void
+ObjectRequest::runTimerTask()
+{
+ _lookup->objectRequestTimedOut(this);
+}
+
+LookupI::LookupI(const LocatorRegistryIPtr& registry, const LookupPrx& lookup, const Ice::PropertiesPtr& properties) :
+ _registry(registry),
+ _lookup(lookup),
+ _timeout(IceUtil::Time::milliSeconds(properties->getPropertyAsIntWithDefault("IceDiscovery.Timeout", 300))),
+ _retryCount(properties->getPropertyAsIntWithDefault("IceDiscovery.RetryCount", 3)),
+ _latencyMultiplier(properties->getPropertyAsIntWithDefault("IceDiscovery.LatencyMultiplier", 1)),
+ _domainId(properties->getProperty("IceDiscovery.DomainId")),
+ _timer(new IceUtil::Timer())
+{
+}
+
+void
+LookupI::setLookupReply(const LookupReplyPrx& lookupReply)
+{
+ _lookupReply = lookupReply;
+}
+
+void
+LookupI::findObjectById(const string& domainId, const Ice::Identity& id, const IceDiscovery::LookupReplyPrx& reply,
+ const Ice::Current& c)
+{
+ if(domainId != _domainId)
+ {
+ return; // Ignore.
+ }
+
+ Ice::ObjectPrx proxy = _registry->findObject(id);
+ if(proxy)
+ {
+ //
+ // Reply to the mulicast request using the given proxy.
+ //
+ getLookupReply(reply, c)->begin_foundObjectById(id, proxy);
+ }
+}
+
+void
+LookupI::findAdapterById(const string& domainId, const std::string& adapterId,
+ const IceDiscovery::LookupReplyPrx& reply, const Ice::Current& c)
+{
+ if(domainId != _domainId)
+ {
+ return; // Ignore.
+ }
+
+ bool isReplicaGroup;
+ Ice::ObjectPrx proxy = _registry->findAdapter(adapterId, isReplicaGroup);
+ if(proxy)
+ {
+ //
+ // Reply to the multicast request using the given proxy.
+ //
+ getLookupReply(reply, c)->begin_foundAdapterById(adapterId, proxy, isReplicaGroup);
+ }
+}
+
+void
+LookupI::findObject(const Ice::AMD_Locator_findObjectByIdPtr& cb, const Ice::Identity& id)
+{
+ Lock sync(*this);
+ map<Ice::Identity, ObjectRequestPtr>::const_iterator p = _objectRequests.find(id);
+ if(p == _objectRequests.end())
+ {
+ p = _objectRequests.insert(make_pair(id, new ObjectRequest(this, id, _retryCount))).first;
+ }
+
+ if(p->second->addCallback(cb))
+ {
+ _lookup->findObjectById(_domainId, id, _lookupReply);
+ _timer->schedule(p->second, _timeout);
+ }
+}
+
+void
+LookupI::findAdapter(const Ice::AMD_Locator_findAdapterByIdPtr& cb, const std::string& adapterId)
+{
+ Lock sync(*this);
+ map<string, AdapterRequestPtr>::const_iterator p = _adapterRequests.find(adapterId);
+ if(p == _adapterRequests.end())
+ {
+ p = _adapterRequests.insert(make_pair(adapterId, new AdapterRequest(this, adapterId, _retryCount))).first;
+ }
+
+ if(p->second->addCallback(cb))
+ {
+ _lookup->findAdapterById(_domainId, adapterId, _lookupReply);
+ _timer->schedule(p->second, _timeout);
+ }
+}
+
+void
+LookupI::foundObject(const Ice::Identity& id, const Ice::ObjectPrx& proxy)
+{
+ Lock sync(*this);
+ map<Ice::Identity, ObjectRequestPtr>::iterator p = _objectRequests.find(id);
+ if(p == _objectRequests.end())
+ {
+ return;
+ }
+
+ p->second->response(proxy);
+ _timer->cancel(p->second);
+ _objectRequests.erase(p);
+}
+
+void
+LookupI::foundAdapter(const std::string& adapterId, const Ice::ObjectPrx& proxy, bool isReplicaGroup)
+{
+ Lock sync(*this);
+ map<string, AdapterRequestPtr>::iterator p = _adapterRequests.find(adapterId);
+ if(p == _adapterRequests.end())
+ {
+ return;
+ }
+
+ if(p->second->response(proxy, isReplicaGroup))
+ {
+ _timer->cancel(p->second);
+ _adapterRequests.erase(p);
+ }
+}
+
+void
+LookupI::objectRequestTimedOut(const ObjectRequestPtr& request)
+{
+ Lock sync(*this);
+ map<Ice::Identity, ObjectRequestPtr>::iterator p = _objectRequests.find(request->getId());
+ if(p == _objectRequests.end() || p->second.get() != request.get())
+ {
+ return;
+ }
+
+ if(request->retry())
+ {
+ _lookup->findObjectById(_domainId, request->getId(), _lookupReply);
+ _timer->schedule(p->second, _timeout);
+ }
+ else
+ {
+ request->finished(0);
+ _objectRequests.erase(p);
+ _timer->cancel(request);
+ }
+}
+
+void
+LookupI::adapterRequestTimedOut(const AdapterRequestPtr& request)
+{
+ Lock sync(*this);
+ map<string, AdapterRequestPtr>::iterator p = _adapterRequests.find(request->getId());
+ if(p == _adapterRequests.end() || p->second.get() != request.get())
+ {
+ return;
+ }
+
+ if(request->retry())
+ {
+ _lookup->findAdapterById(_domainId, request->getId(), _lookupReply);
+ _timer->schedule(p->second, _timeout);
+ }
+ else
+ {
+ request->finished(0);
+ _adapterRequests.erase(p);
+ _timer->cancel(request);
+ }
+}
+
+LookupReplyPrx
+LookupI::getLookupReply(const LookupReplyPrx& reply, const Ice::Current& current) const
+{
+ // Ice::UDPConnectionInfoPtr info = Ice::UDPConnectionInfoPtr::dynamicCast(current.con->getInfo());
+ // if(info)
+ // {
+ // Ice::CommunicatorPtr com = current.adapter->getCommunicator();
+ // ostringstream os;
+ // os << "\"" << com->identityToString(reply->ice_getIdentity()) << "\"";
+ // os << ":udp -h " << info->remoteAddress << " -p " << info->remotePort;
+ // return LookupReplyPrx::uncheckedCast(com->stringToProxy(os.str())->ice_datagram());
+ // }
+ // else
+ {
+ return reply;
+ }
+}
+
+LookupReplyI::LookupReplyI(const LookupIPtr& lookup) : _lookup(lookup)
+{
+}
+
+void
+LookupReplyI::foundObjectById(const Ice::Identity& id, const Ice::ObjectPrx& proxy, const Ice::Current&)
+{
+ _lookup->foundObject(id, proxy);
+}
+
+void
+LookupReplyI::foundAdapterById(const std::string& adapterId, const Ice::ObjectPrx& proxy, bool isReplicaGroup,
+ const Ice::Current&)
+{
+ _lookup->foundAdapter(adapterId, proxy, isReplicaGroup);
+}
+
diff --git a/cpp/src/IceDiscovery/LookupI.h b/cpp/src/IceDiscovery/LookupI.h
new file mode 100644
index 00000000000..ed1bf5ea087
--- /dev/null
+++ b/cpp/src/IceDiscovery/LookupI.h
@@ -0,0 +1,181 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 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.
+//
+// **********************************************************************
+
+#ifndef LOOKUPI_H
+#define LOOKUPI_H
+
+#include <IceDiscovery/Internal.h>
+#include <IceDiscovery/LocatorI.h>
+
+#include <Ice/Properties.h>
+
+namespace IceDiscovery
+{
+
+class LookupI;
+
+class Request : public IceUtil::TimerTask
+{
+public:
+
+ Request(LookupI*, int);
+
+ virtual bool retry();
+
+protected:
+
+ LookupI* _lookup;
+ int _nRetry;
+};
+
+template<class T, class CB> class RequestT : public Request
+{
+public:
+
+ RequestT(LookupI* lookup, T id, int retryCount) : Request(lookup, retryCount), _id(id)
+ {
+ }
+
+ T getId() const
+ {
+ return _id;
+ }
+
+ bool addCallback(CB cb)
+ {
+ _callbacks.push_back(cb);
+ return _callbacks.size() == 1;
+ }
+
+ virtual void finished(const Ice::ObjectPrx& proxy)
+ {
+ for(typename std::vector<CB>::const_iterator p = _callbacks.begin(); p != _callbacks.end(); ++p)
+ {
+ (*p)->ice_response(proxy);
+ }
+ _callbacks.clear();
+ }
+
+protected:
+
+ const T _id;
+ std::vector<CB> _callbacks;
+};
+
+class ObjectRequest : public RequestT<Ice::Identity, Ice::AMD_Locator_findObjectByIdPtr>
+{
+public:
+
+ ObjectRequest(LookupI* lookup, const Ice::Identity& id, int retryCount) :
+ RequestT<Ice::Identity, Ice::AMD_Locator_findObjectByIdPtr>(lookup, id, retryCount)
+ {
+ }
+
+ void response(const Ice::ObjectPrx&);
+
+private:
+
+ virtual void runTimerTask();
+};
+typedef IceUtil::Handle<ObjectRequest> ObjectRequestPtr;
+
+class AdapterRequest : public RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>
+{
+public:
+
+ AdapterRequest(LookupI* lookup, const std::string& adapterId, int retryCount) :
+ RequestT<std::string, Ice::AMD_Locator_findAdapterByIdPtr>(lookup, adapterId, retryCount),
+ _start(IceUtil::Time::now())
+ {
+ }
+
+ bool response(const Ice::ObjectPrx&, bool);
+
+ virtual bool retry();
+ virtual void finished(const Ice::ObjectPrx&);
+
+private:
+
+ virtual void runTimerTask();
+ std::vector<Ice::ObjectPrx> _proxies;
+ IceUtil::Time _start;
+ IceUtil::Time _latency;
+};
+typedef IceUtil::Handle<AdapterRequest> AdapterRequestPtr;
+
+class LookupI : public Lookup, private IceUtil::Mutex
+{
+public:
+
+ LookupI(const LocatorRegistryIPtr&, const LookupPrx&, const Ice::PropertiesPtr&);
+
+ void setLookupReply(const LookupReplyPrx&);
+
+ virtual void findObjectById(const std::string&, const Ice::Identity&, const IceDiscovery::LookupReplyPrx&,
+ const Ice::Current&);
+ virtual void findAdapterById(const std::string&, const std::string&, const IceDiscovery::LookupReplyPrx&,
+ const Ice::Current&);
+
+ void findObject(const Ice::AMD_Locator_findObjectByIdPtr&, const Ice::Identity&);
+ void findAdapter(const Ice::AMD_Locator_findAdapterByIdPtr&, const std::string&);
+
+ void foundObject(const Ice::Identity&, const Ice::ObjectPrx&);
+ void foundAdapter(const std::string&, const Ice::ObjectPrx&, bool);
+
+ void adapterRequestTimedOut(const AdapterRequestPtr&);
+ void objectRequestTimedOut(const ObjectRequestPtr&);
+
+ const IceUtil::TimerPtr&
+ timer()
+ {
+ return _timer;
+ }
+
+ int
+ latencyMultiplier()
+ {
+ return _latencyMultiplier;
+ }
+
+private:
+
+ LookupReplyPrx getLookupReply(const LookupReplyPrx&, const Ice::Current&) const;
+
+ LocatorRegistryIPtr _registry;
+ const LookupPrx _lookup;
+ LookupReplyPrx _lookupReply;
+ const IceUtil::Time _timeout;
+ const int _retryCount;
+ const int _latencyMultiplier;
+ const std::string _domainId;
+
+ IceUtil::TimerPtr _timer;
+ Ice::ObjectPrx _wellKnownProxy;
+
+ std::map<Ice::Identity, ObjectRequestPtr> _objectRequests;
+ std::map<std::string, AdapterRequestPtr> _adapterRequests;
+};
+
+class LookupReplyI : public LookupReply
+{
+public:
+
+ LookupReplyI(const LookupIPtr&);
+
+ virtual void foundObjectById(const Ice::Identity&, const Ice::ObjectPrx&, const Ice::Current&);
+ virtual void foundAdapterById(const std::string&, const Ice::ObjectPrx&, bool, const Ice::Current&);
+
+private:
+
+ const LookupIPtr _lookup;
+};
+
+};
+
+#endif
diff --git a/cpp/src/IceDiscovery/Makefile b/cpp/src/IceDiscovery/Makefile
new file mode 100644
index 00000000000..bd674e95f93
--- /dev/null
+++ b/cpp/src/IceDiscovery/Makefile
@@ -0,0 +1,59 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2013 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.
+#
+# **********************************************************************
+
+top_srcdir = ../..
+
+LIBFILENAME = $(call mklibfilename,IceDiscovery,$(VERSION))
+SONAME = $(call mksoname,IceDiscovery,$(SOVERSION))
+LIBNAME = $(call mklibname,IceDiscovery)
+
+TARGETS = $(call mklibtargets,$(libdir)/$(LIBFILENAME),$(libdir)/$(SONAME),$(libdir)/$(LIBNAME))
+
+OBJS = LocatorI.o \
+ LookupI.o \
+ IceDiscovery.o \
+ PluginI.o
+
+SRCS = $(OBJS:.o=.cpp)
+
+SLICE_SRCS = $(slicedir)/IceDiscovery/IceDiscovery.ice
+
+include $(top_srcdir)/config/Make.rules
+
+CPPFLAGS := -I.. $(CPPFLAGS) -DICE_DISCOVERY_API_EXPORTS
+SLICE2CPPFLAGS := --ice --include-dir IceDiscovery --dll-export ICE_DISCOVERY_API $(SLICE2CPPFLAGS)
+
+LINKWITH := $(BZIP2_RPATH_LINK) -lIce -lIceUtil $(CXXLIBS)
+
+ifeq ($(STATICLIBS),yes)
+$(libdir)/$(LIBNAME): $(OBJS)
+ rm -f $@
+ $(call mklib,$@,$(OBJS))
+else
+$(libdir)/$(LIBFILENAME): $(OBJS)
+ rm -f $@
+ $(call mkshlib,$@,$(SONAME),$(OBJS),$(LINKWITH))
+
+$(libdir)/$(SONAME): $(libdir)/$(LIBFILENAME)
+ rm -f $@
+ ln -s $(LIBFILENAME) $@
+
+$(libdir)/$(LIBNAME): $(libdir)/$(SONAME)
+ rm -f $@
+ ln -s $(SONAME) $@
+endif
+
+IceDiscovery.h IceDiscovery.cpp: $(slicedir)/IceDiscovery/IceDiscovery.ice $(SLICE2CPP) $(SLICEPARSERLIB)
+ rm -f IceDiscovery.h IceDiscovery.cpp
+ $(SLICE2CPP) $(SLICE2CPPFLAGS) $(slicedir)/IceDiscovery/IceDiscovery.ice
+
+install:: all
+ $(call installlib,$(DESTDIR)$(install_libdir),$(libdir),$(LIBFILENAME),$(SONAME),$(LIBNAME))
+
+include .depend
diff --git a/cpp/src/IceDiscovery/Makefile.mak b/cpp/src/IceDiscovery/Makefile.mak
new file mode 100644
index 00000000000..2247c0424ad
--- /dev/null
+++ b/cpp/src/IceDiscovery/Makefile.mak
@@ -0,0 +1,68 @@
+# **********************************************************************
+#
+# Copyright (c) 2003-2013 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.
+#
+# **********************************************************************
+
+top_srcdir = ..\..
+
+LIBNAME = $(top_srcdir)\lib\icediscovery$(LIBSUFFIX).lib
+DLLNAME = $(top_srcdir)\bin\icediscovery$(SOVERSION)$(LIBSUFFIX)$(COMPSUFFIX).dll
+
+TARGETS = $(LIBNAME) $(DLLNAME)
+
+OBJS = LocatorI.obj \
+ LookupI.obj \
+ IceDiscovery.obj \
+ PluginI.obj
+
+SRCS = $(OBJS:.obj=.cpp)
+
+SLICE_SRCS = $(slicedir)\IceDiscovery\IceDiscovery.ice
+
+!include $(top_srcdir)/config/Make.rules.mak
+
+CPPFLAGS = -I.. $(CPPFLAGS) -DICE_DISCOVERY_API_EXPORTS -DWIN32_LEAN_AND_MEAN
+SLICE2CPPFLAGS = --ice --include-dir IceDiscovery --dll-export ICE_DISCOVERY_API $(SLICE2CPPFLAGS)
+
+LINKWITH = $(LIBS) ws2_32.lib
+
+!if "$(GENERATE_PDB)" == "yes"
+PDBFLAGS = /pdb:$(DLLNAME:.dll=.pdb)
+!endif
+
+RES_FILE = IceDiscovery.res
+
+$(LIBNAME): $(DLLNAME)
+
+$(DLLNAME): $(OBJS) IceDiscovery.res
+ $(LINK) $(BASE):0x24000000 $(LD_DLLFLAGS) $(PDBFLAGS) $(OBJS) $(PREOUT)$@ $(PRELIBS)$(LINKWITH) $(RES_FILE)
+ move $(DLLNAME:.dll=.lib) $(LIBNAME)
+ @if exist $@.manifest echo ^ ^ ^ Embedding manifest using $(MT) && \
+ $(MT) -nologo -manifest $@.manifest -outputresource:$@;#2 && del /q $@.manifest
+ @if exist $(DLLNAME:.dll=.exp) del /q $(DLLNAME:.dll=.exp)
+
+IceDiscovery.h IceDiscovery.cpp: $(slicedir)\IceDiscovery\IceDiscovery.ice $(SLICE2CPP) $(SLICEPARSERLIB)
+ del /q $(*F).h $(*F).cpp
+ "$(SLICE2CPP)" $(SLICE2CPPFLAGS) $(slicedir)\IceDiscovery\IceDiscovery.ice
+
+clean::
+ -del /q IceDiscovery.cpp $(HDIR)\IceDiscovery.h
+ -del /q IceDiscovery.res
+
+install:: all
+ copy $(LIBNAME) "$(install_libdir)"
+ copy $(DLLNAME) "$(install_bindir)"
+
+
+!if "$(GENERATE_PDB)" == "yes"
+
+install:: all
+ copy $(DLLNAME:.dll=.pdb) "$(install_bindir)"
+
+!endif
+
+!include .depend.mak
diff --git a/cpp/src/IceDiscovery/PluginI.cpp b/cpp/src/IceDiscovery/PluginI.cpp
new file mode 100644
index 00000000000..78f4b61544c
--- /dev/null
+++ b/cpp/src/IceDiscovery/PluginI.cpp
@@ -0,0 +1,146 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 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/Ice.h>
+
+#include <IceDiscovery/PluginI.h>
+#include <IceDiscovery/LocatorI.h>
+#include <IceDiscovery/LookupI.h>
+
+using namespace std;
+using namespace IceDiscovery;
+
+//
+// Plugin factory function.
+//
+extern "C"
+{
+
+ICE_DECLSPEC_EXPORT Ice::Plugin*
+createIceDiscovery(const Ice::CommunicatorPtr& communicator, const string&, const Ice::StringSeq&)
+{
+ return new PluginI(communicator);
+}
+
+}
+
+PluginI::PluginI(const Ice::CommunicatorPtr& communicator) : _communicator(communicator)
+{
+ Ice::InitializationData initData;
+ initData.properties = communicator->getProperties()->clone();
+ initData.properties->setProperty("Ice.Default.CollocationOptimized", "0");
+ Ice::PropertyDict props = initData.properties->getPropertiesForPrefix("Ice.Plugin.");
+ for(Ice::PropertyDict::const_iterator p = props.begin(); p != props.end(); ++p)
+ {
+ initData.properties->setProperty(p->first, "");
+ }
+ _pluginCommunicator = Ice::initialize(initData);
+}
+
+void
+PluginI::initialize()
+{
+ Ice::PropertiesPtr properties = _pluginCommunicator->getProperties();
+
+ bool ipv4 = properties->getPropertyAsIntWithDefault("Ice.IPv4", 1) > 0;
+ string address;
+ if(ipv4)
+ {
+ address = properties->getPropertyWithDefault("IceDiscovery.Address", "239.255.0.1");
+ }
+ else
+ {
+ address = properties->getPropertyWithDefault("IceDiscovery.Address", "ff15::1");
+ }
+ int port = properties->getPropertyAsIntWithDefault("IceDiscovery.Port", 4061);
+ string interface = properties->getProperty("IceDiscovery.Interface");
+
+ if(properties->getProperty("IceDiscovery.Multicast.Endpoints").empty())
+ {
+ ostringstream os;
+ os << "udp -h \"" << address << "\" -p " << port;
+ if(!interface.empty())
+ {
+ os << " --interface \"" << interface << "\"";
+ }
+ properties->setProperty("IceDiscovery.Multicast.Endpoints", os.str());
+ }
+ if(properties->getProperty("IceDiscovery.Reply.Endpoints").empty())
+ {
+ ostringstream os;
+ os << "udp";
+ if(!interface.empty())
+ {
+ os << " -h \"" << interface << "\"";
+ }
+ properties->setProperty("IceDiscovery.Reply.Endpoints", os.str());
+ }
+ if(properties->getProperty("IceDiscovery.Locator.Endpoints").empty())
+ {
+ if(ipv4)
+ {
+ properties->setProperty("IceDiscovery.Locator.Endpoints", "tcp -h 127.0.0.1");
+ }
+ else
+ {
+ properties->setProperty("IceDiscovery.Locator.Endpoints", "tcp -h \"::1\"");
+ }
+ }
+
+ Ice::ObjectAdapterPtr multicastAdapter = _pluginCommunicator->createObjectAdapter("IceDiscovery.Multicast");
+ Ice::ObjectAdapterPtr replyAdapter = _pluginCommunicator->createObjectAdapter("IceDiscovery.Reply");
+ Ice::ObjectAdapterPtr locatorAdapter = _pluginCommunicator->createObjectAdapter("IceDiscovery.Locator");
+
+ //
+ // Setup locatory registry.
+ //
+ LocatorRegistryIPtr locatorRegistry = new LocatorRegistryI(_communicator);
+ Ice::LocatorRegistryPrx locatorRegistryPrx =
+ Ice::LocatorRegistryPrx::uncheckedCast(locatorAdapter->addWithUUID(locatorRegistry));
+
+ string lookupEndpoints = properties->getProperty("IceDiscovery.Lookup");
+ if(lookupEndpoints.empty())
+ {
+ ostringstream os;
+ os << "udp -h \"" << address << "\" -p " << port;
+ if(!interface.empty())
+ {
+ os << " --interface \"" << interface << "\"";
+ }
+ lookupEndpoints = os.str();
+ }
+
+ Ice::ObjectPrx lookupPrx = _pluginCommunicator->stringToProxy("IceDiscovery/Lookup -d:" + lookupEndpoints);
+ lookupPrx = lookupPrx->ice_collocationOptimized(false);
+
+ //
+ // Add lookup and lookup reply Ice objects
+ //
+ LookupIPtr lookup = new LookupI(locatorRegistry, LookupPrx::uncheckedCast(lookupPrx), properties);
+ multicastAdapter->add(lookup, _pluginCommunicator->stringToIdentity("IceDiscovery/Lookup"));
+
+ Ice::ObjectPrx lookupReply = replyAdapter->addWithUUID(new LookupReplyI(lookup))->ice_datagram();
+ lookup->setLookupReply(LookupReplyPrx::uncheckedCast(lookupReply));
+
+ //
+ // Setup locator on the communicator.
+ //
+ Ice::ObjectPrx loc = locatorAdapter->addWithUUID(new LocatorI(lookup, locatorRegistryPrx));
+ _communicator->setDefaultLocator(Ice::LocatorPrx::uncheckedCast(_communicator->stringToProxy(loc->ice_toString())));
+
+ multicastAdapter->activate();
+ replyAdapter->activate();
+ locatorAdapter->activate();
+}
+
+void
+PluginI::destroy()
+{
+ _pluginCommunicator->destroy();
+}
diff --git a/cpp/src/IceDiscovery/PluginI.h b/cpp/src/IceDiscovery/PluginI.h
new file mode 100644
index 00000000000..4124602a08f
--- /dev/null
+++ b/cpp/src/IceDiscovery/PluginI.h
@@ -0,0 +1,35 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2013 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.
+//
+// **********************************************************************
+
+#ifndef PLUGIN_I_H
+#define PLUGIN_I_H
+
+#include <Ice/Plugin.h>
+
+namespace IceDiscovery
+{
+
+class PluginI : public Ice::Plugin
+{
+public:
+
+ PluginI(const Ice::CommunicatorPtr&);
+
+ virtual void initialize();
+ virtual void destroy();
+
+private:
+
+ const Ice::CommunicatorPtr _communicator;
+ Ice::CommunicatorPtr _pluginCommunicator;
+};
+
+};
+
+#endif
diff --git a/cpp/src/Makefile b/cpp/src/Makefile
index be82e9f78e5..1a2a28a0c55 100644
--- a/cpp/src/Makefile
+++ b/cpp/src/Makefile
@@ -36,6 +36,7 @@ else
IceXML \
IceSSL \
IceWS \
+ IceDiscovery \
Freeze \
FreezeScript \
IceBox \
diff --git a/cpp/src/Makefile.mak b/cpp/src/Makefile.mak
index 9500dc88c13..b4f49ead099 100644
--- a/cpp/src/Makefile.mak
+++ b/cpp/src/Makefile.mak
@@ -43,6 +43,7 @@ SUBDIRS = IceUtil \
Ice \
IceSSL \
IceWS \
+ IceDiscovery \
ca \
IceXML \
Freeze \